Example usage for javax.servlet.http Cookie Cookie

List of usage examples for javax.servlet.http Cookie Cookie

Introduction

In this page you can find the example usage for javax.servlet.http Cookie Cookie.

Prototype

public Cookie(String name, String value) 

Source Link

Document

Constructs a cookie with the specified name and value.

Usage

From source file:io.mapzone.controller.vm.http.HttpResponseForwarder.java

/**
 * Copy cookie from the proxy to the servlet client. Replaces cookie path to
 * local path and renames cookie to avoid collisions.
 *///from w w w.j  a  va2s  .  c  om
protected void copyProxyCookie(HttpServletRequest servletRequest, HttpServletResponse servletResponse,
        Header header) {
    List<HttpCookie> cookies = HttpCookie.parse(header.getValue());
    String path = servletRequest.getContextPath(); // path starts with / or is empty string
    path += servletRequest.getServletPath(); // servlet path starts with / or is empty string

    for (HttpCookie cookie : cookies) {
        // set cookie name prefixed w/ a proxy value so it won't collide w/ other cookies
        String proxyCookieName = requestForwarder.cookieNamePrefix.get() + cookie.getName();
        Cookie servletCookie = new Cookie(proxyCookieName, cookie.getValue());
        servletCookie.setComment(cookie.getComment());
        servletCookie.setMaxAge((int) cookie.getMaxAge());
        servletCookie.setPath(path); // set to the path of the proxy servlet
        // don't set cookie domain
        servletCookie.setSecure(cookie.getSecure());
        servletCookie.setVersion(cookie.getVersion());
        servletResponse.addCookie(servletCookie);
    }
}

From source file:m.c.m.proxyma.resource.ProxymaResponseDataBeanTest.java

/**
 * Test of addCookie method, of class ProxymaResponseDataBean.
 *///from  www.  j  a v a2s. co m
public void testAddCookie() {
    System.out.println("addCookie");

    ProxymaResponseDataBean instance = new ProxymaResponseDataBean();

    //Add null cookie
    try {
        instance.addCookie(null);
        fail("exception not thrown");
    } catch (NullArgumentException x) {
        assertTrue(true);
    }

    //add empty cookie
    try {
        instance.addCookie(new Cookie(null, null));
        fail("exception not thrown");
    } catch (Exception x) {
        assertTrue(true);
    }

    instance.addCookie(new Cookie("name1", "value1"));
    assertEquals(1, instance.getCookies().size());
}

From source file:com.google.gsa.valve.modules.ldap.LDAPSSO.java

/**
 * Sets the LDAP authentication cookie//w  w  w . j  a  v  a2s . c o  m
 * 
 * @return the LDAP authentication cookie
 */
public Cookie settingCookie() {
    // Instantiate a new cookie
    Cookie extAuthCookie = new Cookie(SSO_COOKIE_NAME, "true");
    String authCookieDomain = null;
    String authCookiePath = null;

    // Cache cookie properties
    authCookieDomain = valveConf.getAuthCookieDomain();
    authCookiePath = valveConf.getAuthCookiePath();

    // Set extra cookie parameters
    extAuthCookie.setDomain(authCookieDomain);
    extAuthCookie.setPath(authCookiePath);
    extAuthCookie.setMaxAge(authMaxAge);

    // Log info
    logger.debug("Adding cookie: " + extAuthCookie.getName() + ":" + extAuthCookie.getValue() + ":"
            + extAuthCookie.getPath() + ":" + extAuthCookie.getDomain() + ":" + extAuthCookie.getSecure());

    return extAuthCookie;
}

From source file:com.google.gsa.valve.modules.httpbasic.HTTPBasicAuthenticationProcess.java

