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.OutputStream;
21:
22: /**
23: * CacheRequest provides channels for storing resource data in the
24: * <code>ResponseCache</code>. Protocol handler calls the
25: * <code>OutputStream</code> which is supplied by CachedRequest object, to
26: * store the resource data into the cache. It also allows the user to interrupt
27: * and abort the current store operation by calling method <code>abort</code>.
28: * If IOException occurs while reading the response or writing data to the
29: * cache, the current cache store operation will be abandoned.
30: */
31: public abstract class CacheRequest {
32:
33: /**
34: * Constructor method.
35: */
36: public CacheRequest() {
37: super ();
38: }
39:
40: /**
41: * Aborts the current cache operation. If an IOException occurs while
42: * reading the response or writing resource data to the cache, the current
43: * cache store operation will be aborted.
44: */
45: public abstract void abort();
46:
47: /**
48: * <p>
49: * Returns an <code>OutputStream</code>, which is used to write the
50: * response body.
51: * </p>
52: *
53: * @return an <code>OutputStream</code> which is used to write the
54: * response body.
55: * @throws IOException
56: * if an I/O error is encountered during writing response body
57: * operation.
58: */
59: public abstract OutputStream getBody() throws IOException;
60: }
|