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.wfs;
06:
07: import org.geoserver.ows.Dispatcher;
08: import org.springframework.web.servlet.HandlerInterceptor;
09: import org.springframework.web.servlet.ModelAndView;
10: import javax.servlet.http.HttpServletRequest;
11: import javax.servlet.http.HttpServletResponse;
12:
13: /**
14: *
15: * Configures the dispatcher to be cite compliant based on wfs configuration.
16: * <p>
17: * TODO: Cite compliaance should be a server wide thing. This should be addressed
18: * when we ( if we ) refactor server configuration. When that happens this
19: * class can be retired.
20: * </p>
21: * @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
22: *
23: */
24: public class CiteComplianceHack implements HandlerInterceptor {
25: WFS wfs;
26:
27: public CiteComplianceHack(WFS wfs) {
28: this .wfs = wfs;
29: }
30:
31: public boolean preHandle(HttpServletRequest request,
32: HttpServletResponse response, Object handler)
33: throws Exception {
34: if (handler instanceof Dispatcher) {
35: Dispatcher dispatcher = (Dispatcher) handler;
36: dispatcher.setCiteCompliant(wfs.getCiteConformanceHacks());
37: }
38:
39: return true;
40: }
41:
42: public void postHandle(HttpServletRequest request,
43: HttpServletResponse response, Object handler,
44: ModelAndView modelAndView) throws Exception {
45: // TODO Auto-generated method stub
46: }
47:
48: public void afterCompletion(HttpServletRequest request,
49: HttpServletResponse response, Object handler, Exception ex)
50: throws Exception {
51: //do nothing
52: }
53: }
|