/**
 * This is the main method that does the authentication and should be 
 * invoked by the classes that would like to open a new authentication 
 * process against an HTTP Basic protected source.
 * <p>/*from  ww  w. j a  v a2  s.c  o m*/
 * The username and password for the source are assumed to be the ones 
 * captured during the authentication. These are stored in creds and in 
 * this case the root parameters. creds is an array of credentials for 
 * all external sources. The first element is 'root' which contains the 
 * credentials captured from the login page. This method reviews if there 
 * is a credential id identical to the name associated to this module 
 * in the config file. If so, these credentials are used to authenticate 
 * against this HTTP Basic source, and if not 'root' one will be used 
 * instead.
 * <p>
 * If the HTTP Basic authentication result is OK, it creates an 
 * authentication cookie containing the HTTP Basic credentials 
 * to be reused during authorization. The content returned back from the 
 * remote secure backend system is sent as well. Anyway, the HTTP 
 * response code is returned in this method to inform the caller on the 
 * status.
 * 
 * @param request HTTP request
 * @param response HTTP response
 * @param authCookies vector that contains the authentication cookies
 * @param url the document url
 * @param creds an array of credentials for all external sources
 * @param id the default credential id to be retrieved from creds
        
 * @return the HTTP error code
        
 * @throws HttpException
 * @throws IOException
 */
public int authenticate(HttpServletRequest request, HttpServletResponse response, Vector<Cookie> authCookies,
        String url, Credentials creds, String id) throws HttpException, IOException {

    Cookie[] cookies = null;

    //Credentials                     
    UsernamePasswordCredentials credentials = null;

    // Initialize status code
    int statusCode = HttpServletResponse.SC_UNAUTHORIZED;

    // Read cookies
    cookies = request.getCookies();

    // Debug
    logger.debug("HTTP Basic authentication start");

    //First read the u/p the credentails store, in this case using the same as the root login
    logger.debug("HttpBasic: trying to get creds from repository ID: " + id);
    Credential httpBasicCred = null;
    try {
        httpBasicCred = creds.getCredential(id);
    } catch (NullPointerException npe) {
        logger.error("NPE while reading credentials of ID: " + id);
    }
    if (httpBasicCred != null) {
        credentials = new UsernamePasswordCredentials(httpBasicCred.getUsername(), httpBasicCred.getPassword());
    } else {
        logger.debug("HttpBasic: trying to get creds from repository \"root\"");
        httpBasicCred = creds.getCredential("root");
        if (httpBasicCred != null) {
            logger.info("Trying with root credentails");
            credentials = new UsernamePasswordCredentials(httpBasicCred.getUsername(),
                    httpBasicCred.getPassword());
        }
    }

    logger.debug("Authenticating");
    Header[] headers = null;
    HttpMethodBase method = null;

    //Get Max connections
    int maxConnectionsPerHost = 30;
    int maxTotalConnections = 100;

    //Cookie Max Age
    int authMaxAge = -1;

    try {
        maxConnectionsPerHost = new Integer(valveConf.getMaxConnectionsPerHost()).intValue();
        maxTotalConnections = (new Integer(valveConf.getMaxTotalConnections())).intValue();
        authMaxAge = Integer.parseInt(valveConf.getAuthMaxAge());
    } catch (NumberFormatException nfe) {
        logger.error(
                "Configuration error: chack the configuration file as the numbers set for any of the following parameters are not OK:");
        logger.error("  * maxConnectionsPerHost    * maxTotalConnections    * authMaxAge");
    }

    // Protection
    if (webProcessor == null) {
        // Instantiate Web processor
        if ((maxConnectionsPerHost != -1) && (maxTotalConnections != -1)) {
            webProcessor = new WebProcessor(maxConnectionsPerHost, maxTotalConnections);
        } else {
            webProcessor = new WebProcessor();
        }
    }

    //
    // Launch the authentication process
    //

    // A fixed URL in the repository that all users have access to which can be used to authN a user
    // and capture the HTTP Authorization Header
    String authURL = valveConf.getRepository(id).getParameterValue("HTTPAuthPage");

    try {

        // Set HTTP headers
        headers = new Header[1];

        // Set User-Agent
        headers[0] = new Header("User-Agent",
                "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5");

        // Request page, testing if credentials are valid
        if (credentials != null) {
            logger.debug("Username: " + credentials.getUserName());
            logger.debug("URL: " + authURL);
        }

        //HTTP request
        method = webProcessor.sendRequest(credentials, RequestType.GET_REQUEST, headers, null, authURL);

        //Read the auth header and store in the cookie, the authZ class will use this later
        headers = method.getRequestHeaders();

        Header authHeader = null;
        authHeader = method.getRequestHeader("Authorization");

        // Cache status code
        if (method != null)
            statusCode = method.getStatusCode();

        if (statusCode == HttpServletResponse.SC_OK) {
            //Authentication worked, so create the auth cookie to indicate it has worked
            Cookie extAuthCookie = null;
            extAuthCookie = new Cookie(BASIC_COOKIE, "");

            if (authHeader != null) {

                String basicCookie = null;

                try {
                    basicCookie = URLEncoder.encode(getBasicAuthNChain(authHeader.getValue()), encoder);
                    if (basicCookie == null) {
                        basicCookie = "";
                    }
                } catch (Exception ex) {
                    logger.error("Error when setting Basic cookie value: " + ex.getMessage(), ex);
                    basicCookie = "";
                }

                extAuthCookie.setValue(basicCookie);

            }
            String authCookieDomain = null;
            String authCookiePath = null;

            // Cache cookie properties
            authCookieDomain = valveConf.getAuthCookieDomain();
            authCookiePath = valveConf.getAuthCookiePath();

            // Set extra cookie parameters
            extAuthCookie.setDomain(authCookieDomain);
            extAuthCookie.setPath(authCookiePath);
            extAuthCookie.setMaxAge(authMaxAge);

            // Log info
            if (logger.isDebugEnabled())
                logger.debug("Adding " + BASIC_COOKIE + " cookie: " + extAuthCookie.getName() + ":"
                        + extAuthCookie.getValue() + ":" + extAuthCookie.getPath() + ":"
                        + extAuthCookie.getDomain() + ":" + extAuthCookie.getSecure());

            //sendCookies support                        
            boolean isSessionEnabled = new Boolean(valveConf.getSessionConfig().isSessionEnabled())
                    .booleanValue();
            boolean sendCookies = false;
            if (isSessionEnabled) {
                sendCookies = new Boolean(valveConf.getSessionConfig().getSendCookies()).booleanValue();
            }
            if ((!isSessionEnabled) || ((isSessionEnabled) && (sendCookies))) {
                logger.debug("Adding cookie to response");
                response.addCookie(extAuthCookie);
            }

            //Add cookies to the Cookie array to support sessions
            authCookies.add(extAuthCookie);
            logger.debug("Cookie added to the array");

        }

        // Clear webProcessor cookies
        webProcessor.clearCookies();

    } catch (Exception e) {

        // Log error
        logger.error("HTTP Basic authentication failure: " + e.getMessage(), e);

        // Garbagge collect
        method = null;

        // Update status code
        statusCode = HttpServletResponse.SC_UNAUTHORIZED;

    }

    // End of the authentication process
    logger.debug("HTTP Basic Authentication completed (" + statusCode + ")");

    // Return status code
    return statusCode;

}

