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:
10: import javax.servlet.ServletOutputStream;
11: import javax.servlet.http.HttpServletResponse;
12:
13: /**
14: * A default output strategy which simple writes all output to the output
15: * stream of the response.
16: * <p>
17: * This is the output strategy used by {@link Dispatcher} when no other strategy
18: * can be found.
19: * </p>
20: *
21: * @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
22: *
23: */
24: public class DefaultOutputStrategy implements ServiceStrategy {
25: /**
26: * @return The string "default".
27: */
28: public String getId() {
29: return "default";
30: }
31:
32: /**
33: * @return response.getOutputStream();
34: */
35: public DispatcherOutputStream getDestination(
36: HttpServletResponse response) throws IOException {
37: ServletOutputStream outputStream = response.getOutputStream();
38: return new DispatcherOutputStream(outputStream);
39: }
40:
41: /**
42: * Calls response.getOutputStream().flush()
43: */
44: public void flush(HttpServletResponse response) throws IOException {
45: response.getOutputStream().flush();
46: }
47:
48: /**
49: * Does nothing.
50: */
51: public void abort() {
52: //do nothing
53: }
54:
55: public Object clone() throws CloneNotSupportedException {
56: return new DefaultOutputStrategy();
57: }
58: }
|