Class AbstractRequest
- Object
-
- AbstractRequest
-
- All Implemented Interfaces:
Request
- Direct Known Subclasses:
AbstractGetCapabilitiesRequest
,AbstractWMSRequest
,AbstractWMTSRequest
,WFSRequest
public abstract class AbstractRequest extends Object implements Request
A class that provides functionality for performing basic requests- Author:
- Richard Gould
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_XML
Represents OGC Exception MIME typesprotected Map<String,Object>
hints
protected URL
onlineResource
protected Properties
properties
-
Constructor Summary
Constructors Constructor Description AbstractRequest(URL onlineResource, Properties properties)
Creates an AbstractRequest.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description URL
getFinalURL()
Once the properties of the request are configured, this will return the URL that points to the server and contains all of the appropriate name/value parameters.String
getPostContentType()
Default POST content type is xmlProperties
getProperties()
Map<String,Object>
getRequestHints()
Returns the request hintsprotected abstract void
initRequest()
protected abstract void
initService()
Implementing subclass requests must specify their own "SERVICE" value.protected abstract void
initVersion()
Sets up the version number for this request.void
performPostOutput(OutputStream outputStream)
Default to not requiring POST.protected String
processKey(String key)
Some Open Web Servers do not abide by the fact that parameter keys should be case insensitive.boolean
requiresPost()
Default to not requiring POST.void
setProperty(String name, String value)
Sets the name/value property for this request.void
setRequestHints(Map<String,Object> hints)
Sets hints that might be driving how the request is performed-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface Request
createResponse
-
-
-
-
Field Detail
-
EXCEPTION_XML
public static final String EXCEPTION_XML
Represents OGC Exception MIME types- See Also:
- Constant Field Values
-
onlineResource
protected URL onlineResource
-
properties
protected Properties properties
-
-
Constructor Detail
-
AbstractRequest
public AbstractRequest(URL onlineResource, Properties properties)
Creates an AbstractRequest.If properties isn't
null
, it will use them instead of creating a new Properties object.This constructor will strip all the query parameters off of onlineResource and put them in the properties map. This allows clients to provide their own parameters and have them saved and used along with the OWS specific ones.
However, certain parameters will be over-written by individual requests themselves. Examples of such parameters include, but are not limited to:
- WMTVER
- REQUEST
- VERSION
- SERVICE
- Parameters:
onlineResource
- the URL to construct the Request forproperties
- a map of pre-set parameters to be used. Can be null.
-
-
Method Detail
-
getFinalURL
public URL getFinalURL()
Description copied from interface:Request
Once the properties of the request are configured, this will return the URL that points to the server and contains all of the appropriate name/value parameters.- Specified by:
getFinalURL
in interfaceRequest
- Returns:
- a URL that can be used to issue the request
- See Also:
org.geotools.data.wms.request.Request#getFinalURL()
-
processKey
protected String processKey(String key)
Some Open Web Servers do not abide by the fact that parameter keys should be case insensitive.This method will allow a specification to determine the way that the parameter keys should be encoded in requests made by the server.
- Parameters:
key
- the key to be processed- Returns:
- the key, after being processed. (made upper case, for example)
-
setProperty
public void setProperty(String name, String value)
Description copied from interface:Request
Sets the name/value property for this request.Note that when using this method, it is up to the programmer to provide their own encoding of
value
according to the OWS specifications! The code will not do this for you.Different OWS specifications define different ways to do this. There are notorious differences between WMS 1.1.1 (section 6.2.1) and WMS 1.3.0 (section 6.3.2) for example.
If value is null, "name" is removed from the properties table.
- Specified by:
setProperty
in interfaceRequest
- Parameters:
name
- the name of the propertyvalue
- the value of the property
-
getProperties
public Properties getProperties()
- Specified by:
getProperties
in interfaceRequest
- Returns:
- a copy of this request's properties
-
initRequest
protected abstract void initRequest()
-
initService
protected abstract void initService()
Implementing subclass requests must specify their own "SERVICE" value. Example: setProperty("SERVICE", "WFS");
-
initVersion
protected abstract void initVersion()
Sets up the version number for this request. Typically something like setProperty("VERSION", "1.1.1");
-
getPostContentType
public String getPostContentType()
Default POST content type is xml- Specified by:
getPostContentType
in interfaceRequest
- Returns:
- the MIME type of the data to be sent during the request
-
performPostOutput
public void performPostOutput(OutputStream outputStream) throws IOException
Default to not requiring POST. Implementors can override if they need to.- Specified by:
performPostOutput
in interfaceRequest
- Throws:
IOException
-
requiresPost
public boolean requiresPost()
Default to not requiring POST. Implementors can override if they need to.- Specified by:
requiresPost
in interfaceRequest
- Returns:
- true if this request needs POST support, false otherwise.
-
getRequestHints
public Map<String,Object> getRequestHints()
Description copied from interface:Request
Returns the request hints- Specified by:
getRequestHints
in interfaceRequest
-
-