Package org.springframework.web.method

Examples of org.springframework.web.method.HandlerMethod$ReturnValueMethodParameter


import org.springframework.web.method.HandlerMethod;

public class OperationSummaryReader implements RequestMappingReader {
  @Override
  public void execute(RequestMappingContext context) {
    HandlerMethod handlerMethod = context.getHandlerMethod();
    ApiOperation apiOperationAnnotation = context.getApiOperationAnnotation();

    String summary = handlerMethod.getMethod().getName();
    if (null != apiOperationAnnotation && !StringUtils.isBlank(apiOperationAnnotation.value())) {
      summary = apiOperationAnnotation.value();
    }
    context.put("summary", summary);
  }
View Full Code Here


  private static Logger log = LoggerFactory.getLogger(OperationResponseClassReader.class);

  @Override
  public void execute(RequestMappingContext context) {
    SwaggerGlobalSettings swaggerGlobalSettings = (SwaggerGlobalSettings) context.get("swaggerGlobalSettings");
    HandlerMethod handlerMethod = context.getHandlerMethod();
    ApiOperation methodAnnotation = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), ApiOperation.class);
    ResolvedType returnType;
    if ((null != methodAnnotation) && Void.class != methodAnnotation.response()) {
      log.debug("Overriding response class with annotated response class");
      returnType = swaggerGlobalSettings.getTypeResolver().resolve(methodAnnotation.response());
    } else {
View Full Code Here

  @Override
  public void execute(RequestMappingContext outerContext) {

    RequestMappingInfo requestMappingInfo = outerContext.getRequestMappingInfo();
    HandlerMethod handlerMethod = outerContext.getHandlerMethod();
    SwaggerGlobalSettings swaggerGlobalSettings = (SwaggerGlobalSettings) outerContext.get("swaggerGlobalSettings");
    AuthorizationContext authorizationContext = (AuthorizationContext) outerContext.get("authorizationContext");
    String requestMappingPattern = (String) outerContext.get("requestMappingPattern");
    RequestMethodsRequestCondition requestMethodsRequestCondition = requestMappingInfo.getMethodsCondition();
    List<Operation> operations = newArrayList();
View Full Code Here

    this.modelProvider = modelProvider;
  }

  @Override
  public void execute(RequestMappingContext context) {
    HandlerMethod handlerMethod = context.getHandlerMethod();

    log.debug("Reading models for handlerMethod |{}|", handlerMethod.getMethod().getName());

    Map<String, Model> modelMap = newHashMap();
    SwaggerGlobalSettings swaggerGlobalSettings = (SwaggerGlobalSettings) context.get("swaggerGlobalSettings");
    HandlerMethodResolver handlerMethodResolver
            = new HandlerMethodResolver(swaggerGlobalSettings.getTypeResolver());
    ResolvedType modelType = ModelUtils.handlerReturnType(swaggerGlobalSettings.getTypeResolver(), handlerMethod);
    modelType = swaggerGlobalSettings.getAlternateTypeProvider().alternateFor(modelType);

    ApiOperation apiOperationAnnotation = handlerMethod.getMethodAnnotation(ApiOperation.class);
    if (null != apiOperationAnnotation && Void.class != apiOperationAnnotation.response()) {
      modelType = asResolved(swaggerGlobalSettings.getTypeResolver(), apiOperationAnnotation.response());
    }
    if (!swaggerGlobalSettings.getIgnorableParameterTypes().contains(modelType.getErasedType())) {
      ModelContext modelContext = ModelContext.returnValue(modelType);
      markIgnorablesAsHasSeen(swaggerGlobalSettings.getTypeResolver(),
              swaggerGlobalSettings.getIgnorableParameterTypes(),
              modelContext);
      Optional<Model> model = modelProvider.modelFor(modelContext);
      if (model.isPresent() && !"void".equals(model.get().name())) {
        log.debug("Swagger generated parameter model id: {}, name: {}, schema: {} models",
                model.get().id(),
                model.get().name());
        modelMap.put(model.get().id(), model.get());
      } else {
        log.debug("Swagger core did not find any models");
      }
      populateDependencies(modelContext, modelMap);
    }
    mergeModelMap(modelMap, readParametersApiModel(handlerMethodResolver, swaggerGlobalSettings, handlerMethod));

    log.debug("Finished reading models for handlerMethod |{}|", handlerMethod.getMethod().getName());
    context.put("models", modelMap);
  }
View Full Code Here

    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        if (! (HandlerMethod.class.isAssignableFrom(handler.getClass()))) {
            return true;
        }

        HandlerMethod handlerMethod = (HandlerMethod) handler;
        IfNoneMatch eTagAnn = handlerMethod.getMethod().getAnnotation(IfNoneMatch.class);

        if (eTagAnn == null) {
            // if no annotation, proceed with request
            return true;
        }
View Full Code Here

    if (handler == null) {
      this.printer.printValue("Type", null);
    }
    else {
      if (handler instanceof HandlerMethod) {
        HandlerMethod handlerMethod = (HandlerMethod) handler;
        this.printer.printValue("Type", handlerMethod.getBeanType().getName());
        this.printer.printValue("Method", handlerMethod);
      }
      else {
        this.printer.printValue("Type", handler.getClass().getName());
      }
View Full Code Here

    assertValue("Handler", "Type", Object.class.getName());
  }

  @Test
  public void testPrintHandlerMethod() throws Exception {
    HandlerMethod handlerMethod = new HandlerMethod(this, "handle");
    this.mvcResult.setHandler(handlerMethod);
    this.handler.handle(mvcResult);

    assertValue("Handler", "Type", this.getClass().getName());
    assertValue("Handler", "Method", handlerMethod);
View Full Code Here

    ServletContext servletContext;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        if (handler instanceof HandlerMethod) {
            HandlerMethod handlerMethod = (HandlerMethod) handler;
            Boolean isReadOnly = (Boolean) servletContext.getAttribute(SERVLET_CONTEXT_ATTR_KEY);
            if (isReadOnly == null) {
                isReadOnly = false;
            }
            if (isReadOnly &&
                handlerMethod.getBean() != null &&
                handlerMethod.getBean().getClass().getAnnotation(ReadWriteController.class) != null) {
                throw new InReadOnlyModeException(request.getPathInfo());
            }
        }

        return super.preHandle(request, response, handler);
View Full Code Here

        return;
      }
    }

    for (HandlerMethod match : matches) {
      HandlerMethod handlerMethod = match.createWithResolvedBean();

      InvocableHandlerMethod invocableHandlerMethod = new InvocableHandlerMethod(handlerMethod, objectMapper,
          conversionService);
      invocableHandlerMethod.setMessageMethodArgumentResolvers(this.argumentResolvers);
View Full Code Here

            path = path.substring(1, path.length());
          }
          this.forwardPath = "forward:" + path;
        }
      } else {
        this.handlerMethod = new HandlerMethod(beanName, context, method).createWithResolvedBean();
      }
    }

    switch (type) {
    case SIMPLE:
View Full Code Here

TOP

Related Classes of org.springframework.web.method.HandlerMethod$ReturnValueMethodParameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.