From source file:org.guanxi.idp.service.AuthHandler.java

/**
 * Looks for an existing GuanxiPrincipal referenced by a request cookie. When a cookie is created after
 * a successful authentication at the IdP, either via the login page or an application cookie handler,
 * the corresponding GuanxiPrincipal is stored in the servlet context against the cookie value.
 * The new GuanxiPrincipal that is created after successful authentication is stored in the servlet
 * context under GuanxiPrincipal.id// w  w w. j  a  v  a 2s  .  com
 *
 * @param request Standard HttpServletRequest
 * @param response Standard HttpServletResponse
 * @param object handler
 * @return true 
 * @throws Exception if an error occurs
 */
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object object)
        throws Exception {
    request.setCharacterEncoding("UTF-8");

    String missingParams = checkRequestParameters(request);
    if (missingParams != null) {
        logger.info("Missing param(s) : " + missingParams);
        request.setAttribute("message",
                messageSource.getMessage("missing.param", new Object[] { missingParams }, request.getLocale()));
        request.getRequestDispatcher(errorPage).forward(request, response);
        return false;
    }

    IdpDocument.Idp idpConfig = (IdpDocument.Idp) servletContext.getAttribute(Guanxi.CONTEXT_ATTR_IDP_CONFIG);

    boolean spSupported = false;
    EntityFarm farm = (EntityFarm) servletContext.getAttribute(Guanxi.CONTEXT_ATTR_IDP_ENTITY_FARM);
    EntityManager manager = farm.getEntityManagerForID(request.getParameter(spIDRequestParam));
    if (manager != null) {
        SPMetadata metadata = (SPMetadata) manager.getMetadata(request.getParameter(spIDRequestParam));
        // Apply the trust rules to the SP
        if (metadata != null) {
            if (manager.getTrustEngine().trustEntity(metadata, request.getParameter("shire"))) {
                spSupported = true;
            } else {
                logger.error("Trust failure for " + request.getParameter(spIDRequestParam) + " --> "
                        + request.getParameter("shire"));
            }
        } else {
            logger.error("No Metadata Manager found for " + request.getParameter(spIDRequestParam));
        }
    } else {
        logger.error("No Metadata Manager");
    }

    // Check the locally registered SPs
    if (!spSupported) {
        ServiceProvider[] spList = idpConfig.getServiceProviderArray();
        for (int c = 0; c < spList.length; c++) {
            if (spList[c].getName().equals(request.getParameter(spIDRequestParam))) {
                // If it's in here, we trust it explicitly
                spSupported = true;
            }
        }
    }

    // Did we find the service provider?
    if (!spSupported) {
        logger.error(
                "Service Provider providerId " + request.getParameter(spIDRequestParam) + " not supported");
        request.setAttribute("message", messageSource.getMessage("sp.not.supported",
                new Object[] { request.getParameter(spIDRequestParam) }, request.getLocale()));
        request.getRequestDispatcher(errorPage).forward(request, response);
        return false;
    }

    // Look for our cookie. This is after any application cookie handler has authenticated the user
    String cookieName = getCookieName();
    Cookie[] cookies = request.getCookies();
    if (cookies != null) {
        for (int c = 0; c < cookies.length; c++) {
            if (cookies[c].getName().equals(cookieName)) {
                // Retrieve the principal from the servlet context
                if (servletContext.getAttribute(cookies[c].getValue()) == null) {
                    // Out of date cookie value, so remove the cookie
                    cookies[c].setMaxAge(0);
                    response.addCookie(cookies[c]);
                } else {
                    // Found the principal from a previously established authentication
                    request.setAttribute(Guanxi.REQUEST_ATTR_IDP_PRINCIPAL,
                            (GuanxiPrincipal) servletContext.getAttribute(cookies[c].getValue()));
                    return true;
                }
            }
        }
    }

    // Are we getting an authentication request from the login page?
    if (request.getParameter("guanxi:mode") != null) {
        if (request.getParameter("guanxi:mode").equalsIgnoreCase("authenticate")) {
            // Get a new GuanxiPrincipal...
            GuanxiPrincipal principal = gxPrincipalFactory.createNewGuanxiPrincipal(request);
            if (authenticator.authenticate(principal, request.getParameter("userid"),
                    request.getParameter("password"))) {
                // ...associate it with a login name...
                if (principal.getName() == null) {
                    //The login name from the authenticator page
                    principal.setName(request.getParameter("userid"));
                }
                // ...store it in the request for the SSO to use...
                request.setAttribute(Guanxi.REQUEST_ATTR_IDP_PRINCIPAL, principal);
                // ...and store it in application scope for the rest of the profile to use
                servletContext.setAttribute(principal.getUniqueId(), principal);

                // Get a new cookie ready to reference the principal in the servlet context
                Cookie cookie = new Cookie(getCookieName(), principal.getUniqueId());
                cookie.setDomain((String) servletContext.getAttribute(Guanxi.CONTEXT_ATTR_IDP_COOKIE_DOMAIN));
                cookie.setPath(idpConfig.getCookie().getPath());
                if (((Integer) (servletContext.getAttribute(Guanxi.CONTEXT_ATTR_IDP_COOKIE_AGE)))
                        .intValue() != -1)
                    cookie.setMaxAge(
                            ((Integer) (servletContext.getAttribute(Guanxi.CONTEXT_ATTR_IDP_COOKIE_AGE)))
                                    .intValue());
                response.addCookie(cookie);

                return true;
            } // if (authenticator.authenticate...
            else {
                logger.error("Authentication error : " + authenticator.getErrorMessage());
                request.setAttribute("message",
                        messageSource.getMessage("authentication.error", null, request.getLocale()));
                request.getRequestDispatcher(errorPage).forward(request, response);
                return false;
            }
        }
    }

    // No embedded cookie authentication or local auth, so show the login page
    String authPage = null;
    AuthPage[] authPages = idpConfig.getAuthenticatorPages().getAuthPageArray();
    for (int c = 0; c < authPages.length; c++) {
        // We'll use the default auth page if none is specified for this service provider
        if (authPages[c].getProviderId().equals(Guanxi.DEFAULT_AUTH_PAGE_MARKER)) {
            authPage = authPages[c].getUrl();
        }

        // Customised auth page for this service provider
        if (authPages[c].getProviderId().equals(request.getParameter(spIDRequestParam))) {
            authPage = authPages[c].getUrl();
        }
    }

    addRequiredParamsAsPrefixedAttributes(request);
    request.getRequestDispatcher(authPage).forward(request, response);

    return false;
}

