Package org.apache.cocoon.environment

Examples of org.apache.cocoon.environment.Response


     */
    public static void addCookie(Map objectModel, String name, String value,
                                    String comment, String domain, int maxage, String path,
                                    String secure, int version)
    {
        Response response = ObjectModelHelper.getResponse(objectModel);
        Cookie cookieToSet = response.createCookie(name,value);

        if ((comment.trim()).length() > 0)
            cookieToSet.setComment(comment);

        if ((domain.trim()).length() > 0)
            cookieToSet.setDomain(domain);

        if (maxage > 0)
            cookieToSet.setMaxAge(maxage);

        if ((path.trim()).length() > 0)
            cookieToSet.setPath("/");

        if (secure == "true")
            cookieToSet.setSecure(true);
        else
            cookieToSet.setSecure(false);

        cookieToSet.setVersion(version);
        response.addCookie(cookieToSet);
    }
View Full Code Here


    throws Exception {
        Map results = new HashMap();
        HashMap isDone = new HashMap();
        Integer dummy = new Integer(1);

        final Response response = ObjectModelHelper.getResponse(objectModel);
        final String[] names = parameters.getNames();

        // parameters
        for (int i=0; i<names.length; i++) {
            isDone.put(names[i], dummy);
            response.setHeader(names[i],parameters.getParameter(names[i]));
            results.put(names[i],parameters.getParameter(names[i]));
        }

        // defaults, that are not overridden
        for (int i=0; i<defaults.length; i++) {
            if (! isDone.containsKey(defaults[i])) {
                response.setHeader((String) defaults[i], (String) settings.get(defaults[i]));
                results.put((String) defaults[i],(String) settings.get(defaults[i]));
            }
        }

        return Collections.unmodifiableMap(results);
View Full Code Here

            }
        }

        // store in a cookie if so configured
        if (storeInCookie) {
            Response response = ObjectModelHelper.getResponse(objectModel);

            response.addCookie(response.createCookie(localeAttr, lc));
            debug("created cookies");
        }

        // set up a map for XPath Substituion
        Map map = new HashMap();
View Full Code Here

            }
        }

        // store in a cookie if so configured
        if (storeInCookie) {
            Response response = ObjectModelHelper.getResponse(objectModel);
            response.addCookie(response.createCookie(attribute, locale));
        }
    }
View Full Code Here

     */
    public static void addCookie(Map objectModel, String name, String value,
                                    String comment, String domain, int maxage, String path,
                                    String secure, int version)
    {
        Response response = ObjectModelHelper.getResponse(objectModel);
        Cookie cookieToSet = response.createCookie(name,value);

        if ((comment.trim()).length() > 0)
            cookieToSet.setComment(comment);

        if ((domain.trim()).length() > 0)
            cookieToSet.setDomain(domain);

        if (maxage > 0)
            cookieToSet.setMaxAge(maxage);

        if ((path.trim()).length() > 0)
            cookieToSet.setPath("/");

        cookieToSet.setSecure(BooleanUtils.toBoolean(secure));
        cookieToSet.setVersion(version);
        response.addCookie(cookieToSet);
    }
View Full Code Here

        WebContinuation wk)
        throws Exception {

        Request cocoonRequest = ContextHelper.getRequest(this.avalonContext);
        AppleRequest req = new DefaultAppleRequest(params, cocoonRequest);
        Response cocoonResponse = ContextHelper.getResponse(this.avalonContext);
        DefaultAppleResponse res = new DefaultAppleResponse(cocoonResponse);

        try {
            app.process(req, res);
        } finally {
View Full Code Here

                   Map objectModel,
                   String source,
                   Parameters parameters)
    throws Exception {
        Request request = ObjectModelHelper.getRequest(objectModel);
        Response response = ObjectModelHelper.getResponse(objectModel);

        // Pass FacesRedirector to the FacesContext implementation.
        request.setAttribute(REQUEST_REDIRECTOR_ATTRIBUTE, new RedirectorImpl(redirector, request, response));

        FacesContext context = facesContextFactory.getFacesContext(this.context, request, response, lifecycle);
View Full Code Here

            this.getLogger().debug("BEGIN showConfiguration consumer=" + consumer + ", src="+src);
        }

        // get some important information
        Request request = ObjectModelHelper.getRequest(this.objectModel);
        Response response = ObjectModelHelper.getResponse(this.objectModel);
        Session session = request.getSession();

        boolean isAdmin = (src == null || src.equals("admin"));

        // now start producing xml:
        consumer.startElement("", "configuration", "configuration", XMLUtils.EMPTY_ATTRIBUTES);

        // set the conf uri:
        // This is a bug in the servlet 2.2 API!!!
        // It does not contain the context:  String uri = HttpUtils.getRequestURL(this.request).toString();
        // So: ABSOLUTELY USELESS
        String uri = response.encodeURL(request.getRequestURI());
        consumer.startElement("", "uri", "uri", XMLUtils.EMPTY_ATTRIBUTES);
        consumer.characters(uri.toCharArray(), 0, uri.length());
        consumer.endElement("", "uri", "uri");

        if (isAdmin == true) {
View Full Code Here

    public int doStartTag(String namespaceURI, String localName, String qName, Attributes atts)
    throws SAXException {
        int rc = super.doStartTag(namespaceURI, localName, qName, atts);

        Response response = ObjectModelHelper.getResponse(objectModel);
        response.setLocale(getFacesContext().getViewRoot().getLocale());

        ResponseWriter writer = getFacesContext().getResponseWriter();
        try {
            writer.startDocument();
        } catch (IOException e) {
View Full Code Here

                                    String      media,
                                    String      contextID)
    throws IOException, SAXException, ProcessingException {
        // synchronized not req.
        this.setup();
        Response response = ContextHelper.getResponse(this.componentContext);

        XMLUtils.startElement(consumer, PortalConstants.ELEMENT_CONFIGURATION);

        // set the portal-page uri:
        StringBuffer buffer = new StringBuffer(requestURI);
        buffer.append((requestURI.indexOf('?') == -1 ? '?' : '&'))
            .append(PortalManagerImpl.REQ_PARAMETER_PROFILE)
            .append('=')
            .append(profileID);
        String uri = response.encodeURL(buffer.toString());
        XMLUtils.startElement(consumer, "uri");
        XMLUtils.data(consumer, uri);
        XMLUtils.endElement(consumer, "uri");

        Map config = this.getConfiguration();
        String portalURI = response.encodeURL((String)config.get(PortalConstants.CONF_PORTAL_URI));

        XMLUtils.startElement(consumer, "portal");
        XMLUtils.data(consumer, portalURI);
        XMLUtils.endElement(consumer, "portal");
View Full Code Here

TOP

Related Classes of org.apache.cocoon.environment.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.