本文整理了Java中org.apache.catalina.connector.Response.getContext
方法的一些代码示例,展示了Response.getContext
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getContext
方法的具体详情如下:
包路径:org.apache.catalina.connector.Response
类名称:Response
方法名:getContext
[英]Return the Context within which this Request is being processed.
[中]返回处理此请求的上下文。
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
public String generateCookieString(final Cookie cookie) {
// Web application code can receive a IllegalArgumentException
// from the generateHeader() invocation
if (SecurityUtil.isPackageProtectionEnabled()) {
return AccessController.doPrivileged(
new PrivilegedGenerateCookieString(getContext(), cookie));
} else {
return getContext().getCookieProcessor().generateHeader(cookie);
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
public String generateCookieString(final Cookie cookie) {
// Web application code can receive a IllegalArgumentException
// from the generateHeader() invocation
if (SecurityUtil.isPackageProtectionEnabled()) {
return AccessController.doPrivileged(
new PrivilegedGenerateCookieString(getContext(), cookie));
} else {
return getContext().getCookieProcessor().generateHeader(cookie);
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* @return the character encoding used for this Response.
*/
@Override
public String getCharacterEncoding() {
String charset = getCoyoteResponse().getCharacterEncoding();
if (charset != null) {
return charset;
}
Context context = getContext();
String result = null;
if (context != null) {
result = context.getResponseCharacterEncoding();
}
if (result == null) {
result = org.apache.coyote.Constants.DEFAULT_BODY_CHARSET.name();
}
return result;
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
/**
* @return the character encoding used for this Response.
*/
@Override
public String getCharacterEncoding() {
String charset = getCoyoteResponse().getCharacterEncoding();
if (charset != null) {
return charset;
}
Context context = getContext();
String result = null;
if (context != null) {
result = context.getResponseCharacterEncoding();
}
if (result == null) {
result = org.apache.coyote.Constants.DEFAULT_BODY_CHARSET.name();
}
return result;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
new PrivilegedDoIsEncodable(getContext(), hreq, session, location));
return result.booleanValue();
} else {
return doIsEncodeable(getContext(), hreq, session, location);
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Add the specified Cookie to those that will be included with
* this Response.
*
* @param cookie Cookie to be added
*/
@Override
public void addCookie(final Cookie cookie) {
// Ignore any call from an included servlet
if (included || isCommitted()) {
return;
}
cookies.add(cookie);
String header = generateCookieString(cookie);
//if we reached here, no exception, cookie is valid
// the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
// RFC2965 is not supported by browsers and the Servlet spec
// asks for 2109.
addHeader("Set-Cookie", header, getContext().getCookieProcessor().getCharset());
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
/**
* Add the specified Cookie to those that will be included with
* this Response.
*
* @param cookie Cookie to be added
*/
@Override
public void addCookie(final Cookie cookie) {
// Ignore any call from an included servlet
if (included || isCommitted()) {
return;
}
cookies.add(cookie);
String header = generateCookieString(cookie);
//if we reached here, no exception, cookie is valid
// the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
// RFC2965 is not supported by browsers and the Servlet spec
// asks for 2109.
addHeader("Set-Cookie", header, getContext().getCookieProcessor().getCharset());
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
/**
* Set the Locale that is appropriate for this response, including
* setting the appropriate character encoding.
*
* @param locale The new locale
*/
@Override
public void setLocale(Locale locale) {
if (isCommitted()) {
return;
}
// Ignore any call from an included servlet
if (included) {
return;
}
coyoteResponse.setLocale(locale);
// Ignore any call made after the getWriter has been invoked.
// The default should be used
if (usingWriter) {
return;
}
if (isCharacterEncodingSet) {
return;
}
String charset = getContext().getCharset(locale);
if (charset != null) {
coyoteResponse.setCharacterEncoding(charset);
}
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Set the Locale that is appropriate for this response, including
* setting the appropriate character encoding.
*
* @param locale The new locale
*/
@Override
public void setLocale(Locale locale) {
if (isCommitted()) {
return;
}
// Ignore any call from an included servlet
if (included) {
return;
}
coyoteResponse.setLocale(locale);
// Ignore any call made after the getWriter has been invoked.
// The default should be used
if (usingWriter) {
return;
}
if (isCharacterEncodingSet) {
return;
}
String charset = getContext().getCharset(locale);
if (charset != null) {
coyoteResponse.setCharacterEncoding(charset);
}
}
代码示例来源:origin: org.osivia.portal.core/osivia-portal-jbossas-jbossweb-lib
/* */ public void setLocale(Locale locale)
/* */ {
/* 801 */ if (isCommitted()) {
/* 802 */ return;
/* */ }
/* */
/* 805 */ if (this.included) {
/* 806 */ return;
/* */ }
/* 808 */ this.coyoteResponse.setLocale(locale);
/* */
/* 812 */ if (this.usingWriter) {
/* 813 */ return;
/* */ }
/* 815 */ if (this.isCharacterEncodingSet) {
/* 816 */ return;
/* */ }
/* */
/* 819 */ CharsetMapper cm = getContext().getCharsetMapper();
/* 820 */ String charset = cm.getCharset(locale);
/* 821 */ if (charset != null)
/* 822 */ this.coyoteResponse.setCharacterEncoding(charset);
/* */ }
/* */
代码示例来源:origin: org.glassfish.main.web/web-core
/**
* Set the Locale that is appropriate for this response, including
* setting the appropriate character encoding.
*
* @param locale The new locale
*/
public void setLocale(Locale locale) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
coyoteResponse.setLocale(locale);
// Ignore any call made after the getWriter has been invoked.
// The default should be used
if (usingWriter)
return;
if (isCharacterEncodingSet) {
return;
}
CharsetMapper cm = getContext().getCharsetMapper();
String charset = cm.getCharset( locale );
if ( charset != null ){
coyoteResponse.setCharacterEncoding(charset);
}
}
代码示例来源:origin: org.glassfish.main.web/web-core
/**
* Removes any Set-Cookie response headers whose value contains the
* string JSESSIONID
*/
public void removeSessionCookies() {
String matchExpression = "^" + getContext().getSessionCookieName() + "=.*";
coyoteResponse.getResponse().getHeaders().removeHeaderMatches("Set-Cookie", matchExpression);
matchExpression = "^" +
org.apache.catalina.authenticator.Constants.SINGLE_SIGN_ON_COOKIE + "=.*";
coyoteResponse.getResponse().getHeaders().removeHeaderMatches("Set-Cookie", matchExpression);
}
// END GlassFish 896
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
/**
* Set the Locale that is appropriate for this response, including
* setting the appropriate character encoding.
*
* @param locale The new locale
*/
@Override
public void setLocale(Locale locale) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
coyoteResponse.setLocale(locale);
// Ignore any call made after the getWriter has been invoked.
// The default should be used
if (usingWriter)
return;
if (isCharacterEncodingSet) {
return;
}
CharsetMapper cm = getContext().getCharsetMapper();
String charset = cm.getCharset( locale );
if ( charset != null ){
coyoteResponse.setCharacterEncoding(charset);
}
}
代码示例来源:origin: tomcat/catalina
/**
* Set the Locale that is appropriate for this response, including
* setting the appropriate character encoding.
*
* @param locale The new locale
*/
public void setLocale(Locale locale) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
coyoteResponse.setLocale(locale);
// Ignore any call made after the getWriter has been invoked.
// The default should be used
if (usingWriter)
return;
if (isCharacterEncodingSet) {
return;
}
CharsetMapper cm = getContext().getCharsetMapper();
String charset = cm.getCharset( locale );
if ( charset != null ){
coyoteResponse.setCharacterEncoding(charset);
}
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
/**
* Set the Locale that is appropriate for this response, including
* setting the appropriate character encoding.
*
* @param locale The new locale
*/
@Override
public void setLocale(Locale locale) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
coyoteResponse.setLocale(locale);
// Ignore any call made after the getWriter has been invoked.
// The default should be used
if (usingWriter)
return;
if (isCharacterEncodingSet) {
return;
}
CharsetMapper cm = getContext().getCharsetMapper();
String charset = cm.getCharset( locale );
if ( charset != null ){
coyoteResponse.setCharacterEncoding(charset);
}
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
/**
* Set the Locale that is appropriate for this response, including
* setting the appropriate character encoding.
*
* @param locale The new locale
*/
@Override
public void setLocale(Locale locale) {
if (isCommitted())
return;
// Ignore any call from an included servlet
if (included)
return;
coyoteResponse.setLocale(locale);
// Ignore any call made after the getWriter has been invoked.
// The default should be used
if (usingWriter)
return;
if (isCharacterEncodingSet) {
return;
}
CharsetMapper cm = getContext().getCharsetMapper();
String charset = cm.getCharset( locale );
if ( charset != null ){
coyoteResponse.setCharacterEncoding(charset);
}
}
代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina
/**
* Set the Locale that is appropriate for this response, including
* setting the appropriate character encoding.
*
* @param locale The new locale
*/
@Override
public void setLocale(Locale locale) {
if (isCommitted()) {
return;
}
// Ignore any call from an included servlet
if (included) {
return;
}
coyoteResponse.setLocale(locale);
// Ignore any call made after the getWriter has been invoked.
// The default should be used
if (usingWriter) {
return;
}
if (isCharacterEncodingSet) {
return;
}
CharsetMapper cm = getContext().getCharsetMapper();
String charset = cm.getCharset( locale );
if ( charset != null ){
coyoteResponse.setCharacterEncoding(charset);
}
}
代码示例来源:origin: codefollower/Tomcat-Research
setStatus(status);
setHeader("Location", absolute);
if (getContext().getSendRedirectBody()) {
PrintWriter writer = getWriter();
writer.print(sm.getString("coyoteResponse.sendRedirect.note",
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
Context context = getContext();
if (context != null) {
String charset = context.getCharset(locale);
代码示例来源:origin: org.glassfish.main.web/web-core
private void addSessionCookies() throws IOException {
Request req = (Request) response.getRequest();
if (req.isRequestedSessionIdFromURL()) {
return;
}
StandardContext ctx = (StandardContext) response.getContext();
if (ctx == null || !ctx.getCookies()) {
// cookies disabled
return;
}
Session sess = req.getSessionInternal(false);
if (sess != null) {
addSessionVersionCookie(req, ctx);
addSessionCookieWithJvmRoute(req, ctx, sess);
addSessionCookieWithJReplica(req, ctx, sess);
addPersistedSessionCookie(req, ctx, sess);
addJrouteCookie(req, ctx, sess);
addSsoVersionCookie(req, ctx);
}
}
内容来源于网络,如有侵权,请联系作者删除!