KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > pageflow > scoping > ScopedResponse


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.pageflow.scoping;
19
20 import javax.servlet.http.HttpServletResponse JavaDoc;
21 import javax.servlet.http.Cookie JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Map JavaDoc;
24 import java.io.IOException JavaDoc;
25
26
27 /**
28  * A wrapper around HttpServletResponse, associated with a given scope-key. Delegates to the wrapped
29  * response object for some functionality, but prevents output or error codes or forwards from actually
30  * happening.
31  */

32 public interface ScopedResponse
33         extends HttpServletResponse JavaDoc
34 {
35     /**
36      * Get a cookie that was added to the response.
37      */

38     public Cookie JavaDoc getCookie( String JavaDoc cookieName );
39     
40     /**
41      * Get all Cookies that were added to the response.
42      */

43     public Cookie JavaDoc[] getCookies();
44     
45     /**
46      * Get all headers.
47      *
48      * @return a Map of header-name (String) -> headers (List).
49      */

50     public Map JavaDoc getHeaders();
51     
52     /**
53      * Get all headers with the given name.
54      *
55      * @return a List of headers (String, Integer, Date), or <code>null</code> if none are found.
56      */

57     public List JavaDoc getHeaders( String JavaDoc name );
58     
59     /**
60      * Get the first header with the given name.
61      * @return an Object (String, Integer, Date) that is the first header with the given name,
62      * or <code>null</code> if none is found.
63      */

64     public Object JavaDoc getFirstHeader( String JavaDoc name );
65     
66     public HttpServletResponse JavaDoc getOuterResponse();
67     
68     /**
69      * Tell whether the response is in error.
70      *
71      * @return <code>true</code> if {@link #sendError(int,String)} or {@link #sendError(int)} was called.
72      */

73     public boolean isError();
74
75     /**
76      * Get the status code on the response.
77      *
78      * @return the status code, set by {@link #setStatus(int)}, {@link #sendError(int,String)}, or
79      * {@link #sendError(int)}; -1 if no status was set explicitly.
80      */

81     public int getStatusCode();
82
83     /**
84      * Get the status message on the response.
85      *
86      * @return the status code, set by {@link #sendError(int,String)}, or <code>null</code> if none was set.
87      */

88     public String JavaDoc getStatusMessage();
89     
90     /**
91      * Tell whether a browser redirect was sent.
92      *
93      * @return <code>true</code> if {@link #sendRedirect} was called.
94      */

95     public boolean didRedirect();
96     
97     /**
98      * Get the redirect URI.
99      *
100      * @return the URI passed to {@link #sendRedirect}, or <code>null</code> if there was no redirect.
101      */

102     public String JavaDoc getRedirectURI();
103     
104     /**
105      * Actually send the redirect that was suggested by {@link #sendRedirect}.
106      *
107      * @throws IllegalStateException if {@link #sendRedirect} was not called.
108      * @throws IOException if {@link HttpServletResponse#sendRedirect} causes an IOException.
109      */

110     public void applyRedirect() throws IOException JavaDoc;
111 }
112
Popular Tags