01: /* Licensed to the Apache Software Foundation (ASF) under one or more
02: * contributor license agreements. See the NOTICE file distributed with
03: * this work for additional information regarding copyright ownership.
04: * The ASF licenses this file to You under the Apache License, Version 2.0
05: * (the "License"); you may not use this file except in compliance with
06: * the License. You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package java.net;
18:
19: import java.io.IOException;
20: import java.io.InputStream;
21: import java.util.List;
22: import java.util.Map;
23:
24: /**
25: * CacheResponse is used for getting resource from the ResponseCache. An
26: * CacheResponse object provides an <code>InputStream</code> to access the
27: * response body, and also a method <code>getHeaders()</code> to fetch the
28: * response headers.
29: */
30: public abstract class CacheResponse {
31: /**
32: * Constructor method
33: */
34: public CacheResponse() {
35: super ();
36: }
37:
38: /**
39: * Returns an <code>InputStream</code> for the respsonse body access.
40: *
41: * @return an <code>InputStream</code>, which can be used to fetch the
42: * response body.
43: * @throws IOException
44: * if an I/O error is encounted while retrieving the response
45: * body.
46: */
47: public abstract InputStream getBody() throws IOException;
48:
49: /**
50: * Returns an immutable <code>Map</code>, which contains the response
51: * headers information.
52: *
53: * @return an immutable <code>Map</code>, which contains the response
54: * headers. The map is from response header field names to lists of
55: * field values. Field name is a <code>String</code>, and the
56: * field values list is a <code>List</code> of <code>String</code>.The
57: * status line as its field name has null as its list of field
58: * values.
59: * @throws IOException
60: * if an I/O error is encounted while retrieving the response
61: * headers.
62: */
63: public abstract Map<String, List<String>> getHeaders()
64: throws IOException;
65: }
|