亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? wfsgclient.java

?? esri的ArcGIS Server超級學(xué)習(xí)模板程序(for java)
?? JAVA
字號:
package com.esri.solutions.jitk.common.gazetteer;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import com.esri.solutions.jitk.common.gazetteer.IGazetteerService.SearchMethod;

import org.apache.log4j.Logger;

import org.apache.xerces.parsers.SAXParser;

import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import java.text.StringCharacterIterator;


/**
 * Class that will interact with the WFS-G service via HTTP.
 */
public class WFSGClient {
	
	
    /**
     * {@link Logger} used to log messages for this class.
     */
    private static final Logger _logger = Logger.getLogger(WFSGClient.class);

    /**
     * URL of the WFS-G service.
     */
    private String m_serviceUrl = null;

    /**
     * {@link String} representation of the WFS-G get features
     * request.
     */
    private String m_getFeaturesRequest = null;

    /**
     * {@link String} representation of the WFS-G get features
     * response.
     */
    private String m_getFeaturesResponse = null;

    /**
     * Reference to the {@link WFSCapabilities} object.
     */
    private WFSCapabilities m_capabilities = null;

    /**
     * Constructor that initializes the instance with the URL
     * to the WFS-G service.  Also makes a get capabilities call
     * to the WFS-G service to retrieve the capabilities document via
     * {@link #getCapabilities()}.
     *
     * @param url {@link String} Url to the WFS-G service.
     */
    public WFSGClient(String url) {
        m_serviceUrl = url;

        m_capabilities = getCapabilities();
    }

    /**
     * Gets the Url to the WFS-G service.
     *
     * @return {@link String} Url to the WFS-G service.
     */
    public String getServiceUrl() {
        return m_serviceUrl;
    }

    /**
     * Sets the Url to the WFS-G service.
     *
     * @param url {@link String} Url to the WFS-G service.
     */
    public void setServiceUrl(String url) {
        m_serviceUrl = url;
    }

    /**
     * Gets the {@link String} representation of the WFS get
     * features request generated by {@link #createGetFeaturesRequest(String, int)}.
     *
     * @return {@link String} representation of the WFS get features request.
     */
    public String getGetFeaturesRequest() {
        return m_getFeaturesRequest;
    }

    /**
     * Gets the {@link String} representation of the WFS get
     * features response generated by {@link #submitGetFeatureRequest(String)}.
     *
     * @return {@link String} representation of the WFS get features response.
     */
    public String getGetFeaturesResponse() {
        return m_getFeaturesResponse;
    }

    /**
     * Creates a WFS get feature request with the given <code>placeName</code>
     * and <code>numFeatures</code> arguments.  The output of this method can be
     * retrieved via {@link #getGetFeaturesRequest()}.
     *
     * @param placeName {@link String} feature name for searching.
     * @param numFeatures Max number of requested features returned.
     */
    public void createGetFeaturesRequest(String placeName, int numFeatures, 
    		       SearchMethod searchMethod) {
        String strXML = "";

        if (placeName.length() > 0) {
            strXML = "<?xml version='1.0' ?>";
            strXML += ("<wfs:GetFeature service='WFS' version=\"1.1.0\" outputFormat=\"GML3\" maxFeatures=\"" +
            numFeatures + "\" ");
            strXML += "xmlns:iso19112=\"http://www.opengis.net/iso19112\" ";
            strXML += "xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" ";
            strXML += "xmlns:gml=\"http://www.opengis.net/gml\" ";
            strXML += "xmlns:wfs=\"http://www.opengis.net/wfs\" ";
            strXML += "xmlns:ogc=\"http://www.opengis.net/ogc\" ";
            strXML += "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
            strXML += "xsi:schemaLocation=\"http://www.opengis.net/wfs../wfs/1.0.0/WFS-basic.xsd\">";
            strXML += "  <wfs:Query typeName=\"iso19112:SI_LOCATIONINSTANCE\">";
            strXML += "    <ogc:Filter>";
            strXML += "      <ogc:PropertyIsLike wildCard=\"*\" singleChar=\"?\" escapeChar=\"!\">";
            strXML += "        <ogc:PropertyName>geographicIdentifier</ogc:PropertyName>";
            if (searchMethod.equals(SearchMethod.CONTAINS))
            	strXML += ("        <ogc:Literal>%" + placeName + "*</ogc:Literal>");
            else if (searchMethod.equals(SearchMethod.BEGINS_WITH))
            	strXML += ("        <ogc:Literal>" + placeName + "*</ogc:Literal>");
            strXML += "      </ogc:PropertyIsLike>";
            strXML += "    </ogc:Filter>";
            strXML += "  </wfs:Query>";
            strXML += "</wfs:GetFeature>";
        }

        _logger.debug(strXML);

        m_getFeaturesRequest = strXML;
    }

