List of usage examples for org.springframework.web.context.request RequestContextHolder currentRequestAttributes
public static RequestAttributes currentRequestAttributes() throws IllegalStateException
From source file:org.jtwig.util.LocalThreadHolder.java
public static HttpServletRequest getServletRequest() { RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes(); if (requestAttributes instanceof ServletRequestAttributes) return ((ServletRequestAttributes) requestAttributes).getRequest(); else//from ww w . ja v a2 s . co m return null; }
From source file:org.freeeed.search.web.session.SessionContext.java
public static SolrSessionObject getSolrSession() { HttpServletRequest curRequest = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()) .getRequest();// www. ja va 2 s . c o m HttpSession session = curRequest.getSession(); SolrSessionObject solrSession = (SolrSessionObject) session .getAttribute(WebConstants.WEB_SESSION_SOLR_OBJECT); return solrSession; }
From source file:com.ebay.logstorm.server.controllers.BaseController.java
public static HttpServletRequest getCurrentRequest() { return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); }
From source file:de.uni_koeln.spinfo.maalr.webapp.i18n.UrlGenerator.java
private static HttpSession session() { ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); return attr.getRequest().getSession(false); }
From source file:com.inkubator.securitycore.util.UserInfoUtil.java
public static String getRequestRemoteAddr() { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()) .getRequest();/* w ww .j a va2s .co m*/ return request.getRemoteAddr(); }
From source file:at.ac.univie.isc.asio.spring.ContextPropagator.java
/** * Create a propagator, which stores the context of the current thread, as retrieved from * {@link RequestContextHolder#currentRequestAttributes()}. *///ww w.ja va2 s .co m public static ContextPropagator capture() { final Thread thread = Thread.currentThread(); log.debug(Scope.SYSTEM.marker(), "capturing context of {}", thread); return new ContextPropagator(RequestContextHolder.currentRequestAttributes(), thread); }
From source file:net.jforum.core.support.spring.HttpServletResponseFactoryBean.java
/** * @see org.springframework.beans.factory.FactoryBean#getObject() *//*from w ww .ja va 2 s . co m*/ public HttpServletResponse getObject() throws Exception { RequestAttributes attributes = RequestContextHolder.currentRequestAttributes(); return (HttpServletResponse) attributes.getAttribute(ConfigKeys.HTTP_SERVLET_RESPONSE, RequestAttributes.SCOPE_REQUEST); }
From source file:com.miserablemind.butter.helpers.Utilities.java
/** * Gets Active Session from {@link RequestContextHolder}. * * @return {@link HttpSession}//from w w w. jav a 2 s . com */ public static HttpSession getSession() { ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); return attr.getRequest().getSession(true); }
From source file:org.lareferencia.xoai.services.impl.context.LRContextService.java
@Override public Context getContext() throws ContextServiceException { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()) .getRequest();//from w w w .j av a2 s . c o m Object value = request.getAttribute(OAI_CONTEXT); if (value == null || !(value instanceof Context)) { try { request.setAttribute(OAI_CONTEXT, new Context()); } catch (SQLException e) { throw new ContextServiceException(e); } } return (Context) request.getAttribute(OAI_CONTEXT); }
From source file:net.jforum.core.support.spring.HttpServletRequestFactoryBean.java
/** * @see org.springframework.beans.factory.FactoryBean#getObject() *//*www.j a va 2s . c o m*/ public HttpServletRequest getObject() throws Exception { RequestAttributes attributes = RequestContextHolder.currentRequestAttributes(); return ((ServletRequestAttributes) attributes).getRequest(); }