From source file:com.appeligo.search.actions.BaseAction.java

public String getLineup() {
    String lineup = null;/* w  w w .  jav  a  2 s. c  om*/
    //Get if from the user if there is one
    User user = getUser();
    if (user != null) {
        lineup = user.getLineupId();
        getServletRequest().getSession().setAttribute(LINEUP_ID, lineup);
    } else {
        lineup = (String) getServletRequest().getSession().getAttribute(LINEUP_ID);
        if (lineup == null) {
            // No user, and its not stored in the session, so check for a cookie. If there is no cookie, default them to pacific
            //Right now the lineup is not getting stored in the session when it is loaded by the cookie.
            //The reason is that the cookie gets set before they login and it would not get set with
            //The lineup from the user.
            Cookie[] cookies = getServletRequest().getCookies();
            if (cookies != null) {
                for (Cookie cookie : cookies) {
                    if (cookie.getName().equals(LINEUP_ID)) {
                        cookie.setMaxAge(Integer.MAX_VALUE);
                        lineup = cookie.getValue();
                        break;
                    }
                }
            }
            if (lineup == null) {
                lineup = DEFAULT_LINEUP;
                Cookie cookie = new Cookie(LINEUP_ID, lineup);
                cookie.setMaxAge(Integer.MAX_VALUE);
                response.addCookie(cookie);
                getServletRequest().getSession().setAttribute(LINEUP_ID, lineup);
            }
        }
    }
    return lineup;
}

