/** * Bind the servlet request and context to the current thread (to use Sping-scoped beans). * @param request * @param context * @return the request attributes (that should be released by unbindRequest()). */ public static ServletRequestAttributes bindRequestAndContext( final HttpServletRequest request, final ServletContext context) { LocaleContextHolder.setLocale(request.getLocale()); ServletRequestAttributes requestAttributes = new ServletRequestAttributes(request); RequestContextHolder.setRequestAttributes(requestAttributes); BeanUtilsWeb.initBeanFactory(context); return requestAttributes; }
/** * Bind the portlet request and context to the current thread (to use Sping-scoped beans). * @param request * @param context * @return the request attributes (that should be released by unbindRequest()). */ public static PortletRequestAttributes bindRequestAndContext( final PortletRequest request, final PortletContext context) { LocaleContextHolder.setLocale(request.getLocale()); PortletRequestAttributes requestAttributes = new PortletRequestAttributes(request); RequestContextHolder.setRequestAttributes(requestAttributes); BeanUtilsWeb.initBeanFactory(context); return requestAttributes; }
previousRequestAttributes = ContextUtils.bindRequestAndContext( request, getServletContext()); BeanUtilsWeb.initBeanFactory(getServletContext()); String contentType = (String) DownloadUtils.getDownloadAttribute( CONTENT_TYPE_ATTRIBUTE + id);
throws ServletException, IOException { try { BeanUtilsWeb.initBeanFactory(getServletContext());