    /**
     * Submits a WFS get feature request to the WFS service using HTTP. The
     * output of this method can be retrieved via {@link #getGetFeaturesResponse()}.
     *
     * @param theRequest {@link String} representation of the WFS get feature request.
     */
    public void submitGetFeatureRequest(String theRequest) {
        HttpClient httpClient = null;
        PostMethod method = null;
        ByteArrayRequestEntity requestEntity = null;
        BufferedReader rd = null;
        String line = null;
        StringBuilder sb = null;

        try {
            httpClient = new HttpClient();
            method = new PostMethod(m_capabilities.getGetFeatureUrlPost());
            requestEntity = new ByteArrayRequestEntity(theRequest.getBytes(),
                    "text/xml");

            method.setRequestEntity(requestEntity);

            httpClient.executeMethod(method);

            // Get the response
            rd = new BufferedReader(new InputStreamReader(
                        method.getResponseBodyAsStream()));

            sb = new StringBuilder();
            sb.append("<?xml version='1.0' ?>");

            while ((line = rd.readLine()) != null) {
                StringCharacterIterator iterator = new StringCharacterIterator(line);
                char character = iterator.current();

                while (character != StringCharacterIterator.DONE) {
                    //					if (character == '<') {
                    //						sb.append("&lt;");
                    //					} else if (character == '>') {
                    //						sb.append("&gt;");
                    //					} else if (character == '\"') {
                    //						sb.append("&quot;");
                    //					} else if (character == '\'') {
                    //						sb.append("&#039;");
                    //					} else if (character == '\\') {
                    //						sb.append("&#092;");
                    //					} else if (character == '&') {
                    //						sb.append("&amp;");
                    //					} else {
                    sb.append(character);
                    //					}
                    character = iterator.next();
                }
            }

            rd.close();

            m_getFeaturesResponse = sb.toString();
        } catch (Exception ex) {
            _logger.warn("Error submitting request", ex);
        } finally {
            if (method != null) {
                method.releaseConnection();
            }
        }
    }

    /**
     * Submits a WFS get capabilities request to the WFS service using HTTP.
     * The response is then parsed using the Simple API for XML (SAX).
     *
     * @return Reference to the {@link WFSCapabilities} object.
     */
    private WFSCapabilities getCapabilities() {
        WFSCapabilities capabilities = null;
        String capabilitiesUrl = null;
        HttpClient httpClient = null;
        GetMethod method = null;

        CapabilitiesHandler handler = null;
        SAXParser parser = null;

        if (m_serviceUrl.charAt(m_serviceUrl.length() - 1) != '?') {
            capabilitiesUrl = m_serviceUrl + "?";
        } else {
            capabilitiesUrl = m_serviceUrl;
        }

        capabilitiesUrl += "request=GetCapabilities&service=WFS&version=1.1.0";

        try {
            httpClient = new HttpClient();
            method = new GetMethod(capabilitiesUrl);

            httpClient.executeMethod(method);

            handler = new CapabilitiesHandler();
            parser = new SAXParser();
            parser.setContentHandler(handler);
            parser.parse(new InputSource(method.getResponseBodyAsStream()));

            capabilities = handler.getWFSCapabilities();
        } catch (IOException ex) {
            _logger.warn("IOException occurred getting WFS capabilities.", ex);
        } catch (SAXException ex) {
            _logger.warn("SAXException occurred parsing WFS capabilities document.",
                ex);
        } finally {
            if (method != null) {
                method.releaseConnection();
            }
        }

        return capabilities;
    }