From source file:com.qut.middleware.esoe.sso.plugins.post.handler.impl.PostLogicImpl.java

private void sendPostResponseDocument(SSOProcessorData data) throws PostBindingException {
    String remoteAddress = data.getHttpRequest().getRemoteAddr();
    try {//from   w w w . j a  v  a 2s.  c o m
        HttpServletResponse response = data.getHttpResponse();
        PrintWriter writer = response.getWriter();

        response.setContentType("text/html");

        /* Set cookie to allow javascript enabled browsers to auto submit, ensures navigation with the back button is not broken
         * because auto submit is active only when this cookie exists, and the submit javascript removes it */
        Cookie autoSubmit = new Cookie("esoeAutoSubmit", "enabled");
        autoSubmit.setMaxAge(172800); //set expiry to be 48 hours just to make sure we still work with badly configured clocks skewed from GMT
        autoSubmit.setPath("/");
        response.addCookie(autoSubmit);

        this.logger.debug("[SSO for {}] Cookie added. About to check for response document.", remoteAddress); //$NON-NLS-1$

        if (data.getResponseDocument() == null) {
            this.logger.error(
                    "[SSO for {}] No response document was generated. Unable to respond to HTTP-POST binding request.", //$NON-NLS-1$
                    remoteAddress);
            throw new PostBindingException(
                    "No response document was generated. Unable to respond to HTTP-POST binding request.");
        }

        // TODO relaystate
        String responseRelayState = "";// = data.getRelayState();
        if (responseRelayState == null)
            responseRelayState = new String("");

        /* Encode SAML Response in base64 */
        byte[] samlResponseEncoded = Base64.encodeBase64(data.getResponseDocument()); //$NON-NLS-1$
        Object[] responseArgs = new Object[] { data.getResponseEndpoint(), new String(samlResponseEncoded),
                responseRelayState };
        String htmlOutput = this.samlMessageFormat.format(responseArgs);

        this.logger.debug(
                "[SSO for {}] Writing HTML document, response for HTTP-POST request. Length: {} bytes",
                remoteAddress, htmlOutput.length());

        this.logger.trace("[SSO for {}] Writing HTML document. Content:\n{}", remoteAddress, htmlOutput);

        writer.print(htmlOutput);
        writer.flush();
    } catch (IOException e) {
        this.logger.error(
                "[SSO for {}] I/O exception occurred trying to write the HTTP response. Unable to respond with HTTP-POST binding. Error was: {}",
                remoteAddress, e.getMessage());
        throw new PostBindingException(
                "I/O exception occurred trying to write the HTTP response. Unable to respond with HTTP-POST binding.",
                e);
    }
}

