Package org.springframework.web.servlet.mvc.method

Examples of org.springframework.web.servlet.mvc.method.RequestMappingInfo


  }

  @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();

    Set<RequestMethod> requestMethods = requestMethodsRequestCondition.getMethods();
    Set<RequestMethod> supportedMethods = (requestMethods == null || requestMethods.isEmpty())
            ? allRequestMethods
View Full Code Here


   */
  @Override
  protected RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType) {

    if (method.getName().equals("publishClientJwk") && getJwkPublishUrl() != null) {
      return new RequestMappingInfo(
          new PatternsRequestCondition(new String[] {getJwkPublishUrl()}, getUrlPathHelper(), getPathMatcher(), false, false),
          null,
          null,
          null,
          null,
View Full Code Here

  }

  @Override
  protected RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType) {

    RequestMappingInfo defaultMapping = super.getMappingForMethod(method, handlerType);
    if (defaultMapping == null) {
      return null;
    }

    Set<String> defaultPatterns = defaultMapping.getPatternsCondition().getPatterns();
    String[] patterns = new String[defaultPatterns.size()];

    int i = 0;
    for (String pattern : defaultPatterns) {
      patterns[i] = getPath(pattern);
      paths.add(pattern);
      i++;
    }
    PatternsRequestCondition patternsInfo = new PatternsRequestCondition(patterns, getUrlPathHelper(),
        getPathMatcher(), useSuffixPatternMatch(), useTrailingSlashMatch(), getFileExtensions());

    ParamsRequestCondition paramsInfo = defaultMapping.getParamsCondition();
    if (!approvalParameter.equals(OAuth2Utils.USER_OAUTH_APPROVAL) && defaultPatterns.contains("/oauth/authorize")) {
      String[] params = new String[paramsInfo.getExpressions().size()];
      Set<NameValueExpression<String>> expressions = paramsInfo.getExpressions();
      i = 0;
      for (NameValueExpression<String> expression : expressions) {
        String param = expression.toString();
        if (OAuth2Utils.USER_OAUTH_APPROVAL.equals(param)) {
          params[i] = approvalParameter;
        }
        else {
          params[i] = param;
        }
        i++;
      }
      paramsInfo = new ParamsRequestCondition(params);
    }

    RequestMappingInfo mapping = new RequestMappingInfo(patternsInfo, defaultMapping.getMethodsCondition(),
        paramsInfo, defaultMapping.getHeadersCondition(), defaultMapping.getConsumesCondition(),
        defaultMapping.getProducesCondition(), defaultMapping.getCustomCondition());
    return mapping;

  }
View Full Code Here

                        method, userType) != null;
            }
        });

        for (Method method : methods) {
            RequestMappingInfo mapping =
                    (RequestMappingInfo) ReflectionUtils.invokeMethod(getMappingForMethodMethod, requestMappingHandlerMapping, method, userType);
            handlerMethods.remove(mapping);

            Set<String> patterns =
                    (Set<String>) ReflectionUtils.invokeMethod(getMappingPathPatternsMethod, requestMappingHandlerMapping, mapping);
View Full Code Here

                        method, userType) != null;
            }
        });

        for (Method method : methods) {
            RequestMappingInfo mapping =
                    (RequestMappingInfo) ReflectionUtils.invokeMethod(getMappingForMethodMethod, requestMappingHandlerMapping, method, userType);

            handlerMethods.remove(mapping);

            Set<String> patterns =
View Full Code Here

                return getMappingForMethod(method, controllerType) != null;
            }
        });

        for (Method method : methods) {
            RequestMappingInfo mapping = getMappingForMethod(method, controllerType);
            //Method have {@link RequestMapping} annotation
            if (mapping != null) {
                Set<String> patterns = getMappingPathPatterns(mapping);
                if (patterns.size() != 1) {
                    throw new IllegalStateException("Controller method " + method.getName() + " mapped to "
                            + patterns.size() + " urls. Expected 1 url");
                }
                Set<RequestMethod> requestMethods = mapping.getMethodsCondition().getMethods();
                if (requestMethods.size() != 1) {
                    throw new IllegalStateException("Controller method " + method.getName() + " mapped to " + methods.size()
                            + " methods. Expected 1 method");
                }
                keys.add(new MethodAwareKey(requestMethods.iterator().next(), getUniformUrl(patterns.iterator().next())));
View Full Code Here

    public void registerHandlerMethodShouldCallRegisterPluginHandlerMethodIfMethodIsPluginHandler() {
        doCallRealMethod().when(handlerMapping).registerHandlerMethod(any(), any(Method.class),
                any(RequestMappingInfo.class));

        TestPluginController controller = new TestPluginController();
        RequestMappingInfo mappingInfo = new RequestMappingInfo(null, null, null, null, null, null, null);
        handlerMapping.registerHandlerMethod(controller, TestPluginController.class.getMethods()[0], mappingInfo);

        verify(handlerMapping).registerPluginHandlerMethod(controller, TestPluginController.class.getMethods()[0],
                mappingInfo);
    }
View Full Code Here

    @Test
    public void pluginHandlerMethodsShouldNotContainMappingsIfOnlyApplicationControllersWereMapped() {
        PluginHandlerMapping mapping = PluginHandlerMapping.getInstance();
        TestController controller = new TestController();
        RequestMappingInfo mappingInfo = new RequestMappingInfo(null, null, null, null, null, null, null);

        mapping.registerHandlerMethod(controller, TestController.class.getMethods()[0], mappingInfo);
        Map<PluginHandlerMapping.MethodAwareKey, HandlerMethod> result = mapping.getPluginHandlerMethods();

        assertTrue(result.isEmpty());
View Full Code Here

   * @see #getCustomMethodCondition(Method)
   * @see #getCustomTypeCondition(Class)
   */
  @Override
  protected RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType) {
    RequestMappingInfo info = null;
    RequestMapping methodAnnotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);
    if (methodAnnotation != null) {
      RequestCondition<?> methodCondition = getCustomMethodCondition(method);
      info = createRequestMappingInfo(methodAnnotation, methodCondition);
      RequestMapping typeAnnotation = AnnotationUtils.findAnnotation(handlerType, RequestMapping.class);
View Full Code Here

  /**
   * Created a RequestMappingInfo from a RequestMapping annotation.
   */
  protected RequestMappingInfo createRequestMappingInfo(RequestMapping annotation, RequestCondition<?> customCondition) {
    String[] patterns = resolveEmbeddedValuesInPatterns(annotation.value());
    return new RequestMappingInfo(
        annotation.name(),
        new PatternsRequestCondition(patterns, getUrlPathHelper(), getPathMatcher(),
            this.useSuffixPatternMatch, this.useTrailingSlashMatch, this.fileExtensions),
        new RequestMethodsRequestCondition(annotation.method()),
        new ParamsRequestCondition(annotation.params()),
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.mvc.method.RequestMappingInfo

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.