use of org.springframework.web.context.request.ServletRequestAttributes in project BroadleafCommerce by BroadleafCommerce.
the class PropertiesVariableExpression method getForceShowIdColumns.
/**
* Returns true if the <b>listGrid.forceShowIdColumns</b> system property or a <b>showIds</b> request parameter is set
* to true. Used in the admin to show ID columns when displaying list grids.
*/
public boolean getForceShowIdColumns() {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
boolean forceShow = BLCSystemProperty.resolveBooleanSystemProperty("listGrid.forceShowIdColumns");
forceShow = forceShow || "true".equals(request.getParameter("showIds"));
return forceShow;
}
use of org.springframework.web.context.request.ServletRequestAttributes in project BroadleafCommerce by BroadleafCommerce.
the class StaleStateProtectionServiceImpl method invalidateState.
@Override
public void invalidateState(boolean notify) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
if (BLCRequestUtils.isOKtoUseSession(new ServletWebRequest(request))) {
HttpSession session = request.getSession();
session.removeAttribute(STATEVERSIONTOKEN);
if (notify) {
getStateVersionToken();
request.setAttribute(STATECHANGENOTIFICATIONTOKEN, "true");
}
}
}
use of org.springframework.web.context.request.ServletRequestAttributes in project spring-cloud by Rogge666.
the class SessionUserInfo method getSessionUser.
/**
* 获取当前会话(静态)
*/
public static <T extends SessionUser> T getSessionUser(Class<T> clazz) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getServletContext());
SessionUserInfo sessionUserInfo = (SessionUserInfo) ctx.getBean("sessionUserInfo");
return sessionUserInfo.getSessionUser(request.getSession(), clazz);
}
use of org.springframework.web.context.request.ServletRequestAttributes in project spring-cloud by Rogge666.
the class Util method getCurrentLanguage.
/**
* 获取当前会话语言(如果找不到默认返回中文)
*
* @return
*/
public static LanguageEnum getCurrentLanguage() {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
LanguageEnum language = (LanguageEnum) request.getSession().getAttribute(Constant.CURRENT_LANGUAGE);
if (language != null) {
return language;
}
} catch (Exception e) {
}
return LanguageEnum.zh_CN;
}
use of org.springframework.web.context.request.ServletRequestAttributes in project Gatekeeper by FINRAOS.
the class GatekeeperCommonConfig method userProfile.
/* Request scoped bean to create autowireable UserProfile object */
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
public IGatekeeperUserProfile userProfile() {
HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
Principal p = req.getUserPrincipal();
return (IGatekeeperUserProfile) p;
}
Aggregations