From source file:com.vmware.identity.openidconnect.server.LogoutRequestProcessor.java

private Cookie loggedOutSessionCookie() {
    Cookie cookie = new Cookie(SessionManager.getSessionCookieName(this.tenant), "");
    cookie.setPath("/openidconnect");
    cookie.setSecure(true);/* w  w  w.j a  v  a  2s  .co  m*/
    cookie.setHttpOnly(true);
    cookie.setMaxAge(0);
    return cookie;
}

From source file:m.c.m.proxyma.resource.ProxymaResponseDataBeanTest.java

/**
 * Test of containsCookie method, of class ProxymaResponseDataBean.
 *///from w  w w . j  av  a  2 s .c  o m
public void testContainsCookie() {
    System.out.println("containsCookie");
    ProxymaResponseDataBean instance = new ProxymaResponseDataBean();
    instance.addCookie(new Cookie("name1", "value1"));
    instance.addCookie(new Cookie("name2", "value2"));
    instance.addCookie(new Cookie("name1", "value3"));

    boolean result = instance.containsCookie("name1");
    assertTrue(result);

    result = instance.containsCookie("name2");
    assertTrue(result);

    //Test unexisting value
    result = instance.containsCookie("unexistent");
    assertFalse(result);

    //test null search
    result = instance.containsCookie(null);
    assertFalse(result);
}

From source file:org.toobsframework.pres.doit.DoItRunner.java

