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.vfny.geoserver.wms.responses.map.georss;
06:
07: import org.vfny.geoserver.ServiceException;
08: import org.vfny.geoserver.wms.GetMapProducer;
09: import org.vfny.geoserver.wms.WMSMapContext;
10: import org.vfny.geoserver.wms.WmsException;
11: import java.io.IOException;
12: import java.io.OutputStream;
13: import java.util.HashSet;
14:
15: import javax.xml.transform.TransformerException;
16:
17: public class RSSGeoRSSMapProducer implements GetMapProducer {
18: /** format names/aliases */
19: public static HashSet FORMATS = new HashSet();
20: static {
21: FORMATS.add("rss");
22: FORMATS.add("application/rss xml");
23: }
24:
25: /** mime type */
26: public static String MIME_TYPE = "application/rss+xml";
27:
28: /**
29: * current map context
30: */
31: WMSMapContext map;
32:
33: public String getContentType() throws IllegalStateException {
34: //return MIME_TYPE;
35: return "application/xml";
36: }
37:
38: public void produceMap() throws WmsException {
39:
40: }
41:
42: public void writeTo(OutputStream out) throws ServiceException,
43: IOException {
44: RSSGeoRSSTransformer tx = new RSSGeoRSSTransformer();
45:
46: try {
47: tx.transform(map, out);
48: } catch (TransformerException e) {
49: throw (IOException) new IOException().initCause(e);
50: }
51: }
52:
53: public void abort() {
54: }
55:
56: public String getContentDisposition() {
57: return "inline; filename=geoserver.xml";
58: }
59:
60: public WMSMapContext getMapContext() {
61: return map;
62: }
63:
64: public void setMapContext(WMSMapContext mapContext) {
65: this .map = mapContext;
66: }
67:
68: public String getOutputFormat() {
69: return MIME_TYPE;
70: }
71:
72: public void setOutputFormat(String format) {
73: throw new UnsupportedOperationException();
74: }
75:
76: public void setContentType(String mime) {
77: throw new UnsupportedOperationException();
78: }
79: }
|