Package org.springframework.web.util

Examples of org.springframework.web.util.UrlPathHelper


   * for the actual dispatching.
   */
  @Override
  protected void doService(HttpServletRequest request, HttpServletResponse response) throws Exception {
    if (logger.isDebugEnabled()) {
      String requestUri = new UrlPathHelper().getRequestUri(request);
      logger.debug("DispatcherServlet with name '" + getServletName() + "' processing " + request.getMethod() +
          " request for [" + requestUri + "]");
    }

    // Keep a snapshot of the request attributes in case of an include,
View Full Code Here


   * of the mapped handler.
   */
  @Override
  protected long getLastModified(HttpServletRequest request) {
    if (logger.isDebugEnabled()) {
      String requestUri = new UrlPathHelper().getRequestUri(request);
      logger.debug(
          "DispatcherServlet with name '" + getServletName() + "' determining Last-Modified value for [" +
              requestUri + "]");
    }
    try {
      HandlerExecutionChain mappedHandler = getHandler(request, true);
      if (mappedHandler == null || mappedHandler.getHandler() == null) {
        // Ignore -> will reappear on doService.
        logger.debug("No handler found in getLastModified");
        return -1;
      }

      HandlerAdapter ha = getHandlerAdapter(mappedHandler.getHandler());
      long lastModified = ha.getLastModified(request, mappedHandler.getHandler());
      if (logger.isDebugEnabled()) {
        String requestUri = new UrlPathHelper().getRequestUri(request);
        logger.debug("Last-Modified value for [" + requestUri + "] is: " + lastModified);
      }
      return lastModified;
    }
    catch (Exception ex) {
View Full Code Here

   * @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 = new UrlPathHelper().getRequestUri(request);
      pageNotFoundLogger.warn("No mapping found for HTTP request with URI [" + requestUri +
          "] in DispatcherServlet with name '" + getServletName() + "'");
    }
    response.sendError(HttpServletResponse.SC_NOT_FOUND);
  }
View Full Code Here

   * Exposes the DispatcherServlet-specific request attributes and
   * delegates to {@link #doDispatch} for the actual dispatching.
   */
  protected void doService(HttpServletRequest request, HttpServletResponse response) throws Exception {
    if (logger.isDebugEnabled()) {
      String requestUri = new UrlPathHelper().getRequestUri(request);
      logger.debug(
          "DispatcherServlet with name '" + getServletName() + "' received request for [" + requestUri + "]");
    }

    // Keep a snapshot of the request attributes in case of an include,
View Full Code Here

      }

      HandlerAdapter ha = getHandlerAdapter(mappedHandler.getHandler());
      long lastModified = ha.getLastModified(request, mappedHandler.getHandler());
      if (logger.isDebugEnabled()) {
        String requestUri = new UrlPathHelper().getRequestUri(request);
        logger.debug("Last-Modified value for [" + requestUri + "] is: " + lastModified);
      }
      return lastModified;
    }
    catch (Exception ex) {
View Full Code Here

   * @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 = new UrlPathHelper().getRequestUri(request);
      pageNotFoundLogger.warn("No mapping found for HTTP request with URI [" +
          requestUri + "] in DispatcherServlet with name '" + getServletName() + "'");
    }
    response.sendError(HttpServletResponse.SC_NOT_FOUND);
  }
View Full Code Here

                    handlerInterceptors.add((HandlerInterceptor) interceptor);
                } else if (interceptor instanceof WebRequestInterceptor) {
                    handlerInterceptors.add(new WebRequestHandlerInterceptorAdapter((WebRequestInterceptor) interceptor));
                } else if (interceptor instanceof MappedInterceptor) {
                    handlerInterceptors.add(new MappedInterceptorAdapter((MappedInterceptor)interceptor,
                            new UrlPathHelper(), new AntPathMatcher()));
                }
            }
        }

        return handlerInterceptors;
View Full Code Here

     */
    private ResponseEntity<String> handleRequestInternal(HttpMethod method, HttpEntity<String> requestEntity) {
        HttpMessage request = endpointConfiguration.getMessageConverter().convertInbound(requestEntity, endpointConfiguration);

        HttpServletRequest servletRequest = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        UrlPathHelper pathHelper = new UrlPathHelper();

        request.setRequestUri(pathHelper.getRequestUri(servletRequest));
        request.setContextPath(pathHelper.getContextPath(servletRequest));

        String queryParams = pathHelper.getOriginatingQueryString(servletRequest);
        request.setQueryParams(queryParams != null ? queryParams : "");

        request.setRequestMethod(method);

        Message response = endpointAdapter.handleMessage(request);
View Full Code Here

    // Determine default HTML escape setting from the "defaultHtmlEscape"
    // context-param in web.xml, if any.
    this.defaultHtmlEscape = WebUtils.getDefaultHtmlEscape(this.webApplicationContext.getServletContext());

    this.urlPathHelper = new UrlPathHelper();
  }
View Full Code Here

  @RequestMapping(value = { "/", "/home" }, method = RequestMethod.GET)
  public String getResources(HttpServletRequest request, ModelMap model) {

    String servletPath = this.servletPath;
    if (servletPath == null) {
      servletPath = new UrlPathHelper().getServletPath(request);
    }
    model.addAttribute("servletPath", servletPath);
    List<ResourceInfo> resources = new ArrayList<ResourceInfo>();
    if (!request.getRequestURI().endsWith(".json")) {
      resources.addAll(defaultResources);
View Full Code Here

TOP

Related Classes of org.springframework.web.util.UrlPathHelper

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.