Examples of RequestAttributes


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

     * RequestContextHolder.getRequestAttributes() instead.
     * @throws IllegalStateException if this is called outside of a
     * request.
     */
    public static GrailsWebRequest retrieveGrailsWebRequest() {
        RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
        if(attributes instanceof GrailsWebRequest) {
            return (GrailsWebRequest)attributes;
        }
        return null;
    }
View Full Code Here

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

    /**
     * Removes any GrailsWebRequest instance from the current request.
     */
    public static void clearGrailsWebRequest() {
        RequestAttributes reqAttrs = RequestContextHolder.getRequestAttributes();
        if (reqAttrs != null) {
            // First remove the web request from the HTTP request attributes.
            GrailsWebRequest webRequest = (GrailsWebRequest) reqAttrs;
            webRequest.getRequest().removeAttribute(GrailsApplicationAttributes.WEB_REQUEST);

View Full Code Here

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

        if (urlMappingInfo == null) {
            renderDefaultResponse(response, statusCode);
            return;
        }

        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        boolean restoreOriginalRequestAttributes = false;
        final GrailsWebRequest webRequest;
        if (requestAttributes instanceof GrailsWebRequest) {
            webRequest = (GrailsWebRequest) requestAttributes;
            urlMappingInfo.configure(webRequest);
View Full Code Here

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

        return builder.buildAndExpand(uriVars);
    }

    protected static CompositeUriComponentsContributor getConfiguredUriComponentsContributor() {
        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        if (requestAttributes == null) {
            logger.debug("No request bound to the current thread: is DispatcherSerlvet used?");
            return null;
        }
        HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();
View Full Code Here

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

  /**
   * Get the location of the user associated with the current request, if resolvable.
   */
  public static Location getCurrentLocation() {
    RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
    return attributes != null ? (Location) attributes.getAttribute(UserLocationHandlerInterceptor.USER_LOCATION_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST) : null;
  }
View Full Code Here

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

    return this.tabletSuffix;
  }

  @Override
  protected String getDeviceViewNameInternal(String viewName) {
    RequestAttributes attrs = RequestContextHolder.getRequestAttributes();
    Assert.isInstanceOf(ServletRequestAttributes.class, attrs);
    HttpServletRequest request = ((ServletRequestAttributes) attrs).getRequest();
    Device device = DeviceUtils.getCurrentDevice(request);
    SitePreference sitePreference = SitePreferenceUtils.getCurrentSitePreference(request);
    String resolvedViewName = viewName;
View Full Code Here

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

        this.soap12 = new SaajSoapMessageFactory();
        this.soapProtocolChooser = new SimpleSoapProtocolChooser();
    }

    private void setMessageFactoryForRequestContext(SaajSoapMessageFactory factory) {
        RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
        attributes.setAttribute(REQUEST_CONTEXT_ATTRIBUTE, factory, RequestAttributes.SCOPE_REQUEST);
    }
View Full Code Here

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

        RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
        attributes.setAttribute(REQUEST_CONTEXT_ATTRIBUTE, factory, RequestAttributes.SCOPE_REQUEST);
    }

    private SaajSoapMessageFactory getMessageFactoryForRequestContext() {
        RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
        return (SaajSoapMessageFactory) attributes.getAttribute(REQUEST_CONTEXT_ATTRIBUTE,
                RequestAttributes.SCOPE_REQUEST);
    }
View Full Code Here

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

     *
     * @return native {@link HttpServletRequest}
     */
    @VisibleForTesting
    protected HttpServletRequest getServletRequest() {
        RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
        return ((ServletRequestAttributes) attributes).getRequest();
    }
View Full Code Here

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

    /**
     * @return native {@link HttpServletRequest}
     */
    private HttpServletRequest getServletRequest() {
        RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
        return ((ServletRequestAttributes) attributes).getRequest();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.