citecompliancehack.java

来自「电子地图服务器,搭建自己的地图服务」· Java 代码 · 共 52 行

JAVA
52
字号
/* 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.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 {
    WFS wfs;

    public CiteComplianceHack(WFS wfs) {
        this.wfs = wfs;
    }

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

        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
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?