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.servlets;
06:
07: import org.vfny.geoserver.ExceptionHandler;
08: import org.vfny.geoserver.global.WMS;
09: import org.vfny.geoserver.servlets.AbstractService;
10: import org.vfny.geoserver.util.Requests;
11: import org.vfny.geoserver.wms.WmsExceptionHandler;
12: import javax.servlet.http.HttpServletRequest;
13:
14: /**
15: * Base servlet for all Web Map Server requests.
16: *
17: * <p>
18: * Subclasses should supply the handler, request and response mapping for the
19: * service they implement.
20: * </p>
21: *
22: * @author Gabriel Rold?n
23: * @version $Id: WMService.java 6326 2007-03-15 18:36:40Z jdeolive $
24: */
25: abstract public class WMService extends AbstractService {
26: /**
27: * Constructor for WMS service.
28: *
29: * @param request The service request being made (GetCaps,GetFeature,...)
30: * @param wms The WMS service reference.
31: */
32: public WMService(String request, WMS wms) {
33: super ("WMS", request, wms);
34: }
35:
36: /**
37: * @return The wms service ref.
38: */
39: public WMS getWMS() {
40: return (WMS) getServiceRef();
41: }
42:
43: /**
44: * Sets the wms service ref.
45: * @param wms
46: */
47: public void setWMS(WMS wms) {
48: setServiceRef(wms);
49: }
50:
51: /**
52: * returns a Web Map ServiceConfig exception handler
53: *
54: * @return WmsExceptionHandler
55: */
56: protected ExceptionHandler getExceptionHandler() {
57: return WmsExceptionHandler.getInstance();
58: }
59:
60: protected boolean isServiceEnabled(HttpServletRequest req) {
61: return getWMS().isEnabled();
62: }
63: }
|