Example usage for org.apache.commons.httpclient Cookie getSecure

List of usage examples for org.apache.commons.httpclient Cookie getSecure

Introduction

In this page you can find the example usage for org.apache.commons.httpclient Cookie getSecure.

Prototype

public boolean getSecure() 

Source Link

Usage

From source file:uk.gov.devonline.www.xforms.XFormsFilter.java

/**
 * stores cookies that may exist in request and passes them on to processor for usage in
 * HTTPConnectors. Instance loading and submission then uses these cookies. Important for
 * applications using auth./*from   ww w .  ja v a 2 s  .  c o m*/
 *
 * @param request the servlet request
 * @param adapter the WebAdapter instance
 */
protected void storeCookies(HttpServletRequest request, WebAdapter adapter) {
    javax.servlet.http.Cookie[] cookiesIn = request.getCookies();
    if (cookiesIn != null) {
        Cookie[] commonsCookies = new Cookie[cookiesIn.length];
        for (int i = 0; i < cookiesIn.length; i += 1) {
            javax.servlet.http.Cookie c = cookiesIn[i];

            String domain = c.getDomain();
            if (domain == null) {
                domain = "";
            }
            String path = c.getPath();
            if (path == null) {
                path = "/";
            }

            commonsCookies[i] = new Cookie(domain, c.getName(), c.getValue(), path, c.getMaxAge(),
                    c.getSecure());
        }
        adapter.setContextParam(AbstractHTTPConnector.REQUEST_COOKIE, commonsCookies);
    }
}