public class OWSUtils extends OWSCommonUtils
Utility methods for common handling of requests/responses in OGC web services
Modifier and Type | Field and Description |
---|---|
static String |
CSW |
static String |
invalidEndpoint |
static String |
ioError |
static String |
JSON_MIME_TYPE |
static String |
OGC |
static String |
OWS |
static String |
SAS |
static String |
SLD |
static String |
SOAP11_URI |
static String |
SOAP12_URI |
static String |
SOS |
static String |
SPS |
static String |
SWES |
static String |
unsupportedSpec |
static String |
WCS |
static String |
WFS |
static String |
WMS |
static String |
WNS |
static String |
WPS |
static String |
XML_MIME_TYPE |
static String |
XML_MIME_TYPE2 |
invalidKVP, invalidReq, invalidValue, invalidXML, timeFormat
Constructor and Description |
---|
OWSUtils() |
Modifier and Type | Method and Description |
---|---|
String |
buildURLQuery(OWSRequest request)
Helper method to build an URL query from given request object
|
Element |
buildXMLQuery(DOMHelper dom,
OWSRequest request)
Helper method to build a DOM element containing the request XML
Note that the element is not yet appended to any parent.
|
Element |
buildXMLResponse(DOMHelper dom,
OWSResponse response)
Helper method to build a DOM element containing the response XML.
in a version agnostic way. |
Element |
buildXMLResponse(DOMHelper dom,
OWSResponse response,
String version)
Helper method to build a DOM element containing the response XML
for the specified version
|
OWSServiceCapabilities |
getCapabilities(String server,
String serviceType,
String version)
Helper method to get capabilities from an OWS service and parse it
|
static String |
getNamespaceURI(String spec,
String version) |
static void |
loadRegistry() |
OWSServiceCapabilities |
readCapabilities(DOMHelper dom,
Element capsElt,
String serviceType)
Helper method to parse any OWS capabilities document from an XML/DOM tree
|
OWSRequest |
readURLQuery(String queryString)
Helper method to parse any OWS query from a URL query string
|
OWSRequest |
readURLQuery(String queryString,
String serviceType)
Helper method to parse any OWS query from a URL query string
The service type is also specified in case it is missing in the query
|
OWSRequest |
readURLQuery(String queryString,
String serviceType,
String defaultVersion)
Helper method to parse any OWS query from a URL query string
|
OWSRequest |
readXMLQuery(DOMHelper dom,
Element requestElt)
Helper method to parse any OWS query from an XML/DOM tree
|
OWSRequest |
readXMLQuery(DOMHelper dom,
Element requestElt,
String serviceType)
Helper method to parse any OWS query from an XML/DOM tree
|
OWSRequest |
readXMLQuery(DOMHelper dom,
Element requestElt,
String serviceType,
String defaultVersion)
Helper method to parse any OWS query from an XML/DOM tree
|
OWSRequest |
readXMLQuery(InputStream is)
Helper method to parse any OWS query directly from an InputStream
|
OWSRequest |
readXMLQuery(InputStream is,
String serviceType)
Helper method to parse any OWS query directly from an InputStream
|
OWSResponse |
readXMLResponse(DOMHelper dom,
Element responseElt,
String serviceType)
Helper method to parse any OWSResponse from service type only
This tries to guess the response type and version from the root element
|
OWSResponse |
readXMLResponse(DOMHelper dom,
Element responseElt,
String serviceType,
String responseType)
Helper method to parse any OWSResponse from service type and response type only
This tries to guess the version from a version attribute or the end of the namespace uri
|
OWSResponse |
readXMLResponse(DOMHelper dom,
Element responseElt,
String serviceType,
String responseType,
String version)
Helper method to parse any OWSResponse from service type, response type and version
|
OWSResponse |
readXMLResponse(InputStream is,
String serviceType,
String responseType)
Helper method to parse any OWS response directly from an InputStream
|
String |
readXMLVersion(DOMHelper dom,
Element objectElt)
Helper method to guess the version from the request XML
|
HttpURLConnection |
sendGetRequest(OWSRequest request)
Helper method to send any OWS request to the server URL using GET
|
HttpURLConnection |
sendPostRequest(OWSRequest request)
Helper method to send any OWS request to the server URL using POST
|
HttpURLConnection |
sendPostRequestWithQuery(OWSRequest request)
Helper method to send any OWS request in the query string by using POST for additional content.
This is typically used to send SWE data to the server in a persistent HTTP connection, so the connection object returned is not connected to let the caller add the desired content headers connection options. |
<ResponseType extends OWSResponse> |
sendRequest(OWSRequest request,
boolean useSoap)
Helper method to send any OWS request using either GET or POST URL as specified in request object.
If both GET and POST URLs are specified, GET is used. |
HttpURLConnection |
sendSoapRequest(OWSRequest request)
Helper method to send any OWS request to the server URL using POST with SOAP
|
void |
writeXMLException(OutputStream os,
String serviceType,
String version,
OWSException e)
Helper method to write OWS exception reports
|
void |
writeXMLQuery(OutputStream os,
OWSRequest request)
Helper method to write any OWS XML request directly to an output stream
|
void |
writeXMLResponse(OutputStream os,
OWSResponse response)
Helper method to write any OWS XML response directly to an output stream.
The version specified in the response object determines the version of writer to use |
void |
writeXMLResponse(OutputStream os,
OWSResponse response,
String version)
Helper method to write any OWS XML response directly to an output stream
|
void |
writeXMLResponse(OutputStream os,
OWSResponse response,
String version,
String soapVersion)
Helper method to write any OWS XML response directly to an output stream
|
parseBboxArg, parseQueryParameters, parseTimeArg, parseVector
public static final String XML_MIME_TYPE
public static final String XML_MIME_TYPE2
public static final String JSON_MIME_TYPE
public static final String OGC
public static final String OWS
public static final String WMS
public static final String WFS
public static final String WCS
public static final String SWES
public static final String SOS
public static final String CSW
public static final String WNS
public static final String SAS
public static final String SPS
public static final String WPS
public static final String SLD
public static final String unsupportedSpec
public static final String invalidEndpoint
public static final String ioError
public static final String SOAP11_URI
public static final String SOAP12_URI
public static void loadRegistry()
public OWSRequest readXMLQuery(DOMHelper dom, Element requestElt, String serviceType, String defaultVersion) throws OWSException
dom
- DOM helper instance that will be used to parse the DOM treerequestElt
- root element of the requestserviceType
- service type to check if service in query is correctdefaultVersion
- version used in case no version is specified in the queryOWSException
public OWSRequest readXMLQuery(DOMHelper dom, Element requestElt, String serviceType) throws OWSException
dom
- DOM helper instance that will be used to parse the DOM treerequestElt
- root element of the requestserviceType
- service type to check if service parameter in query is correctOWSException
public OWSRequest readXMLQuery(DOMHelper dom, Element requestElt) throws OWSException
dom
- DOM helper instance that will be used to parse the DOM treerequestElt
- root element of the requestOWSException
public OWSRequest readXMLQuery(InputStream is, String serviceType) throws OWSException
is
- input stream containing the XML document to read fromserviceType
- service type to check if service parameter in query is correctOWSException
public OWSRequest readXMLQuery(InputStream is) throws OWSException
is
- input stream containing the XML document to read fromOWSException
public OWSRequest readURLQuery(String queryString, String serviceType, String defaultVersion) throws OWSException
queryString
- query string to read request parameters fromserviceType
- service type to check if service parameter in query is correctdefaultVersion
- version used in case no version is specified in the queryOWSException
public OWSRequest readURLQuery(String queryString, String serviceType) throws OWSException
queryString
- query string to read request parameters fromserviceType
- service type to check if service parameter in query is correctOWSException
public OWSRequest readURLQuery(String queryString) throws OWSException
queryString
- query string to read request parameters fromOWSException
public String readXMLVersion(DOMHelper dom, Element objectElt) throws OWSException
dom
- DOM helper instance that will be used to parse the DOM treeobjectElt
- DOM element to read version fromOWSException
public String buildURLQuery(OWSRequest request) throws OWSException
request
- OWS request objectOWSException
public Element buildXMLQuery(DOMHelper dom, OWSRequest request) throws OWSException
dom
- DOM helper instance that will be used to generate the DOM treerequest
- OWS request objectOWSException
public void writeXMLQuery(OutputStream os, OWSRequest request) throws OWSException
os
- output stream to write torequest
- OWS request objectOWSException
public OWSResponse readXMLResponse(DOMHelper dom, Element responseElt, String serviceType) throws OWSException
dom
- DOM helper instance that will be used to parse the DOM treeresponseElt
- root element of the XML responseserviceType
- type of OGC service sending the responseOWSException
public OWSResponse readXMLResponse(DOMHelper dom, Element responseElt, String serviceType, String responseType) throws OWSException
dom
- DOM helper instance that will be used to parse the DOM treeresponseElt
- root element of the XML responseserviceType
- type of OGC service sending the responseresponseType
- type of response object to read (if null XML element name is used)OWSException
public OWSResponse readXMLResponse(DOMHelper dom, Element responseElt, String serviceType, String responseType, String version) throws OWSException
dom
- DOM helper instance that will be used to parse the DOM treeresponseElt
- root element of the XML responseserviceType
- type of OGC service sending the responseresponseType
- type of response object to read (if null XML element name is used)version
- version of reader to useOWSException
public OWSResponse readXMLResponse(InputStream is, String serviceType, String responseType) throws OWSException
is
- input stream to read fromserviceType
- type of OGC service sending the responseresponseType
- type of response to read (get it fromOWSException
public Element buildXMLResponse(DOMHelper dom, OWSResponse response, String version) throws OWSException
dom
- DOM helper instance that will be used to generate the DOM treeresponse
- OWS response objectversion
- version of writer to useOWSException
public Element buildXMLResponse(DOMHelper dom, OWSResponse response) throws OWSException
dom
- DOM helper instance that will be used to generate the DOM treeresponse
- OWS response objectOWSException
public void writeXMLResponse(OutputStream os, OWSResponse response, String version) throws OWSException
os
- output stream to write toresponse
- OWS response objectversion
- version of writer to useOWSException
public void writeXMLResponse(OutputStream os, OWSResponse response) throws OWSException
os
- output stream to write toresponse
- OWS response objectOWSException
public void writeXMLResponse(OutputStream os, OWSResponse response, String version, String soapVersion) throws OWSException
os
- output stream to write toresponse
- OWS response objectversion
- version of writer to usesoapVersion
- version of SOAP used to wrap the response (SOAP11_URI
or SOAP12_URI
).
If null, response is sent as-is without envelopeOWSException
public void writeXMLException(OutputStream os, String serviceType, String version, OWSException e)
os
- output stream to write toserviceType
- type of OGC service generating the exceptionversion
- version of exception report to writee
- OWS exception to writepublic <ResponseType extends OWSResponse> ResponseType sendRequest(OWSRequest request, boolean useSoap) throws OWSException
request
- OWS request object to senduseSoap
- set to true to wrap the POST request into a SOAP envelopeOWSException
- if service returns an OWS exception report or an HTTP errorpublic HttpURLConnection sendGetRequest(OWSRequest request) throws OWSException
request
- OWS request objectOWSException
- if service returns an OWS exception report or an HTTP errorpublic HttpURLConnection sendPostRequest(OWSRequest request) throws OWSException
request
- OWS request object to sendOWSException
- if service returns an OWS exception report or an HTTP errorpublic HttpURLConnection sendPostRequestWithQuery(OWSRequest request) throws OWSException
request
- OWS request object to sendOWSException
- if there is an error serializing or sending the requestpublic HttpURLConnection sendSoapRequest(OWSRequest request) throws OWSException
request
- OWS request object to sendOWSException
- if service returns an OWS exception report or an HTTP errorpublic OWSServiceCapabilities readCapabilities(DOMHelper dom, Element capsElt, String serviceType) throws OWSException
dom
- DOM helper instance to use to parse the DOM treecapsElt
- root of the capabilities documentserviceType
- type of service to read capabilities fromOWSException
public OWSServiceCapabilities getCapabilities(String server, String serviceType, String version) throws OWSException
server
- URL of server to get capabilities from (without getCapabilities query arguments)serviceType
- type of service the request will be sent toversion
- version of service the request will be sent toOWSException
Copyright © 2016 Sensia Software LLC. All rights reserved.