private void runAction(IRequest request, String doItName, Action thisAction, Map<String, Object> params,
        Map<String, Object> responseParams, boolean lastAction) throws Exception {

    String actionType = thisAction.getActionType();
    Object retObj = null;/*from www .  j a va  2  s.c  o  m*/
    if (actionType.equalsIgnoreCase("objectAction")) {
        //Fix the input params using the param mapping for 
        //this configuration.
        if (thisAction.getParameters() != null) {
            // Cant do this for now cause of the array problem
            //ParameterUtil.mapParameters(thisAction.getParameters().getParameter(), params, params, doItName);
            ParameterUtil.mapDoItParameters(request, thisAction.getParameters().getParameter(), params, params,
                    true);
        }
        try {
            if (thisAction.isExtended()) {
                retObj = this.getDataProvider().dispatchActionEx(request, thisAction.getAction(),
                        ((String[]) ParameterUtil.resolveParam(request, thisAction.getServiceProvider(),
                                params))[0],
                        ((String[]) ParameterUtil.resolveParam(request, thisAction.getInputObjectType(),
                                params))[0],
                        thisAction.getReturnObjectType(),
                        ((String[]) ParameterUtil.resolveParam(request, thisAction.getGuidParam(), params))[0],
                        thisAction.getPermissionContext(), thisAction.getIndexParam(),
                        thisAction.getNamespace(), params, responseParams);
            } else {
                retObj = this.getDataProvider().dispatchAction(thisAction.getAction(),
                        ((String[]) ParameterUtil.resolveParam(request, thisAction.getServiceProvider(),
                                params))[0],
                        ((String[]) ParameterUtil.resolveParam(request, thisAction.getInputObjectType(),
                                params))[0],
                        thisAction.getReturnObjectType(),
                        ((String[]) ParameterUtil.resolveParam(request, thisAction.getGuidParam(), params))[0],
                        thisAction.getPermissionContext(), thisAction.getIndexParam(),
                        thisAction.getNamespace(), params, responseParams);
            }
            /* TODO: Remove this later 
            Iterator iter = responseParams.keySet().iterator();
            while (iter.hasNext()) {
              Object key = iter.next();
              params.put((String)key, responseParams.get(key));
            }
            */
        } catch (Exception e) {
            /* TODO Check to see if making responseParams work as error forward params
             * cause this sucks balls
            if (e.getCause() instanceof ValidationException) {
              responseParams.put("ErrorForwardParams", params.get("ErrorForwardParams"));
            }
            */
            throw e;
        }
    } else if (actionType.equalsIgnoreCase("cookieAction")) {
        String cookieName = ((String[]) ParameterUtil.resolveParam(request, params.get("cookieName"),
                params))[0];
        String cookieValue = ((String[]) ParameterUtil.resolveParam(request, params.get("cookieValue"),
                params))[0];
        int maxAge = -1;
        try {
            maxAge = Integer.parseInt(
                    ((String[]) ParameterUtil.resolveParam(request, params.get("maxAge"), params))[0]);
        } catch (Exception e) {
        }

        Cookie doitCookie = new Cookie(cookieName, cookieValue);
        doitCookie.setMaxAge(maxAge);
        componentRequestManager.get().getHttpResponse().addCookie(doitCookie);
    } else if (actionType.equalsIgnoreCase("sessionAction")) {
        Map<String, Object> sessionMap = new HashMap<String, Object>();

        if (thisAction.getParameters() != null) {
            ParameterUtil.mapDoItParameters(request, thisAction.getParameters().getParameter(), params,
                    sessionMap, true);
        }
        HttpSession session = componentRequestManager.get().getHttpRequest().getSession();
        Iterator<Map.Entry<String, Object>> iter = sessionMap.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry<String, Object> entry = iter.next();
            session.setAttribute(entry.getKey(), entry.getValue());
        }
    } else if (actionType.equalsIgnoreCase("indexAction") && lastAction) {
        if (this.getIndexBuilder() != null) {
            indexBuilder.buildIndexes(thisAction.getServiceProvider());
        }
    } else {
        //TODO -- Add the ability to run scripts defined in config here.
    }

    //HashMap responseParams = new HashMap();
    //Add the output params into the request for 
    //this configuration.
    if (thisAction.getOutputParameters() != null && retObj != null) {
        JXPathContext context = null;
        if ("delete".equalsIgnoreCase(thisAction.getAction())) {
            context = JXPathContext.newContext(responseParams);
            responseParams.put("deleted", String.valueOf(((Boolean) retObj).booleanValue()));
        } else {
            context = JXPathContext.newContext(retObj);
        }
        Parameter[] paramMap = thisAction.getOutputParameters().getParameter();
        for (int j = 0; j < paramMap.length; j++) {
            Parameter thisParam = paramMap[j];
            String[] paramPath = ParameterUtil.resolveParam(request, thisParam.getPath(), params);
            String[] paramName = ParameterUtil.resolveParam(request, thisParam.getName(), params);
            Object value = null;
            for (int i = 0; i < paramName.length; i++) {
                if (thisParam.getIsStatic()) {
                    value = thisParam.getPath();
                } else {
                    try {
                        value = context.getValue(paramPath[i]);
                    } catch (org.apache.commons.jxpath.JXPathException e) {
                        if (!thisParam.getIgnoreNull()) {
                            log.warn("Problem evaluating jxpath: " + paramName[i] + " value: " + paramPath[i]
                                    + " action: " + thisAction.getServiceProvider(), e);
                        }
                        continue;
                    }
                    if (value != null && value.getClass().isArray()) {
                        value = ((String[]) value)[0];
                    }
                }
                responseParams.put(paramName[i], value);
            }
        }
    }

    //Add 
    if (thisAction.getReturnAttributeName() != null && retObj != null) {
        JXPathContext context = JXPathContext.newContext(retObj);
        responseParams.put(thisAction.getReturnAttributeName(), context.getValue("./valueObject/guid"));
    }

    Iterator<String> iter = responseParams.keySet().iterator();
    while (iter.hasNext()) {
        String key = iter.next();
        params.put(key, responseParams.get(key));
    }

}