Example usage for org.springframework.http.server ServletServerHttpRequest getMethod

List of usage examples for org.springframework.http.server ServletServerHttpRequest getMethod

Introduction

In this page you can find the example usage for org.springframework.http.server ServletServerHttpRequest getMethod.

Prototype

@Override
    @Nullable
    public HttpMethod getMethod() 

Source Link

Usage

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

/**
 * No handler found -> set appropriate HTTP response status.
 * /*from   w  w w.  ja  va2  s . c  o  m*/
 * @param request
 *            current HTTP request
 * @param response
 *            current HTTP response
 * @throws Exception
 *             if preparing the response failed
 */
protected void noHandlerFound(HttpServletRequest request, HttpServletResponse response) throws Exception {
    if (pageNotFoundLogger.isWarnEnabled()) {
        String requestUri = urlPathHelper.getRequestUri(request);
        pageNotFoundLogger.warn("No mapping found for HTTP request with URI [" + requestUri
                + "] in DispatcherServlet with name '" + getServletName() + "'");
    }
    if (throwExceptionIfNoHandlerFound) {
        ServletServerHttpRequest req = new ServletServerHttpRequest(request);
        throw new NoHandlerFoundException(req.getMethod().name(), req.getServletRequest().getRequestURI(),
                req.getHeaders());
    } else {
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
    }
}