svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wfs / request / WFSGetFeatureRequest.java @ 40360
History | View | Annotate | Download (5.26 KB)
1 |
package org.gvsig.remoteclient.wfs.request; |
---|---|
2 |
|
3 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
4 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
5 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
6 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
7 |
import org.gvsig.remoteclient.wfs.edition.WFSTTags; |
8 |
import org.gvsig.remoteclient.wfs.filters.filterencoding.FilterEncoding; |
9 |
|
10 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
11 |
*
|
12 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
13 |
*
|
14 |
* This program is free software; you can redistribute it and/or
|
15 |
* modify it under the terms of the GNU General Public License
|
16 |
* as published by the Free Software Foundation; either version 2
|
17 |
* of the License, or (at your option) any later version.
|
18 |
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
27 |
*
|
28 |
* For more information, contact:
|
29 |
*
|
30 |
* Generalitat Valenciana
|
31 |
* Conselleria d'Infraestructures i Transport
|
32 |
* Av. Blasco Ib??ez, 50
|
33 |
* 46010 VALENCIA
|
34 |
* SPAIN
|
35 |
*
|
36 |
* +34 963862235
|
37 |
* gvsig@gva.es
|
38 |
* www.gvsig.gva.es
|
39 |
*
|
40 |
* or
|
41 |
*
|
42 |
* IVER T.I. S.A
|
43 |
* Salamanca 50
|
44 |
* 46005 Valencia
|
45 |
* Spain
|
46 |
*
|
47 |
* +34 963163400
|
48 |
* dac@iver.es
|
49 |
*/
|
50 |
/* CVS MESSAGES:
|
51 |
*
|
52 |
* $Id$
|
53 |
* $Log$
|
54 |
*
|
55 |
*/
|
56 |
/**
|
57 |
* The GetFeature operation allows retrieval of features from a
|
58 |
* web feature service. A GetFeature request is processed by
|
59 |
* a WFS and when the value of the outputFormat attribute is
|
60 |
* set to text/gml a GML instance document, containing the
|
61 |
* result set, is returned to the client.
|
62 |
* @see http://www.opengeospatial.org/standards/wfs
|
63 |
* @author Jorge Piera Llodrá (jorge.piera@iver.es)
|
64 |
*/
|
65 |
public abstract class WFSGetFeatureRequest extends WFSRequest{ |
66 |
|
67 |
public WFSGetFeatureRequest(WFSStatus status,
|
68 |
WFSProtocolHandler protocolHandler) { |
69 |
super(status, protocolHandler);
|
70 |
} |
71 |
|
72 |
/*
|
73 |
* (non-Javadoc)
|
74 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpPostRequest(java.lang.String)
|
75 |
*/
|
76 |
protected String getHttpPostRequest(String onlineResource) { |
77 |
StringBuffer request = new StringBuffer(); |
78 |
request.append(WFSTTags.XML_ROOT); |
79 |
request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
80 |
request.append(CapabilitiesTags.WFS_GETFEATURE + " ");
|
81 |
request.append(CapabilitiesTags.VERSION + "=\"" + protocolHandler.getVersion() + "\" "); |
82 |
request.append(WFSTTags.WFST_SERVICE + "=\"WFS\" ");
|
83 |
if (status.getMaxFeatures().longValue() > 0){ |
84 |
request.append(CapabilitiesTags.MAXFEATURES + "=\"" + status.getMaxFeatures() + "\" "); |
85 |
} |
86 |
if (status.getResultType() == WFSStatus.RESULTYPE_HITS){
|
87 |
request.append(WFSTTags.WFS_RESULTTYPE + "=\"" + WFSTTags.WFS_HITS + "\" "); |
88 |
} |
89 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.OGC_NAMESPACE_PREFIX);
|
90 |
request.append("=\"" + WFSTTags.OGC_NAMESPACE + "\" "); |
91 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.WFS_NAMESPACE_PREFIX);
|
92 |
request.append("=\"" + WFSTTags.WFS_NAMESPACE + "\" "); |
93 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.XML_NAMESPACE_PREFIX);
|
94 |
request.append("=\"" + WFSTTags.XML_NAMESPACE + "\" "); |
95 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.GML_NAMESPACE_PREFIX);
|
96 |
request.append("=\"" + WFSTTags.GML_NAMESPACE + "\" "); |
97 |
request.append(WFSTTags.XMLNS + ":" + status.getNamespacePrefix());
|
98 |
request.append("=\"" + status.getNamespaceLocation() + "\" "); |
99 |
request.append(WFSTTags.XML_NAMESPACE_PREFIX + ":" + WFSTTags.XML_SCHEMALOCATION);
|
100 |
request.append("=\"" + WFSTTags.WFS_NAMESPACE + " "); |
101 |
request.append(getSchemaLocation()); |
102 |
request.append("\">");
|
103 |
request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
104 |
request.append(WFSTTags.WFS_QUERY); |
105 |
request.append(" typeName=\"" + status.getFeatureFullName() + "\""); |
106 |
request.append(">");
|
107 |
if ((status.getFilterByAttribute() != null) || (status.getFilterByArea() != null)){ |
108 |
FilterEncoding filterEncoding = new FilterEncoding(status);
|
109 |
request.append(filterEncoding.toString(protocolHandler.getVersion())); |
110 |
} |
111 |
request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
112 |
request.append(WFSTTags.WFS_QUERY); |
113 |
request.append(">");
|
114 |
request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
115 |
request.append(CapabilitiesTags.WFS_GETFEATURE + ">");
|
116 |
return request.toString();
|
117 |
} |
118 |
|
119 |
/*
|
120 |
* (non-Javadoc)
|
121 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getOperationCode()
|
122 |
*/
|
123 |
protected String getOperationName() { |
124 |
return CapabilitiesTags.WFS_GETFEATURE;
|
125 |
} |
126 |
|
127 |
/*
|
128 |
* (non-Javadoc)
|
129 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation()
|
130 |
*/
|
131 |
protected String getSchemaLocation() { |
132 |
return null; |
133 |
} |
134 |
|
135 |
/*
|
136 |
* (non-Javadoc)
|
137 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getTempFilePrefix()
|
138 |
*/
|
139 |
protected String getTempFilePrefix() { |
140 |
return "wfs_getFeature.gml"; |
141 |
} |
142 |
|
143 |
/*
|
144 |
* (non-Javadoc)
|
145 |
* @see org.gvsig.remoteclient.wfs.request.WFSRequest#createRequestInformation()
|
146 |
*/
|
147 |
public WFSRequestInformation createRequestInformation() {
|
148 |
return new WFSGetFeatureRequestInformation(); |
149 |
} |
150 |
|
151 |
|
152 |
} |