Examples of RequestMapping


Examples of org.springframework.web.bind.annotation.RequestMapping

            for (Method interfaceMethod : methods) {
                Method method = BridgeMethodResolver.findBridgedMethod(interfaceMethod);
                Class<?> responseClazz = method.getReturnType();

                RequestMapping requestMapping = AnnotationUtils.findAnnotation(method, RequestMapping.class);
                RestRequestResource restRequestResource = AnnotationUtils.findAnnotation(method, RestRequestResource.class);
                boolean export = (restRequestResource != null ? restRequestResource.export() : true);

                // if the method declaring class is in the parent, get the return type from the service or converter (because of erasure)
                if (!marshallingServiceClass.equals(method.getDeclaringClass())) {
                    String restRequestResourceMethodName = (restRequestResource != null ? restRequestResource.methodName() : null);
                    String methodName = (StringUtils.hasText(restRequestResourceMethodName) ? restRequestResourceMethodName : method.getName());
                    Class<?>[] paramTypes = method.getParameterTypes();

                    try {
                        Method serviceMethod = ReflectionUtils.findMethod(serviceClass, methodName, paramTypes);
                        responseClazz = serviceMethod.getReturnType();
                    } catch(IllegalStateException e) {
                    }
                }

                if (export) {
                    boolean relative = (restRequestResource != null ? restRequestResource.relative() : true);

                    // just get first param if more than one
                    StringBuilder uri = new StringBuilder();

                    if (relative) {
                        for (String pattern : requestMapping.value()) {
                            // add REST resource path prefix to URI,
                            // if relative path is just '/' add an empty string
                            uri.append(restResource.path());
                            uri.append((!"/".equals(pattern) ? pattern : ""));

                            break;
                        }
                    } else {
                        uri.append(requestMapping.value()[0]);
                    }

                    String[] params = requestMapping.params();

                    if (params != null && params.length > 0) {
                        uri.append("?");

                        for (int i = 0; i < params.length; i++) {
                            String param = params[i];

                            uri.append(param);
                            uri.append("={");
                            uri.append(param);
                            uri.append("}");

                            if (i < (params.length - 1)) {
                                uri.append("&");
                            }
                        }
                    }

                    RequestMethod requestMethod = requestMapping.method()[0];

                    if (RequestMethod.POST.equals(requestMethod) || RequestMethod.PUT.equals(requestMethod)
                            || RequestMethod.DELETE.equals(requestMethod)) {
                        responseClazz = restResource.responseClass();
                    }
View Full Code Here

Examples of org.springframework.web.bind.annotation.RequestMapping

        }
      }
    } else {
      if (method.getReturnType().equals(Void.TYPE)) {

        RequestMapping methodAnnotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);
        RequestMapping classAnnotation = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);

        String path = null;
        if (hasValue(classAnnotation)) {
          path = classAnnotation.value()[0];
        }

        if (hasValue(methodAnnotation)) {
          String methodPath = methodAnnotation.value()[0];
          if (path != null) {
View Full Code Here

Examples of org.springframework.web.bind.annotation.RequestMapping

          }
        }
      }

    } else {
      RequestMapping methodAnnotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);
      if (methodAnnotation != null) {

        RequestMapping classAnnotation = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);

        String path = null;
        if (hasValue(classAnnotation)) {
          path = classAnnotation.value()[0];
        }

        if (hasValue(methodAnnotation)) {
          String methodPath = methodAnnotation.value()[0];
          if (path != null) {
View Full Code Here

Examples of org.springframework.web.bind.annotation.RequestMapping

  private boolean isValidFormPostMethod(final Class<?> clazz, final Method method) {
    if (AnnotationUtils.findAnnotation(clazz, Controller.class) == null) {
      return false;
    }

    RequestMapping methodAnnotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);

    if (methodAnnotation == null) {
      return false;
    }

    RequestMapping classAnnotation = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);

    boolean hasValue = false;

    if (classAnnotation != null) {
      hasValue = (classAnnotation.value() != null && classAnnotation.value().length > 0);
    }

    if (!hasValue) {
      hasValue = (methodAnnotation.value() != null && methodAnnotation.value().length > 0);
    }
View Full Code Here

Examples of org.springframework.web.bind.annotation.RequestMapping

  private boolean isValidFormPostMethod(final Class<?> clazz, final Method method) {
    if (AnnotationUtils.findAnnotation(clazz, Controller.class) == null) {
      return false;
    }

    RequestMapping methodAnnotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);

    if (methodAnnotation == null) {
      return false;
    }

    RequestMapping classAnnotation = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);

    boolean hasValue = false;

    if (classAnnotation != null) {
      hasValue = (classAnnotation.value() != null && classAnnotation.value().length > 0);
    }

    if (!hasValue) {
      hasValue = (methodAnnotation.value() != null && methodAnnotation.value().length > 0);
    }
