本文整理了Java中org.apache.catalina.connector.Request.configureSessionCookie
方法的一些代码示例,展示了Request.configureSessionCookie
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.configureSessionCookie
方法的具体详情如下:
包路径:org.apache.catalina.connector.Request
类名称:Request
方法名:configureSessionCookie
[英]Configures the given JSESSIONID cookie.
[中]配置给定的JSESSIONID cookie。
代码示例来源:origin: org.glassfish.web/web-glue
public void configureSessionCookie(Cookie cookie) {
super.configureSessionCookie(cookie);
PwcWebModule wm = (PwcWebModule) getContext();
WebSessionCookieConfig cookieConfig = (WebSessionCookieConfig)wm.getSessionCookieConfig();
CookieSecureType type = cookieConfig.getSecure();
if (CookieSecureType.TRUE == type) {
cookie.setSecure(true);
} else if (CookieSecureType.FALSE == type) {
cookie.setSecure(false);
} else {
cookie.setSecure(isSecure());
}
}
代码示例来源:origin: org.jboss.web/jbossweb
/**
* Change the ID of the session that this request is associated with. There
* are several things that may trigger an ID change. These include mmoving
* between nodes in a cluster and session fixation prevention during the
* authentication process.
*
* @param session The session to change the session ID for
*/
public void changeSessionId(String newSessionId) {
// This should only ever be called if there was an old session ID but
// double check to be sure
if (requestedSessionId != null && requestedSessionId.length() > 0) {
requestedSessionId = newSessionId;
}
if (context != null && !context.getServletContext()
.getEffectiveSessionTrackingModes().contains(
SessionTrackingMode.COOKIE))
return;
if (response != null) {
Cookie cookie = new Cookie(context.getSessionCookie().getName(), newSessionId);
configureSessionCookie(cookie);
response.addCookieInternal(cookie);
}
}
代码示例来源:origin: org.glassfish.main.web/web-core
private void addPersistedSessionCookie(Request request, StandardContext ctx,
Session sess) throws IOException {
if (sess == null) {
return;
}
Cookie cookie = ctx.getManager().toCookie(sess);
if (cookie != null) {
request.configureSessionCookie(cookie);
grizzlyResponse.addHeader(SET_COOKIE_HEADER,
response.getCookieString(cookie));
}
}
代码示例来源:origin: jboss.web/jbossweb
/**
* Change the ID of the session that this request is associated with. There
* are several things that may trigger an ID change. These include mmoving
* between nodes in a cluster and session fixation prevention during the
* authentication process.
*
* @param session The session to change the session ID for
*/
public void changeSessionId(String newSessionId) {
// This should only ever be called if there was an old session ID but
// double check to be sure
if (requestedSessionId != null && requestedSessionId.length() > 0) {
requestedSessionId = newSessionId;
}
if (context != null && !context.getServletContext()
.getEffectiveSessionTrackingModes().contains(
SessionTrackingMode.COOKIE))
return;
if (response != null) {
String cookieName = context.getSessionCookie().getName();
if (cookieName == null) {
cookieName = Globals.SESSION_COOKIE_NAME;
}
Cookie cookie = new Cookie(cookieName, newSessionId);
configureSessionCookie(cookie);
response.addCookieInternal(cookie);
}
}
代码示例来源:origin: org.glassfish.main.web/web-core
/**
* Adds a session version cookie to the response if necessary.
*/
private void addSessionVersionCookie(Request request,
StandardContext context) {
Map<String, String> sessionVersions =
request.getSessionVersionsRequestAttribute();
if (sessionVersions != null) {
Cookie cookie = new Cookie(
Globals.SESSION_VERSION_COOKIE_NAME,
RequestUtil.createSessionVersionString(sessionVersions));
request.configureSessionCookie(cookie);
if (request.isRequestedSessionIdFromCookie()) {
/*
* Have the JSESSIONIDVERSION cookie inherit the
* security setting of the JSESSIONID cookie to avoid
* session loss when switching from HTTPS to HTTP,
* see IT 7414
*/
cookie.setSecure(
request.isRequestedSessionIdFromSecureCookie());
}
grizzlyResponse.addHeader(SET_COOKIE_HEADER,
response.getCookieString(cookie));
}
}
代码示例来源:origin: org.glassfish.main.web/web-core
/**
* Adds JSESSIONID cookie whose value includes jvmRoute if necessary.
*/
private void addSessionCookieWithJReplica(Request request, StandardContext ctx,
Session sess) {
String replicaLocation = null;
if (sess != null) {
replicaLocation = (String)sess.getNote(Globals.JREPLICA_SESSION_NOTE);
sess.removeNote(Globals.JREPLICA_SESSION_NOTE);
}
if (replicaLocation != null) {
Cookie cookie = getSafeCookie(Globals.JREPLICA_COOKIE_NAME, replicaLocation);
request.configureSessionCookie(cookie);
if (request.isRequestedSessionIdFromCookie()) {
cookie.setSecure(
request.isRequestedSessionIdFromSecureCookie());
}
grizzlyResponse.addHeader(SET_COOKIE_HEADER,
response.getCookieString(cookie));
}
}
代码示例来源:origin: org.glassfish.main.web/web-core
private void addJrouteCookie(Request request, StandardContext ctx,
Session sess) {
String jrouteId = request.getHeader(Constants.PROXY_JROUTE);
if (jrouteId == null) {
// Load-balancer plugin is not front-ending this instance
return;
}
if (sess == null) {
// No session exists
return;
}
if (request.getJrouteId() == null
|| !request.getJrouteId().equals(jrouteId)) {
// Initial request or failover
Cookie cookie = getSafeCookie(Constants.JROUTE_COOKIE, jrouteId);
request.configureSessionCookie(cookie);
if (request.isRequestedSessionIdFromCookie()) {
/*
* Have the JSESSIONIDVERSION cookie inherit the
* security setting of the JSESSIONID cookie to avoid
* session loss when switching from HTTPS to HTTP,
* see IT 7414
*/
cookie.setSecure(
request.isRequestedSessionIdFromSecureCookie());
}
grizzlyResponse.addHeader(SET_COOKIE_HEADER,
response.getCookieString(cookie));
}
}
代码示例来源:origin: org.glassfish.main.web/web-core
private void addSessionCookie() {
if (context != null && context.getCookies() && response != null) {
String jvmRoute = ((StandardContext) getContext()).getJvmRoute();
/*
* Check if context has been configured with jvmRoute for
* Apache LB. If it has, do not add the JSESSIONID cookie
* here, but rely on OutputBuffer#addSessionCookieWithJvmRoute
* to add the jvmRoute enhanced JSESSIONID as a cookie right
* before the response is flushed.
*/
if (jvmRoute == null) {
Cookie newCookie = new Cookie(
getSafeHeaderValue(getContext().getSessionCookieName()), getSafeHeaderValue(session.getId()));
configureSessionCookie(newCookie);
((HttpResponse)response).addSessionCookieInternal(newCookie);
}
}
}
代码示例来源:origin: org.glassfish.main.web/web-core
/**
* Adds JSESSIONID cookie whose value includes jvmRoute if necessary.
*/
private void addSessionCookieWithJvmRoute(Request request, StandardContext ctx,
Session sess) {
if (ctx.getJvmRoute() == null || sess == null) {
return;
}
// Create JSESSIONID cookie that includes jvmRoute
Cookie cookie = getSafeCookie(ctx.getSessionCookieName(),
sess.getIdInternal() + "." + ctx.getJvmRoute());
request.configureSessionCookie(cookie);
grizzlyResponse.addHeader(SET_COOKIE_HEADER,
response.getCookieString(cookie));
}
代码示例来源:origin: tomcat/catalina
Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
session.getIdInternal());
configureSessionCookie(cookie);
response.addCookie(cookie);
代码示例来源:origin: org.osivia.portal.core/osivia-portal-jbossas-jbossweb-lib
/* 2320 */ configureSessionCookie(cookie);
/* 2321 */ this.response.addCookieInternal(cookie);
代码示例来源:origin: jboss.web/jbossweb
configureSessionCookie(cookie);
response.addCookieInternal(cookie);
代码示例来源:origin: org.jboss.web/jbossweb
&& !(isRequestedSessionIdFromCookie() && (session.getIdInternal().equals(getRequestedSessionId()))) ) {
Cookie cookie = new Cookie(context.getSessionCookie().getName(), session.getIdInternal());
configureSessionCookie(cookie);
response.addCookieInternal(cookie);
内容来源于网络,如有侵权,请联系作者删除!