Package org.springframework.web.method

Examples of org.springframework.web.method.HandlerMethod


   * @param mapping the mapping conditions associated with the handler method
   * @throws IllegalStateException if another method was already registered
   * under the same mapping
   */
  protected void registerHandlerMethod(Object handler, Method method, T mapping) {
    HandlerMethod handlerMethod;
    if (handler instanceof String) {
      String beanName = (String) handler;
      handlerMethod = new HandlerMethod(beanName, getApplicationContext(), method);
    }
    else {
      handlerMethod = new HandlerMethod(handler, method);
    }
   
    HandlerMethod oldHandlerMethod = handlerMethods.get(mapping);
    if (oldHandlerMethod != null && !oldHandlerMethod.equals(handlerMethod)) {
      throw new IllegalStateException("Ambiguous mapping found. Cannot map '" + handlerMethod.getBean()
          + "' bean method \n" + handlerMethod + "\nto " + mapping + ": There is already '"
          + oldHandlerMethod.getBean() + "' bean method\n" + oldHandlerMethod + " mapped.");
    }
   
    handlerMethods.put(mapping, handlerMethod);
    if (logger.isInfoEnabled()) {
      logger.info("Mapped \"" + mapping + "\" onto " + handlerMethod);
View Full Code Here


    String lookupPath = getUrlPathHelper().getLookupPathForRequest(request);
    if (logger.isDebugEnabled()) {
      logger.debug("Looking up handler method for path " + lookupPath);
    }

    HandlerMethod handlerMethod = lookupHandlerMethod(lookupPath, request);

    if (logger.isDebugEnabled()) {
      if (handlerMethod != null) {
        logger.debug("Returning handler method [" + handlerMethod + "]");
      }
      else {
        logger.debug("Did not find handler method for [" + lookupPath + "]");
      }
    }

    return (handlerMethod != null) ? handlerMethod.createWithResolvedBean() : null;
  }
View Full Code Here

  protected boolean shouldApplyTo(HttpServletRequest request, Object handler) {
    if (handler == null) {
      return super.shouldApplyTo(request, handler);
    }
    else if (handler instanceof HandlerMethod) {
      HandlerMethod handlerMethod = (HandlerMethod) handler;
      handler = handlerMethod.getBean();
      return super.shouldApplyTo(request, handler);
    }
    else {
      return false;
    }
View Full Code Here

   * @param mapping the mapping conditions associated with the handler method
   * @throws IllegalStateException if another method was already registered
   * under the same mapping
   */
  protected void registerHandlerMethod(Object handler, Method method, T mapping) {
    HandlerMethod handlerMethod;
    if (handler instanceof String) {
      String beanName = (String) handler;
      handlerMethod = new HandlerMethod(beanName, getApplicationContext(), method);
    }
    else {
      handlerMethod = new HandlerMethod(handler, method);
    }

    HandlerMethod oldHandlerMethod = handlerMethods.get(mapping);
    if (oldHandlerMethod != null && !oldHandlerMethod.equals(handlerMethod)) {
      throw new IllegalStateException("Ambiguous mapping found. Cannot map '" + handlerMethod.getBean()
          + "' bean method \n" + handlerMethod + "\nto " + mapping + ": There is already '"
          + oldHandlerMethod.getBean() + "' bean method\n" + oldHandlerMethod + " mapped.");
    }

    this.handlerMethods.put(mapping, handlerMethod);
    if (logger.isInfoEnabled()) {
      logger.info("Mapped \"" + mapping + "\" onto " + handlerMethod);
View Full Code Here

    String lookupPath = getUrlPathHelper().getLookupPathForRequest(request);
    if (logger.isDebugEnabled()) {
      logger.debug("Looking up handler method for path " + lookupPath);
    }

    HandlerMethod handlerMethod = lookupHandlerMethod(lookupPath, request);

    if (logger.isDebugEnabled()) {
      if (handlerMethod != null) {
        logger.debug("Returning handler method [" + handlerMethod + "]");
      }
      else {
        logger.debug("Did not find handler method for [" + lookupPath + "]");
      }
    }

    return (handlerMethod != null) ? handlerMethod.createWithResolvedBean() : null;
  }
View Full Code Here

  protected boolean shouldApplyTo(HttpServletRequest request, Object handler) {
    if (handler == null) {
      return super.shouldApplyTo(request, handler);
    }
    else if (handler instanceof HandlerMethod) {
      HandlerMethod handlerMethod = (HandlerMethod) handler;
      handler = handlerMethod.getBean();
      return super.shouldApplyTo(request, handler);
    }
    else {
      return false;
    }
View Full Code Here

        }
    }

    @Override
    protected HandlerMethod createHandlerMethod(Object handler, Method method) {
        HandlerMethod handlerMethod = super.createHandlerMethod(handler, method);

        if (restBridgedMethod != null) {
            handlerMethod = new ServiceHandlerMethod(handler, method, restBridgedMethod);
        }
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

    if (methodInfo != null && methodInfo.getForwardPath() != null) {
      return methodInfo.getForwardPath();
    } else if (methodInfo != null && methodInfo.getHandlerMethod() != null) {
      streamResponse = configuration.isStreamResponse() || methodInfo.isStreamResponse();

      HandlerMethod handlerMethod = methodInfo.getHandlerMethod();
      try {

        ModelAndView modelAndView = null;

        if (configuration.isSynchronizeOnSession() || methodInfo.isSynchronizeOnSession()) {
View Full Code Here

   * @return
   * @throws Exception
   */
  protected String getViewNameFromRequest() throws Exception {
    HandlerExecutionChain execution = getHandler(getCurrentRequestAttributes().getRequest());
    HandlerMethod hm = (HandlerMethod) execution.getHandler();
    String name = hm.getMethod().getName();
   
    if (hm.getMethod().isAnnotationPresent(ResponseMapping.class)) {
      ResponseMapping responseMapping = hm.getMethod().getAnnotation(ResponseMapping.class);
      name = responseMapping.value()[0];
    }
   
    return name;
  }
View Full Code Here

TOP

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

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.