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); } }
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); } }
/** * @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; }
/** * @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; }
new PrivilegedDoIsEncodable(getContext(), hreq, session, location)); return result.booleanValue(); } else { return doIsEncodeable(getContext(), hreq, session, location);
/** * 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()); }
/** * 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()); }
/** * 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); } }
/** * 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); } }
/* */ 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); /* */ } /* */
/** * 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); } }
/** * 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
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
setStatus(status); setHeader("Location", absolute); if (getContext().getSendRedirectBody()) { PrintWriter writer = getWriter(); writer.print(sm.getString("coyoteResponse.sendRedirect.note",
Context context = getContext(); if (context != null) { String charset = context.getCharset(locale);
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); } }