01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.geoserver.ows;
06:
07: import java.io.IOException;
08: import java.io.OutputStream;
09: import javax.servlet.http.HttpServletResponse;
10:
11: /**
12: * Strategy interface for writing output to an output stream.
13: * <p>
14: * This interface is used to provide different modes of output, an example would
15: * be response buffering.
16: * </p>
17: *
18: * @author Jody Garnett, Refractions Research
19: * @author Justin Deoliveira, The Open Planning Project
20: */
21: public interface ServiceStrategy extends Cloneable {
22: /**
23: * @return A string used to identify the output strategy.
24: */
25: public String getId();
26:
27: /**
28: * Get a OutputStream we can use to add content.
29: * <p>
30: * This output stream may be a wrapper around <code>response.getOutpuStream()</code>
31: * or may not be.
32: * </p>
33: *
34: * @param response The servlet response.
35: *
36: * @return An output stream to write to.
37: *
38: * @throws IOException Any I/O errors that occur.
39: * @see DispatcherOutputStream
40: */
41: public DispatcherOutputStream getDestination(
42: HttpServletResponse response) throws IOException;
43:
44: /**
45: * Flushes the output, causing the response to be written to the actual
46: * resposne output stream: <code>response.getOutputStrema()</code>
47: * <p>
48: * Any resources that the strategy holds on to should also be released at
49: * this point.
50: * </p>
51: * @param response TODO
52: *
53: * @throws IOException Any I/O errors that occur.
54: */
55: public void flush(HttpServletResponse response) throws IOException;
56:
57: /**
58: * Complete opperation in the negative.
59: *
60: * <p>
61: * Gives ServiceConfig a chance to clean up resources
62: * </p>
63: */
64: public void abort();
65:
66: /**
67: * Clones the service strategy.
68: *
69: */
70: public Object clone() throws CloneNotSupportedException;
71: }
|