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 015package org.apache.tapestry5.internal.test; 016 017import java.util.List; 018 019import org.apache.tapestry5.Link; 020import org.apache.tapestry5.dom.Document; 021import org.apache.tapestry5.services.Response; 022 023public interface TestableResponse extends Response 024{ 025 /** 026 * Invoked as part of the rendering pipeline to store the final rendered Document object. 027 */ 028 void setRenderedDocument(Document document); 029 030 /** 031 * Allows access to the rendered document. 032 */ 033 Document getRenderedDocument(); 034 035 /** 036 * Returns the link redirected to via {@link org.apache.tapestry5.services.Response#sendRedirect(org.apache.tapestry5.Link)}. 037 */ 038 Link getRedirectLink(); 039 040 /** 041 * Clears internal state, in preparation for the next test. 042 */ 043 void clear(); 044 045 /** 046 * Returns the named header. 047 * 048 * @since 5.2.3 049 */ 050 Object getHeader(String name); 051 052 /** 053 * Returns the values of a named header. 054 * 055 * @since 5.4 056 */ 057 List<?> getHeaders(String name); 058 059 /** 060 * Returns the redirect URL. 061 * 062 * @since 5.2.3 063 */ 064 String getRedirectURL(); 065 066 /** 067 * Returns the status code for this response. 068 * 069 * @since 5.2.3 070 */ 071 int getStatus(); 072 073 /** 074 * Returns the error message, if available. 075 * 076 * @since 5.2.3 077 */ 078 String getErrorMessage(); 079 080 /** 081 * Returns the the MIME content type for the output. 082 * 083 * @since 5.2.3 084 */ 085 String getContentType(); 086 087 /** 088 * Returns the content of the {@link javax.servlet.ServletOutputStream} as string. 089 * 090 * @since 5.2.3 091 */ 092 String getOutput(); 093 094}