svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wfs / wfs_1_0_0 / request / WFSGetFeatureRequest1_0_0.java @ 40596
History | View | Annotate | Download (3 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.remoteclient.wfs.wfs_1_0_0.request; |
25 |
|
26 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
27 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
28 |
import org.gvsig.remoteclient.wfs.filters.filterencoding.FilterEncoding; |
29 |
import org.gvsig.remoteclient.wfs.request.WFSGetFeatureRequest; |
30 |
|
31 |
/**
|
32 |
* @author Jorge Piera Llodr? (jorge.piera@iver.es)
|
33 |
*/
|
34 |
public class WFSGetFeatureRequest1_0_0 extends WFSGetFeatureRequest{ |
35 |
|
36 |
public WFSGetFeatureRequest1_0_0(WFSStatus status,
|
37 |
WFSProtocolHandler protocolHandler) { |
38 |
super(status, protocolHandler);
|
39 |
} |
40 |
|
41 |
|
42 |
/*
|
43 |
* (non-Javadoc)
|
44 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpGetRequest(java.lang.String)
|
45 |
*/
|
46 |
protected String getHttpGetRequest(String onlineResource) { |
47 |
StringBuffer req = new StringBuffer(); |
48 |
req.append(onlineResource); |
49 |
req.append("REQUEST=GetFeature&SERVICE=WFS&");
|
50 |
req.append("TYPENAME=").append(status.getFeatureFullName()).append("&"); |
51 |
String[] fields = status.getFields(); |
52 |
addPropertyName(req); |
53 |
if ((status.getFilterByAttribute() != null) || (status.getFilterByArea() != null)){ |
54 |
FilterEncoding filterEncoding = new FilterEncoding(status);
|
55 |
req.append("FILTER=" + filterEncoding.toString(protocolHandler.getVersion()) + "&"); |
56 |
} |
57 |
req.append("VERSION=").append(protocolHandler.getVersion()).append("&EXCEPTIONS=XML"); |
58 |
req.append("&MAXFEATURES=").append(status.getMaxFeatures());
|
59 |
req.append("&SRSNAME=").append(status.getSrs());
|
60 |
|
61 |
return req.toString();
|
62 |
} |
63 |
|
64 |
/**
|
65 |
* Adds the "PROPERTYNAME" attribute
|
66 |
* @param req
|
67 |
* The current request
|
68 |
*/
|
69 |
protected void addPropertyName(StringBuffer req){ |
70 |
String[] fields = status.getFields(); |
71 |
if (fields.length > 0){ |
72 |
req.append("PROPERTYNAME=");
|
73 |
|
74 |
// opening parenthesis (march 2013)
|
75 |
req.append("(");
|
76 |
|
77 |
req.append(fields[0]);
|
78 |
for (int i=1 ; i<fields.length ; i++){ |
79 |
req.append("," + fields[i]);
|
80 |
} |
81 |
|
82 |
// closing parenthesis (march 2013)
|
83 |
req.append(")");
|
84 |
|
85 |
req.append("&");
|
86 |
} |
87 |
} |
88 |
|
89 |
protected String getSchemaLocation() { |
90 |
return "../wfs/1.0.0/WFS-basic.xsd"; |
91 |
} |
92 |
} |