Package org.springframework.web.context.request

Examples of org.springframework.web.context.request.ServletWebRequest


  private static NativeWebRequest getRequestWithSort(Sort sort, String qualifier) {

    MockHttpServletRequest request = new MockHttpServletRequest();

    if (sort == null) {
      return new ServletWebRequest(request);
    }

    for (Order order : sort) {

      String prefix = StringUtils.hasText(qualifier) ? qualifier + "_" : "";
      request.addParameter(prefix + "sort", String.format("%s,%s", order.getProperty(), order.getDirection().name()));
    }

    return new ServletWebRequest(request);
  }
View Full Code Here


    }

    public boolean matches(HttpServletRequest request) {
        List<MediaType> httpRequestMediaTypes;
        try {
            httpRequestMediaTypes = contentNegotiationStrategy.resolveMediaTypes(new ServletWebRequest(request));
        }
        catch (HttpMediaTypeNotAcceptableException e) {
            logger.debug("Failed to parse MediaTypes, returning false", e);
            return false;
        }
View Full Code Here

  @Override
  protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
      Exception exception) {
   
    ModelAndView modelAndView = null;
    ServletWebRequest webRequest = null;
    ApiError error = null;
    try {
      webRequest = new ServletWebRequest(request, response);
     
      if (exception instanceof BusinessException) {
        error = handleException((BusinessException)exception);
      } else if (exception instanceof BadRequestException) {
        error = handleException((BadRequestException)exception);
View Full Code Here

          long lastModified = ha.getLastModified(request, mappedHandler.getHandler());
          if (logger.isDebugEnabled()) {
            String requestUri = urlPathHelper.getRequestUri(request);
            logger.debug("Last-Modified value for [" + requestUri + "] is: " + lastModified);
          }
          if (new ServletWebRequest(request, response).checkNotModified(lastModified) && isGet) {
            return;
          }
        }

        // Apply preHandle methods of registered interceptors.
View Full Code Here

   * @see org.springframework.validation.DataBinder#registerCustomEditor
   * @see org.springframework.beans.propertyeditors.CustomDateEditor
   */
  protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    if (this.webBindingInitializer != null) {
      this.webBindingInitializer.initBinder(binder, new ServletWebRequest(request));
    }
  }
View Full Code Here

   * @see org.springframework.validation.DataBinder#registerCustomEditor
   * @see org.springframework.beans.propertyeditors.CustomDateEditor
   */
  protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    if (this.webBindingInitializer != null) {
      this.webBindingInitializer.initBinder(binder, new ServletWebRequest(request));
    }
    initBinder((ServletRequest) request, binder);
  }
View Full Code Here

   */
  @SuppressWarnings("serial")
  private static class WebRequestObjectFactory implements ObjectFactory<WebRequest>, Serializable {

    public WebRequest getObject() {
      return new ServletWebRequest(currentRequestAttributes().getRequest());
    }
View Full Code Here

   * @see org.springframework.validation.DataBinder#registerCustomEditor
   * @see org.springframework.beans.propertyeditors.CustomDateEditor
   */
  protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    if (this.webBindingInitializer != null) {
      this.webBindingInitializer.initBinder(binder, new ServletWebRequest(request));
    }
  }
View Full Code Here

   * Invoke the {@link RequestMapping} handler method preparing a {@link ModelAndView} if view resolution is required.
   */
  private ModelAndView invokeHandleMethod(HttpServletRequest request,
      HttpServletResponse response, HandlerMethod handlerMethod) throws Exception {

    ServletWebRequest webRequest = new ServletWebRequest(request, response);

    WebDataBinderFactory binderFactory = getDataBinderFactory(handlerMethod);
    ModelFactory modelFactory = getModelFactory(handlerMethod, binderFactory);
    ServletInvocableHandlerMethod requestMappingMethod = createRequestMappingMethod(handlerMethod, binderFactory);

View Full Code Here

        logger.debug("No media type found for " + resource + " - not sending a content-type header");
      }
    }

    // header phase
    if (new ServletWebRequest(request, response).checkNotModified(resource.lastModified())) {
      logger.debug("Resource not modified - returning 304");
      return;
    }
    setHeaders(response, resource, mediaType);
View Full Code Here

TOP

Related Classes of org.springframework.web.context.request.ServletWebRequest

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.