1 package au.gov.amsa.craft.analyzer.wms;
2
3 import java.io.IOException;
4
5 import javax.servlet.ServletException;
6 import javax.servlet.http.HttpServlet;
7 import javax.servlet.http.HttpServletRequest;
8 import javax.servlet.http.HttpServletResponse;
9
10 import com.github.davidmoten.grumpy.wms.Capabilities;
11 import com.github.davidmoten.grumpy.wms.Layer;
12 import com.github.davidmoten.grumpy.wms.WmsServletRequestProcessor;
13
14 public class WmsServlet extends HttpServlet {
15 private static final long serialVersionUID = 1518113833457077766L;
16
17 private static final String SERVICE_TITLE = "Custom OGC Services";
18 private static final String SERVICE_NAME = "CustomOGC";
19 private static final String SERVICE_ABSTRACT = "Custom OGC WMS services including Custom, Fiddle and Darkness layers";
20
21 private final WmsServletRequestProcessor processor;
22
23 public WmsServlet() {
24
25
26 Layer layer = new DriftingLayer();
27
28
29
30
31 Capabilities cap = Capabilities.builder()
32
33 .serviceName(SERVICE_NAME)
34
35 .serviceTitle(SERVICE_TITLE)
36
37 .serviceAbstract(SERVICE_ABSTRACT)
38
39 .imageFormat("image/png")
40
41 .infoFormat("text/html")
42
43 .layer(layer)
44
45 .build();
46
47
48 processor = WmsServletRequestProcessor.builder()
49
50 .capabilities(cap)
51
52
53
54 .imageCache(200)
55
56 .addLayer("Drifting", layer)
57
58 .build();
59 }
60
61 @Override
62 protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
63 IOException {
64
65
66 processor.doGet(req, resp);
67 }
68
69 }