001    // Copyright 2007, 2009 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry5.internal.test;
016    
017    import org.apache.tapestry5.Link;
018    import org.apache.tapestry5.dom.Document;
019    import org.apache.tapestry5.services.Response;
020    
021    public interface TestableResponse extends Response
022    {
023        /**
024         * Invoked as part of the rendering pipeline to store the final rendered Document object.
025         */
026        void setRenderedDocument(Document document);
027    
028        /**
029         * Allows access to the rendered document.
030         */
031        Document getRenderedDocument();
032    
033        /**
034         * Returns the link redirected to via {@link org.apache.tapestry5.services.Response#sendRedirect(org.apache.tapestry5.Link)}.
035         */
036        Link getRedirectLink();
037    
038        /**
039         * Clears internal state, in preparation for the next test.
040         */
041        void clear();
042        
043        /**
044         * Returns the named header.
045         * 
046         * @since 5.2.3
047         */
048        Object getHeader(String name);
049        
050        /**
051         * Returns the redirect URL.
052         * 
053         * @since 5.2.3
054         */
055        String getRedirectURL();
056        
057        /**
058         * Returns the status code for this response.
059         * 
060         * @since 5.2.3
061         */
062        int getStatus();
063        
064        /**
065         * Returns the error message, if available.
066         * 
067         * @since 5.2.3
068         */
069        String getErrorMessage();
070        
071        /**
072         * Returns the the MIME content type for the output.
073         * 
074         * @since 5.2.3
075         */
076        String getContentType();
077        
078        /**
079         * Returns the content of the {@link javax.servlet.ServletOutputStream} as string.
080         * 
081         * @since 5.2.3
082         */
083        String getOutput();
084    
085    }