Search in sources :

Example 1 with PwcWebModule

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;
}
Also used : Response(org.apache.catalina.connector.Response) PwcWebModule(com.sun.enterprise.web.pwc.PwcWebModule) String(java.lang.String)

Example 2 with PwcWebModule

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());
    }
}
Also used : PwcWebModule(com.sun.enterprise.web.pwc.PwcWebModule) CookieSecureType(com.sun.enterprise.web.session.WebSessionCookieConfig.CookieSecureType) WebSessionCookieConfig(com.sun.enterprise.web.session.WebSessionCookieConfig)

Example 3 with PwcWebModule

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);
}
Also used : PwcWebModule(com.sun.enterprise.web.pwc.PwcWebModule)

Example 4 with PwcWebModule

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);
}
Also used : PwcWebModule(com.sun.enterprise.web.pwc.PwcWebModule) UnsupportedEncodingException(java.io.UnsupportedEncodingException) String(java.lang.String)

Aggregations

PwcWebModule (com.sun.enterprise.web.pwc.PwcWebModule)4 String (java.lang.String)2 WebSessionCookieConfig (com.sun.enterprise.web.session.WebSessionCookieConfig)1 CookieSecureType (com.sun.enterprise.web.session.WebSessionCookieConfig.CookieSecureType)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Response (org.apache.catalina.connector.Response)1