|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
WebResponse.java | - | - | - | - |
|
1 | // Copyright 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.web; | |
16 | ||
17 | import java.io.IOException; | |
18 | import java.io.OutputStream; | |
19 | import java.io.PrintWriter; | |
20 | ||
21 | import org.apache.tapestry.util.ContentType; | |
22 | ||
23 | /** | |
24 | * Controls the response to the client, and specifically allows for creating the output stream (or | |
25 | * print writer) to which content is sent. | |
26 | * | |
27 | * @author Howard M. Lewis Ship | |
28 | * @since 4.0 | |
29 | */ | |
30 | public interface WebResponse | |
31 | { | |
32 | /** | |
33 | * Returns a output stream to which output should be sent. This method should only be invoked | |
34 | * once on a response. | |
35 | * | |
36 | * @return the output stream, configured for the given type. | |
37 | */ | |
38 | ||
39 | public OutputStream getOutputStream(ContentType contentType) throws IOException; | |
40 | ||
41 | /** | |
42 | * Returns a {@link PrintWriter}to which output should be sent. This method should be invoked | |
43 | * once on a response. A second call is expected to be so that an exception page can be | |
44 | * rendered, and the underlying request data is reset. | |
45 | */ | |
46 | ||
47 | public PrintWriter getPrintWriter(ContentType contentType) throws IOException; | |
48 | ||
49 | /** | |
50 | * Encodes a URL, which adds information to the URL needed to ensure that the request triggered | |
51 | * by the URL will be associated with the current session (if any). In most cases, the string is | |
52 | * returned unchanged. | |
53 | */ | |
54 | ||
55 | public String encodeURL(String url); | |
56 | ||
57 | /** | |
58 | * Resets any buffered content. This may be used after an error to radically change what the | |
59 | * output will be. | |
60 | */ | |
61 | ||
62 | public void reset(); | |
63 | ||
64 | public void setContentLength(int contentLength); | |
65 | ||
66 | /** | |
67 | * Returns a value to be prefixed or suffixed with any client-side JavaScript elements | |
68 | * (variables and function names) to ensure that they are unique with the context of the entire | |
69 | * page. For servlets, this is the empty string. | |
70 | */ | |
71 | ||
72 | public String getNamespace(); | |
73 | ||
74 | /** | |
75 | * Sets a response header as a date. | |
76 | * | |
77 | * @param string | |
78 | * the name of the header to set. | |
79 | * @param date | |
80 | * the date value to set, in milliseconds since the epoch. | |
81 | */ | |
82 | public void setDateHeader(String string, long date); | |
83 | ||
84 | /** | |
85 | * Sets the status code for this response. | |
86 | */ | |
87 | public void setStatus(int status); | |
88 | } |
|