List of usage examples for org.springframework.web.method HandlerMethod getMethod
public Method getMethod()
From source file:springfox.documentation.spring.web.HandlerMethodReturnTypes.java
public static ResolvedType handlerReturnType(TypeResolver resolver, HandlerMethod handlerMethod) { Class hostClass = useType(handlerMethod.getBeanType()).or(handlerMethod.getMethod().getDeclaringClass()); return new HandlerMethodResolver(resolver).methodReturnType(handlerMethod.getMethod(), hostClass); }
From source file:springfox.documentation.spring.web.readers.operation.ResponseMessagesReader.java
public static int httpStatusCode(HandlerMethod handlerMethod) { Optional<ResponseStatus> responseStatus = fromNullable( getAnnotation(handlerMethod.getMethod(), ResponseStatus.class)); int httpStatusCode = HttpStatus.OK.value(); if (responseStatus.isPresent()) { httpStatusCode = responseStatus.get().value().value(); }//w w w . java 2 s. c o m return httpStatusCode; }
From source file:springfox.documentation.spring.web.readers.operation.ResponseMessagesReader.java
public static String message(HandlerMethod handlerMethod) { Optional<ResponseStatus> responseStatus = fromNullable( getAnnotation(handlerMethod.getMethod(), ResponseStatus.class)); String reasonPhrase = HttpStatus.OK.getReasonPhrase(); if (responseStatus.isPresent()) { reasonPhrase = responseStatus.get().reason(); if (reasonPhrase.isEmpty()) { reasonPhrase = responseStatus.get().value().getReasonPhrase(); }/*from w w w.j ava 2 s . co m*/ } return reasonPhrase; }
From source file:org.docksidestage.dbflute.svflute.GodHandableControllerInterceptor.java
protected String buildActionDisp(HandlerMethod handlerMethod) { final Method method = handlerMethod.getMethod(); final Class<?> declaringClass = method.getDeclaringClass(); return declaringClass.getSimpleName() + "." + method.getName() + "()"; }
From source file:org.docksidestage.dbflute.svflute.GodHandableControllerInterceptor.java
protected String buildActionName(HandlerMethod handlerMethod) { final Method method = handlerMethod.getMethod(); final Class<?> declaringClass = method.getDeclaringClass(); return declaringClass.getSimpleName(); }
From source file:de.kbs.acavis.presentation.controller.NavigationInterceptor.java
/** * Adds existing collections to the page-model if controller-method is not annotated {@link WithoutNavigation}. *///from w w w . jav a 2s. c o m @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { // The DAO has to be loaded locally because this class is instantiated as a bean too. This makes it impossible to access a complete // application-context on instantiation. CollectionManager collectionManager = ApplicationContextProvider.getApplicationContext() .getBean(CollectionManager.class); boolean withoutNavigation = false; // If controller is annotated, don't add navigation-stuff to model if (handler != null && handler instanceof HandlerMethod) { HandlerMethod x = (HandlerMethod) handler; withoutNavigation = x.getMethod().isAnnotationPresent(WithoutNavigation.class); } if (!withoutNavigation) request.setAttribute("existing_collections", collectionManager.getCollections()); }
From source file:springfox.documentation.swagger.readers.operation.OperationImplicitParametersReader.java
protected List<Parameter> readParameters(OperationContext context) { HandlerMethod handlerMethod = context.getHandlerMethod(); Method method = handlerMethod.getMethod(); ApiImplicitParams annotation = AnnotationUtils.findAnnotation(method, ApiImplicitParams.class); List<Parameter> parameters = Lists.newArrayList(); if (null != annotation) { for (ApiImplicitParam param : annotation.value()) { parameters.add(OperationImplicitParameterReader.implicitParameter(param)); }// w w w . j a v a2 s . c o m } return parameters; }
From source file:springfox.documentation.swagger.readers.operation.OperationImplicitParameterReader.java
protected List<Parameter> readParameters(OperationContext context) { HandlerMethod handlerMethod = context.getHandlerMethod(); Method method = handlerMethod.getMethod(); ApiImplicitParam annotation = AnnotationUtils.findAnnotation(method, ApiImplicitParam.class); List<Parameter> parameters = Lists.newArrayList(); if (null != annotation) { parameters.add(OperationImplicitParameterReader.implicitParameter(annotation)); }/* w w w. j a va 2 s .c o m*/ return parameters; }
From source file:com.mmj.app.common.interceptor.TokenAnnotationInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (handler instanceof HandlerMethod) { HandlerMethod handlerMethod = (HandlerMethod) handler; Method method = handlerMethod.getMethod(); Token annotation = method.getAnnotation(Token.class); if (annotation != null) { boolean needSaveSession = annotation.save(); if (needSaveSession) { // request.getSession(false).setAttribute("token", UUIDUtils.createUUID()); request.getSession().setAttribute(TOKEN, UUIDGenerator.createUUID()); }// w ww . jav a 2 s. c o m boolean needRemoveSession = annotation.remove(); if (needRemoveSession) { if (isRepeatSubmit(request)) { return false; } // request.getSession(false).removeAttribute("token"); request.getSession().removeAttribute(TOKEN); } } return true; } else { return super.preHandle(request, response, handler); } }
From source file:org.zht.framework.interceptors.TokenInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (handler instanceof HandlerMethod) { HandlerMethod handlerMethod = (HandlerMethod) handler; Method method = handlerMethod.getMethod(); RepeatToken annotation = method.getAnnotation(RepeatToken.class); if (annotation != null) { HttpSession session = request.getSession(false); if (session == null) { return true; }/* ww w . j a v a2 s . com*/ String seesionId = session.getId(); String uri = request.getRequestURI(); Boolean isPosted = (Boolean) session.getAttribute("_Token" + seesionId + uri); if (isPosted == null || isPosted == false) { session.setAttribute("_Token" + seesionId + uri, true); return true; } else { //?? return false; } } return true; } else { return super.preHandle(request, response, handler); } }