View Full Code Here

Examples of org.springframework.web.bind.annotation.RequestMapping

  public MethodInfo(final Class<?> clazz, final Method method) {

    this.method = method;

    RequestMapping methodAnnotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);
    if (methodAnnotation != null) {

      RequestMapping classAnnotation = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);

      String path = null;
      if (hasValue(classAnnotation)) {
        path = classAnnotation.value()[0];
      }

      if (hasValue(methodAnnotation)) {
        String methodPath = methodAnnotation.value()[0];
        if (path != null) {
View Full Code Here

Examples of org.springframework.web.bind.annotation.RequestMapping

  private boolean isValidFormPostMethod(final Class<?> clazz, final Method method) {
    if (AnnotationUtils.findAnnotation(clazz, Controller.class) == null) {
      return false;
    }

    RequestMapping methodAnnotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);

    if (methodAnnotation == null) {
      return false;
    }

    RequestMapping classAnnotation = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);

    boolean hasValue = false;

    if (classAnnotation != null) {
      hasValue = (classAnnotation.value() != null && classAnnotation.value().length > 0);
    }

    if (!hasValue) {
      hasValue = (methodAnnotation.value() != null && methodAnnotation.value().length > 0);
    }
View Full Code Here

Examples of org.springframework.web.bind.annotation.RequestMapping

    }


    private static String getTypeRequestMapping(Class<?> controllerType) {
        Assert.notNull(controllerType, "'controllerType' must not be null");
        RequestMapping annot = AnnotationUtils.findAnnotation(controllerType, RequestMapping.class);
        if ((annot == null) || ObjectUtils.isEmpty(annot.value()) || StringUtils.isEmpty(annot.value()[0])) {
            return "/";
        }
        if (annot.value().length > 1) {
            logger.warn("Multiple mappings on controller " + controllerType.getName() + ", using the first one");
        }
        return annot.value()[0];
    }
View Full Code Here

Examples of org.springframework.web.bind.annotation.RequestMapping

        }
        return annot.value()[0];
    }

    private static String getMethodRequestMapping(Method method) {
        RequestMapping annot = AnnotationUtils.findAnnotation(method, RequestMapping.class);
        Assert.notNull(annot, "No @RequestMapping on: " + method.toGenericString());
        if (ObjectUtils.isEmpty(annot.value()) || StringUtils.isEmpty(annot.value()[0])) {
            return "/";
        }
        if (annot.value().length > 1) {
            logger.debug("Multiple mappings on method " + method.toGenericString() + ", using first one");
        }
        return annot.value()[0];
    }
View Full Code Here

Examples of org.springframework.web.bind.annotation.RequestMapping

  public MethodInfo(final Class<?> clazz, final Method method) {

    this.method = method;

    RequestMapping methodAnnotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);
    if (methodAnnotation != null) {

      RequestMapping classAnnotation = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);

      String path = null;
      if (hasValue(classAnnotation)) {
        path = classAnnotation.value()[0];
      }

      if (hasValue(methodAnnotation)) {
        String methodPath = methodAnnotation.value()[0];
        if (path != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.