本文整理匯總了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);
}