    /**
     * SAX content handler class for parsing the XML capabilities document
     * of a WFS service.  Extends {@link DefaultHandler}.
     */
    private class CapabilitiesHandler extends DefaultHandler {
        /**
             * Reference to the {@link WFSCapabilities} object.
             */
        WFSCapabilities capabilities = new WFSCapabilities();

        /**
         * Flag used when parsing the XML capabilities document.
         */
        boolean isGetFeatureOperation = Boolean.FALSE;

        /**
         * Gets the parsed {@link WFSCapabilities} document.
         *
         * @return Parsed {@link WFSCapabilities} object.
         */
        public WFSCapabilities getWFSCapabilities() {
            return capabilities;
        }

        /*
         * (non-Javadoc)
         * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
         */
        public void endElement(String uri, String localName, String rawName)
            throws SAXException {
            if (localName.equalsIgnoreCase("Operation") &&
                    isGetFeatureOperation) {
                isGetFeatureOperation = Boolean.FALSE;
            }
        }

        /*
         * (non-Javadoc)
         * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
         */
        public void startElement(String uri, String localName, String rawName,
            Attributes attributes) throws SAXException {
            if (localName.equalsIgnoreCase("Operation")) {
                if (attributes.getValue("name").equalsIgnoreCase("GetFeature")) {
                    isGetFeatureOperation = Boolean.TRUE;
                }
            }

            if (isGetFeatureOperation && localName.equalsIgnoreCase("Post")) {
                capabilities.setGetFeatureUrlPost(attributes.getValue(
                        "xlink:href"));
            }
        }
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久午夜| 奇米精品一区二区三区在线观看 | 狠狠狠色丁香婷婷综合激情| 91.com在线观看| 亚洲国产一区二区a毛片| 色婷婷精品久久二区二区蜜臀av| 综合婷婷亚洲小说| 91久久精品一区二区三| 亚洲制服丝袜av| 欧美丰满美乳xxx高潮www| 丝袜诱惑制服诱惑色一区在线观看 | 欧美日韩精品一区二区天天拍小说| 亚洲专区一二三| 4438x亚洲最大成人网| 久久精品国产亚洲高清剧情介绍| 精品免费99久久| 成人精品一区二区三区四区| 日本一区二区视频在线| 色哟哟欧美精品| 洋洋成人永久网站入口| 欧美视频一区二区在线观看| 日韩精品91亚洲二区在线观看| 欧美一区二区黄| 国产乱色国产精品免费视频| 国产欧美视频在线观看| 欧洲av一区二区嗯嗯嗯啊| 日本亚洲免费观看| 国产精品乱子久久久久| 欧美三级日韩三级| 福利一区福利二区| 3d成人动漫网站| 国产成人精品亚洲777人妖 | 欧美日韩另类一区| 精品在线亚洲视频| 亚洲精品久久嫩草网站秘色| 欧美一区二区视频在线观看2020 | 成人精品一区二区三区四区| 亚洲国产另类精品专区| 久久一区二区三区四区| 色婷婷av一区二区三区之一色屋| 色综合婷婷久久| 欧美国产成人精品| 欧美日韩国产天堂| 成人在线视频一区| 日本sm残虐另类| 亚洲日本va午夜在线影院| 日韩精品一区二区在线观看| 91伊人久久大香线蕉| 精品一区二区免费在线观看| 亚洲蜜臀av乱码久久精品蜜桃| 精品国产sm最大网站| 在线国产电影不卡| 亚洲丝袜另类动漫二区| 日韩欧美中文字幕精品| 欧美性生活影院| 国产不卡在线一区| 老司机精品视频一区二区三区| 一区二区三区美女视频| 欧美综合欧美视频| 东方aⅴ免费观看久久av| 久久se精品一区二区| 午夜电影久久久| 樱花草国产18久久久久| 国产精品高潮呻吟| 久久―日本道色综合久久| 制服丝袜成人动漫| 欧美视频一区二区三区| 在线亚洲欧美专区二区| 99riav一区二区三区| 国产成人精品亚洲日本在线桃色 | 日本亚洲免费观看| 性欧美疯狂xxxxbbbb| 亚洲欧美日韩成人高清在线一区| 亚洲国产高清在线观看视频| 亚洲精品在线免费观看视频| 日韩欧美视频在线 | 日韩精品一区二区三区四区视频| 欧美丝袜丝交足nylons| 色综合久久久久久久久久久| 91一区二区三区在线播放| 成人精品国产福利| 成人永久看片免费视频天堂| 国产精品影音先锋| 国产高清不卡二三区| 福利一区福利二区| av网站免费线看精品| 91最新地址在线播放| 91在线视频网址| 在线影院国内精品| 欧美综合一区二区三区| 欧美三级中文字幕| 欧美嫩在线观看| 日韩午夜在线影院| 欧美成人女星排名| 久久久久国产精品麻豆 | 欧美激情中文不卡| 国产精品免费av| 亚洲欧美乱综合| 日日欢夜夜爽一区| 精品一区二区三区在线播放| 国产精品一区二区三区四区| 成人三级伦理片| 一本到不卡免费一区二区| 欧美午夜精品一区二区三区| 欧美日韩高清一区二区三区| 欧美一级久久久久久久大片| 精品国产欧美一区二区| 国产精品乱人伦| 亚洲韩国一区二区三区| 毛片av一区二区三区| 国产成人精品亚洲777人妖| 91论坛在线播放| 91精品国产综合久久精品图片| 久久综合给合久久狠狠狠97色69| 中文字幕av不卡| 亚洲国产毛片aaaaa无费看 | 亚洲欧美日韩国产综合| 日本午夜一本久久久综合| 国产福利精品导航| 色av成人天堂桃色av| 日韩精品一区二区三区在线播放| 国产精品国产精品国产专区不蜜| 丝袜美腿高跟呻吟高潮一区| 国产乱色国产精品免费视频| 在线免费不卡视频| 26uuu久久综合| 亚洲尤物在线视频观看| 国产精品一品视频| 欧美三级乱人伦电影| 久久九九影视网| 亚洲国产精品久久一线不卡| 激情六月婷婷久久| 欧美性受xxxx| 国产精品视频免费看| 日本不卡1234视频| 色综合天天综合网天天狠天天 | 国产在线播放一区| 欧美性色黄大片手机版| 日本一区二区三级电影在线观看| 亚洲成人一区在线| 成人av在线播放网址| 欧美一区二区三区精品| 亚洲色图都市小说| 国产精品一线二线三线| 制服丝袜激情欧洲亚洲| 怡红院av一区二区三区| 成人黄动漫网站免费app| 日韩精品一区在线| 日韩黄色免费电影| 在线观看免费成人| 国产精品短视频| 国产精品自在欧美一区| 精品国产麻豆免费人成网站| 亚洲国产视频直播| 色欧美片视频在线观看在线视频| 久久久夜色精品亚洲| 久久精品久久精品| 欧美日韩视频一区二区| 亚洲黄色av一区| 972aa.com艺术欧美| 中文字幕av一区二区三区高| 国产成人在线影院| 久久先锋影音av| 狠狠色狠狠色综合系列| 欧美一区二区三区成人| 三级久久三级久久久| 欧美日韩在线精品一区二区三区激情| 中文字幕日韩一区二区| www.欧美色图| 国产精品久久久久久久浪潮网站 | 中文字幕人成不卡一区| 粉嫩欧美一区二区三区高清影视| 精品1区2区在线观看| 国产乱码字幕精品高清av| 久久麻豆一区二区| 国产成人一区在线| 国产女人18水真多18精品一级做| 国产精品18久久久| 国产视频视频一区| 粗大黑人巨茎大战欧美成人| 日本一区二区视频在线| 99精品欧美一区二区三区小说| 中文字幕综合网| 日本韩国一区二区| 亚洲第一福利一区| 欧美精品精品一区| 久久se精品一区二区| 久久久国际精品| 99视频有精品| 亚洲午夜国产一区99re久久| 欧美一区二区二区| 国产在线精品视频| 国产精品你懂的在线欣赏| 色综合视频一区二区三区高清| 亚洲网友自拍偷拍| 久久综合色播五月| 北条麻妃国产九九精品视频| 夜夜嗨av一区二区三区四季av| 欧美一级一级性生活免费录像| 国产制服丝袜一区|