Package org.geoserver.wfs

Source Code of org.geoserver.wfs.CiteComplianceHack

/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
* This code is licensed under the GPL 2.0 license, availible at the root
* application directory.
*/
package org.geoserver.wfs;

import org.geoserver.config.GeoServer;
import org.geoserver.ows.Dispatcher;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
*
*  Configures the dispatcher to be cite compliant based on wfs configuration.
<p>
*  TODO: Cite compliaance should be a server wide thing. This should be addressed
*  when we ( if we ) refactor server configuration. When that happens this
*  class can be retired.
</p>
* @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
*
*/
public class CiteComplianceHack implements HandlerInterceptor {
   
    WFSInfo wfs;
    public CiteComplianceHack(GeoServer gs ) {
        this.wfs = gs.getService( WFSInfo.class );
    }

    public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
        Object handler) throws Exception {
        if (handler instanceof Dispatcher) {
            Dispatcher dispatcher = (Dispatcher) handler;
            dispatcher.setCiteCompliant(wfs.isCiteCompliant());
        }

        return true;
    }

    public void postHandle(HttpServletRequest request, HttpServletResponse response,
        Object handler, ModelAndView modelAndView) throws Exception {
        // TODO Auto-generated method stub
    }

    public void afterCompletion(HttpServletRequest request, HttpServletResponse response,
        Object handler, Exception ex) throws Exception {
        //do nothing
    }
}
TOP

Related Classes of org.geoserver.wfs.CiteComplianceHack

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.