Package org.springframework.context.i18n

Examples of org.springframework.context.i18n.LocaleContext


      throws ServletException, IOException {

    long startTime = System.currentTimeMillis();
    Throwable failureCause = null;

    LocaleContext previousLocaleContext = LocaleContextHolder.getLocaleContext();
    LocaleContext localeContext = buildLocaleContext(request);

    RequestAttributes previousAttributes = RequestContextHolder.getRequestAttributes();
    ServletRequestAttributes requestAttributes = null;
    if (previousAttributes == null || (previousAttributes instanceof ServletRequestAttributes)) {
      requestAttributes = new ServletRequestAttributes(request);
View Full Code Here


    long startTime = System.currentTimeMillis();
    Throwable failureCause = null;

    // Expose current LocaleResolver and request as LocaleContext.
    LocaleContext previousLocaleContext = LocaleContextHolder.getLocaleContext();
    LocaleContextHolder.setLocaleContext(buildLocaleContext(request), this.threadContextInheritable);

    // Expose current RequestAttributes to current thread.
    RequestAttributes previousRequestAttributes = RequestContextHolder.getRequestAttributes();
    ServletRequestAttributes requestAttributes = null;
View Full Code Here

    long startTime = System.currentTimeMillis();
    Throwable failureCause = null;

    // Expose current LocaleResolver and request as LocaleContext.
    LocaleContext previousLocaleContext = LocaleContextHolder.getLocaleContext();
    LocaleContextHolder.setLocaleContext(buildLocaleContext(request), this.threadContextInheritable);

    // Expose current RequestAttributes to current thread.
    RequestAttributes previousRequestAttributes = RequestContextHolder.getRequestAttributes();
    PortletRequestAttributes requestAttributes = null;
View Full Code Here

    HttpServletRequest processedRequest = request;
    HandlerExecutionChain mappedHandler = null;
    int interceptorIndex = -1;

    // Expose current LocaleResolver and request as LocaleContext.
    LocaleContext previousLocaleContext = LocaleContextHolder.getLocaleContext();
    LocaleContextHolder.setLocaleContext(buildLocaleContext(request), this.threadContextInheritable);

    // Expose current RequestAttributes to current thread.
    RequestAttributes previousRequestAttributes = RequestContextHolder.getRequestAttributes();
    ServletRequestAttributes requestAttributes = new ServletRequestAttributes(request);
View Full Code Here

   * to obtain the current locale, which might change during a request.
   * @param request current HTTP request
   * @return the corresponding LocaleContext
   */
  protected LocaleContext buildLocaleContext(final HttpServletRequest request) {
    return new LocaleContext() {
      public Locale getLocale() {
        return localeResolver.resolveLocale(request);
      }
    };
  }
View Full Code Here

    if (logger.isDebugEnabled()) {
      logger.debug("DispatcherPortlet with name '" + getPortletName() + "' received action request");
    }

    // Expose current LocaleResolver and request as LocaleContext.
    LocaleContext previousLocaleContext = LocaleContextHolder.getLocaleContext();
    LocaleContextHolder.setLocaleContext(buildLocaleContext(request), this.threadContextInheritable);

    // Expose current RequestAttributes to current thread.
    RequestAttributes previousRequestAttributes = RequestContextHolder.getRequestAttributes();
    PortletRequestAttributes requestAttributes = new PortletRequestAttributes(request);
View Full Code Here

    if (logger.isDebugEnabled()) {
      logger.debug("DispatcherPortlet with name '" + getPortletName() + "' received render request");
    }

    // Expose current LocaleResolver and request as LocaleContext.
    LocaleContext previousLocaleContext = LocaleContextHolder.getLocaleContext();
    LocaleContextHolder.setLocaleContext(buildLocaleContext(request), this.threadContextInheritable);

    // Expose current RequestAttributes to current thread.
    RequestAttributes previousRequestAttributes = RequestContextHolder.getRequestAttributes();
    PortletRequestAttributes requestAttributes = new PortletRequestAttributes(request);
View Full Code Here

  protected void prepareConnection(HttpURLConnection con, int contentLength) throws IOException {
    con.setDoOutput(true);
    con.setRequestMethod(HTTP_METHOD_POST);
    con.setRequestProperty(HTTP_HEADER_CONTENT_TYPE, getContentType());
    con.setRequestProperty(HTTP_HEADER_CONTENT_LENGTH, Integer.toString(contentLength));
    LocaleContext locale = LocaleContextHolder.getLocaleContext();
    if (locale != null) {
      con.setRequestProperty(HTTP_HEADER_ACCEPT_LANGUAGE, StringUtils.toLanguageTag(locale.getLocale()));
    }
    if (isAcceptGzipEncoding()) {
      con.setRequestProperty(HTTP_HEADER_ACCEPT_ENCODING, ENCODING_GZIP);
    }
  }
View Full Code Here

    // see RequestContextListener.requestInitialized()
    try {
      LocaleContextHolder.setLocale(httpRequest.getLocale());
      RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpRequest));

      LocaleContext servletLocaleContext = LocaleContextHolder.getLocaleContext();
      RequestAttributes servletRequestAttrs = RequestContextHolder.getRequestAttributes();

      MockActionRequest request = new MockActionRequest();
      MockActionResponse response = new MockActionResponse();
      request.setParameter("action", "form");
View Full Code Here

    // see RequestContextListener.requestInitialized()
    try {
      LocaleContextHolder.setLocale(httpRequest.getLocale());
      RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpRequest));

      LocaleContext servletLocaleContext = LocaleContextHolder.getLocaleContext();
      RequestAttributes servletRequestAttrs = RequestContextHolder.getRequestAttributes();

      MockRenderRequest request = new MockRenderRequest();
      MockRenderResponse response = new MockRenderResponse();
      request.setParameter("action", "form");
View Full Code Here

TOP

Related Classes of org.springframework.context.i18n.LocaleContext

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.