svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wfs / wfs_1_1_0 / request / WFSGetFeatureRequest1_1_0.java @ 40559
History | View | Annotate | Download (4.61 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_1_0.request; |
25 |
|
26 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
27 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
28 |
import org.gvsig.remoteclient.wfs.wfs_1_0_0.request.WFSGetFeatureRequest1_0_0; |
29 |
|
30 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
31 |
*
|
32 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
33 |
*
|
34 |
* This program is free software; you can redistribute it and/or
|
35 |
* modify it under the terms of the GNU General Public License
|
36 |
* as published by the Free Software Foundation; either version 2
|
37 |
* of the License, or (at your option) any later version.
|
38 |
*
|
39 |
* This program is distributed in the hope that it will be useful,
|
40 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
41 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
42 |
* GNU General Public License for more details.
|
43 |
*
|
44 |
* You should have received a copy of the GNU General Public License
|
45 |
* along with this program; if not, write to the Free Software
|
46 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
47 |
*
|
48 |
* For more information, contact:
|
49 |
*
|
50 |
* Generalitat Valenciana
|
51 |
* Conselleria d'Infraestructures i Transport
|
52 |
* Av. Blasco Ib??ez, 50
|
53 |
* 46010 VALENCIA
|
54 |
* SPAIN
|
55 |
*
|
56 |
* +34 963862235
|
57 |
* gvsig@gva.es
|
58 |
* www.gvsig.gva.es
|
59 |
*
|
60 |
* or
|
61 |
*
|
62 |
* IVER T.I. S.A
|
63 |
* Salamanca 50
|
64 |
* 46005 Valencia
|
65 |
* Spain
|
66 |
*
|
67 |
* +34 963163400
|
68 |
* dac@iver.es
|
69 |
*/
|
70 |
/* CVS MESSAGES:
|
71 |
*
|
72 |
* $Id$
|
73 |
* $Log$
|
74 |
*
|
75 |
*/
|
76 |
/**
|
77 |
* @author Jorge Piera Llodr? (jorge.piera@iver.es)
|
78 |
*/
|
79 |
public class WFSGetFeatureRequest1_1_0 extends WFSGetFeatureRequest1_0_0{ |
80 |
|
81 |
public WFSGetFeatureRequest1_1_0(WFSStatus status,
|
82 |
WFSProtocolHandler protocolHandler) { |
83 |
super(status, protocolHandler);
|
84 |
} |
85 |
|
86 |
/*
|
87 |
* (non-Javadoc)
|
88 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpGetRequest(java.lang.String)
|
89 |
*/
|
90 |
protected String getHttpGetRequest(String onlineResource) { |
91 |
StringBuffer req = new StringBuffer(); |
92 |
req.append(super.getHttpGetRequest(onlineResource));
|
93 |
//Typename
|
94 |
String typeName = status.getFeatureName();
|
95 |
if ((status.getNamespaceLocation() != null) && |
96 |
(status.getNamespacePrefix() != null)){
|
97 |
req.append("&");
|
98 |
req.append("NAMESPACE=");
|
99 |
req.append("xmlns(" + status.getNamespacePrefix() + "="); |
100 |
req.append(status.getNamespaceLocation() + ")");
|
101 |
} |
102 |
if (status.getResultType() == WFSStatus.RESULTYPE_HITS){
|
103 |
req.append("&RESULTTYPE=hits");
|
104 |
} |
105 |
return req.toString();
|
106 |
} |
107 |
|
108 |
/* (non-Javadoc)
|
109 |
* @see org.gvsig.remoteClient.wfs.wfs_1_0_0.requests.WFSGetFeatureRequest1_0_0#addPropertyName(java.lang.StringBuffer)
|
110 |
*/
|
111 |
protected void addPropertyName(StringBuffer req) { |
112 |
String[] fields = status.getFields(); |
113 |
if (fields.length > 0){ |
114 |
req.append("PROPERTYNAME=");
|
115 |
|
116 |
// opening parenthesis (feb 2013)
|
117 |
// Seems to be necessary for some servers,
|
118 |
// Others accep requests with or without it
|
119 |
req.append("(");
|
120 |
|
121 |
req.append(getFieldName(fields[0]));
|
122 |
for (int i=1 ; i<fields.length ; i++){ |
123 |
req.append("," + getFieldName(fields[i]));
|
124 |
} |
125 |
|
126 |
// closing parenthesis (feb 2013)
|
127 |
req.append(")");
|
128 |
|
129 |
req.append("&");
|
130 |
} |
131 |
} |
132 |
|
133 |
private String getFieldName(String field){ |
134 |
if (status.getNamespacePrefix() != null){ |
135 |
return status.getNamespacePrefix() + ":" + field; |
136 |
} |
137 |
return field;
|
138 |
} |
139 |
|
140 |
protected String getSchemaLocation() { |
141 |
return "../wfs/1.1.0/WFS-basic.xsd"; |
142 |
} |
143 |
} |