Package com.opensymphony.module.sitemesh.filter

Examples of com.opensymphony.module.sitemesh.filter.PageResponseWrapper


     * {@link com.opensymphony.module.sitemesh.Page}is not parseable, null is
     * returned.
     */
    protected Page parsePage(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        try {
            PageResponseWrapper pageResponse = new PageResponseWrapper(response, factory);
            doRequest(request, pageResponse);
            // check if another servlet or filter put a page object to the
            // request
            Page result = (Page) request.getAttribute(PAGE);
            if (result == null) {
                // parse the page
                result = pageResponse.getPage();
            }
            request.setAttribute(USING_STREAM, new Boolean(pageResponse.isUsingStream()));
            return result;
        } catch (IllegalStateException e) {
            // weblogic throws an IllegalStateException when an error page is
            // served.
            // it's ok to ignore this, however for all other containers it
View Full Code Here


                }

                // include page using filter response
                RequestDispatcher rd = pageContext.getServletContext().getRequestDispatcher(fullPath);
                PageRequestWrapper pageRequest = new PageRequestWrapper((HttpServletRequest) pageContext.getRequest());
                PageResponseWrapper pageResponse = new PageResponseWrapper((HttpServletResponse) pageContext.getResponse(), factory);

                StringBuffer sb = new StringBuffer(contentType != null ? contentType : "text/html");
                if (encoding != null) {
                    sb.append(";charset=").append(encoding);
                }
                pageResponse.setContentType(sb.toString());

                // if rd == null, then the panel was not found, but this isn't correct, so we need to spit out
                // something appropriate. What this is, well...I don't know yet.
                if (rd == null) {
                    throw new ApplyDecoratorException("The specified resource in applyDecorator tag (" + fullPath + ") was not found.");
                }
                rd.include(pageRequest, pageResponse);
                pageObj = pageResponse.getPage();
            }

            // If pageObj == null, then the panel source had some weird error in
            // it. Stop writing bugs like this. They're ugly and they make you smell funny.
            if (pageObj == null) {
View Full Code Here

import java.io.IOException;

public class MultipassFilter extends SiteMeshFilter {

    protected void writeDecorator(final HttpServletResponse response, final Page page, RequestDispatcher dispatcher, HttpServletRequest request) throws ServletException, IOException {
        PageResponseWrapper pageResponse = new PageResponseWrapper(response, new PageParserSelector() {
            public boolean shouldParsePage(String contentType) {
                return true;
            }

            public PageParser getPageParser(String contentType) {
                return new MultipassReplacementPageParser(page, response);
            }
        });
        pageResponse.activateSiteMesh("text/html", "");
        dispatcher.include(request, pageResponse);
        pageResponse.getPage();
    }
View Full Code Here

    private final PageResponseWrapper pageResponseWrapper;
    private final ContentProcessor contentProcessor;
    private final SiteMeshWebAppContext webAppContext;

    public ContentBufferingResponse(HttpServletResponse response, final ContentProcessor contentProcessor, final SiteMeshWebAppContext webAppContext) {
        super(new PageResponseWrapper(response, new PageParserSelector() {
            public boolean shouldParsePage(String contentType) {
                return contentProcessor.handles(contentType);
            }

            public PageParser getPageParser(String contentType) {
View Full Code Here

TOP

Related Classes of com.opensymphony.module.sitemesh.filter.PageResponseWrapper

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.