Example usage for org.springframework.web.servlet HandlerAdapter supports

List of usage examples for org.springframework.web.servlet HandlerAdapter supports

Introduction

In this page you can find the example usage for org.springframework.web.servlet HandlerAdapter supports.

Prototype

boolean supports(Object handler);

Source Link

Document

Given a handler instance, return whether or not this HandlerAdapter can support it.

Usage

From source file:com.mystudy.source.spring.mvc.DispatcherServlet.java

/**
 * Return the HandlerAdapter for this handler object.
 * @param handler the handler object to find an adapter for
 * @throws ServletException if no HandlerAdapter can be found for the handler. This is a fatal error.
 *///  w  w  w  . j a v  a 2s  .  co m
protected HandlerAdapter getHandlerAdapter(Object handler) throws ServletException {
    for (HandlerAdapter ha : this.handlerAdapters) {
        if (logger.isTraceEnabled()) {
            logger.trace("Testing handler adapter [" + ha + "]");
        }
        if (ha.supports(handler)) {
            return ha;
        }
    }
    throw new ServletException("No adapter for handler [" + handler
            + "]: The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler");
}

From source file:org.springframework.web.portlet.DispatcherPortlet.java

/**
 * Return the HandlerAdapter for this handler object.
 * @param handler the handler object to find an adapter for
 * @throws PortletException if no HandlerAdapter can be found for the handler.
 * This is a fatal error./*from  ww w  .ja va 2  s  . c  om*/
 */
protected HandlerAdapter getHandlerAdapter(Object handler) throws PortletException {
    for (HandlerAdapter ha : this.handlerAdapters) {
        if (logger.isDebugEnabled()) {
            logger.debug("Testing handler adapter [" + ha + "]");
        }
        if (ha.supports(handler)) {
            return ha;
        }
    }
    throw new PortletException("No adapter for handler [" + handler
            + "]: Does your handler implement a supported interface like Controller?");
}

From source file:org.springframework.web.servlet.DispatcherServlet.java

/**
 * Return the HandlerAdapter for this handler object.
 * @param handler the handler object to find an adapter for
 * @throws ServletException if no HandlerAdapter can be found for the handler. This is a fatal error.
 *///from   www  . j  a v a2s .  c om
protected HandlerAdapter getHandlerAdapter(Object handler) throws ServletException {
    if (this.handlerAdapters != null) {
        for (HandlerAdapter ha : this.handlerAdapters) {
            if (logger.isTraceEnabled()) {
                logger.trace("Testing handler adapter [" + ha + "]");
            }
            if (ha.supports(handler)) {
                return ha;
            }
        }
    }
    throw new ServletException("No adapter for handler [" + handler
            + "]: The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler");
}

From source file:org.springframework.web.servlet.MyDispatcherServlet.java

/**
 * Return the HandlerAdapter for this handler object.
 * @param handler the handler object to find an adapter for
 * @throws ServletException if no HandlerAdapter can be found for the handler. This is a fatal error.
 *//* www.ja  va 2 s  . c  om*/
protected HandlerAdapter getHandlerAdapter(Object handler) throws ServletException {
    for (HandlerAdapter ha : this.handlerAdapters) {
        if (logger.isTraceEnabled()) {
            logger.trace("Testing handler adapter [" + ha + "]");
        }
        if (ha.supports(handler)) {
            return ha;
        }
    }
    throw new ServletException("No adapter for handler [" + handler
            + "]: Does your handler implement a supported interface like Controller?");
}

From source file:org.springframework.web.servlet.SimpleDispatcherServlet.java

/**
 * Return the HandlerAdapter for this handler object.
 * @param handler the handler object to find an adapter for
 * @throws ServletException if no HandlerAdapter can be found for the handler. This is a fatal error.
 *///  w w w  .ja va 2s .  c  o  m
public HandlerAdapter getHandlerAdapter(Object handler) throws ServletException {
    for (HandlerAdapter ha : this.handlerAdapters) {
        if (logger.isTraceEnabled()) {
            logger.trace("Testing handler adapter [" + ha + "]");
        }
        if (ha.supports(handler)) {
            return ha;
        }
    }
    throw new ServletException("No adapter for handler [" + handler
            + "]: Does your handler implement a supported interface like Controller?");
}