本文整理汇总了Java中org.apache.shiro.web.util.WebUtils.getRequest方法的典型用法代码示例。如果您正苦于以下问题:Java WebUtils.getRequest方法的具体用法?Java WebUtils.getRequest怎么用?Java WebUtils.getRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.shiro.web.util.WebUtils
的用法示例。
在下文中一共展示了WebUtils.getRequest方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHost
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
private String getHost(SessionContext context) {
String host = context.getHost();
if (host == null) {
ServletRequest request = WebUtils.getRequest(context);
if (request != null) {
host = request.getRemoteHost();
}
}
return host;
}
示例2: createExposedSession
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
protected Session createExposedSession(Session session, SessionContext context) {
if (!WebUtils.isWeb(context)) {
return super.createExposedSession(session, context);
}
ServletRequest request = WebUtils.getRequest(context);
ServletResponse response = WebUtils.getResponse(context);
SessionKey key = new WebSessionKey(session.getId(), request, response);
return new DelegatingSession(this, key);
}
示例3: getSessionId
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
@Override
public Serializable getSessionId(SessionKey key) {
Serializable id = super.getSessionId(key);
if (id == null && WebUtils.isWeb(key)) {
ServletRequest request = WebUtils.getRequest(key);
ServletResponse response = WebUtils.getResponse(key);
id = getSessionId(request, response);
}
return id;
}
示例4: onInvalidation
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
private void onInvalidation(SessionKey key) {
ServletRequest request = WebUtils.getRequest(key);
if (request != null) {
request.removeAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_IS_VALID);
}
if (WebUtils.isHttp(key)) {
log.debug("Referenced session was invalid. Removing session ID cookie.");
removeSessionIdCookie(WebUtils.getHttpRequest(key), WebUtils.getHttpResponse(key));
} else {
log.debug("SessionKey argument is not HTTP compatible or does not have an HTTP request/response " +
"pair. Session ID cookie will not be removed due to invalidated session.");
}
}
示例5: getSessionKey
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
@Override
protected SessionKey getSessionKey(SubjectContext context) {
if (WebUtils.isWeb(context)) {
Serializable sessionId = context.getSessionId();
ServletRequest request = WebUtils.getRequest(context);
ServletResponse response = WebUtils.getResponse(context);
return new WebSessionKey(sessionId, request, response);
} else {
return super.getSessionKey(context);
}
}
示例6: createExposedSession
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
protected Session createExposedSession(Session session, SessionContext context) {
if (!WebUtils.isWeb(context)) {
return super.createExposedSession(session, context);
}
ServletRequest request = WebUtils.getRequest(context);
ServletResponse response = WebUtils.getResponse(context);
SessionKey key = new WebSessionKey(session.getId(), request, response);
return new DelegatingSession(this, key);
}
示例7: getSessionId
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
@Override
public Serializable getSessionId(SessionKey key) {
Serializable id = super.getSessionId(key);
if (id == null && WebUtils.isWeb(key)) {
ServletRequest request = WebUtils.getRequest(key);
ServletResponse response = WebUtils.getResponse(key);
id = getSessionId(request, response);
}
return id;
}
示例8: onInvalidation
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
private void onInvalidation(SessionKey key) {
ServletRequest request = WebUtils.getRequest(key);
if (request != null) {
request.removeAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_IS_VALID);
}
if (WebUtils.isHttp(key)) {
log.debug("Referenced session was invalid. Removing session ID cookie.");
removeSessionIdCookie(WebUtils.getHttpRequest(key), WebUtils.getHttpResponse(key));
} else {
log.debug("SessionKey argument is not HTTP compatible or does not have an HTTP request/response "
+ "pair. Session ID cookie will not be removed due to invalidated session.");
}
}
示例9: getSessionKey
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
@Override
protected SessionKey getSessionKey(SubjectContext context) {
if (WebUtils.isWeb(context)) {
Serializable sessionId = context.getSessionId();
ServletRequest request = WebUtils.getRequest(context);
ServletResponse response = WebUtils.getResponse(context);
return new WebSessionKey(sessionId, request, response);
} else {
return super.getSessionKey(context);
}
}
示例10: getHost
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
private String getHost( SessionContext context ) {
String host = context.getHost();
if ( host == null ) {
ServletRequest request = WebUtils.getRequest( context );
if ( request != null ) {
host = request.getRemoteHost();
}
}
return host;
}
示例11: onStart
import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
/**
* 去掉URL后面的jsessionid
*/
protected void onStart(Session session, SessionContext context) {
super.onStart(session, context);
ServletRequest request = WebUtils.getRequest(context);
request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_SOURCE,ShiroHttpServletRequest.COOKIE_SESSION_ID_SOURCE);
}