use of com.sun.enterprise.web.pwc.PwcWebModule in project Payara by payara.
the class PwcCoyoteRequest method setContext.
// END SJSAS 6346738
@Override
public void setContext(Context ctx) {
if (ctx == null) {
// the StandardEngineValve
return;
}
super.setContext(ctx);
Response response = (Response) getResponse();
// Assert response!=null
if ((response != null) && (ctx instanceof PwcWebModule)) {
String[] cacheControls = ((PwcWebModule) ctx).getCacheControls();
for (int i = 0; cacheControls != null && i < cacheControls.length; i++) {
response.addHeader("Cache-Control", cacheControls[i]);
}
}
sunWebXmlChecked = false;
}
use of com.sun.enterprise.web.pwc.PwcWebModule in project Payara by payara.
the class PwcCoyoteRequest method configureSessionCookie.
/*
* Configures the given JSESSIONID cookie with the cookie-properties from
* sun-web.xml.
*
* @param cookie The JSESSIONID cookie to be configured
*/
@Override
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());
}
}
use of com.sun.enterprise.web.pwc.PwcWebModule in project Payara by payara.
the class PwcCoyoteRequest method makeCookie.
// END SJSAS 6346738
// START GlassFish 898
@Override
protected Cookie makeCookie(org.glassfish.grizzly.http.Cookie scookie) {
PwcWebModule wm = (PwcWebModule) getContext();
boolean encodeCookies = false;
if (wm != null && wm.getEncodeCookies()) {
encodeCookies = true;
}
return makeCookie(scookie, encodeCookies);
}
use of com.sun.enterprise.web.pwc.PwcWebModule in project Payara by payara.
the class PwcCoyoteRequest method setRequestEncodingFromSunWebXml.
// END SJSAS 6346738
/**
* Determines and sets the request charset using the locale-charset-info,
* locale-charset-map, and parameter-encoding elements provided in the
* sun-web.xml.
*
* @return true if a request encoding has been determined and set,
* false otherwise
*/
private boolean setRequestEncodingFromSunWebXml() {
if (sunWebXmlChecked) {
return false;
}
sunWebXmlChecked = true;
PwcWebModule wm = (PwcWebModule) getContext();
String encoding = getFormHintFieldEncoding(wm);
if (encoding == null) {
encoding = wm.getDefaultCharset();
if (encoding == null && wm.hasLocaleToCharsetMapping()) {
encoding = wm.mapLocalesToCharset(getLocales());
}
}
if (encoding != null) {
try {
setCharacterEncoding(encoding);
} catch (UnsupportedEncodingException uee) {
String msg = MessageFormat.format(rb.getString(LogFacade.UNABLE_TO_SET_ENCODING), encoding, wm.getID());
logger.log(Level.WARNING, msg, uee);
}
}
return (encoding != null);
}
Aggregations