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 StringEXCEPTION_XMLRepresents OGC Exception MIME typesprotected Map<String,Object>hintsprotected URLonlineResourceprotected Propertiesproperties
-
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 URLgetFinalURL()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.StringgetPostContentType()Default POST content type is xmlPropertiesgetProperties()Map<String,Object>getRequestHints()Returns the request hintsprotected abstract voidinitRequest()protected abstract voidinitService()Implementing subclass requests must specify their own "SERVICE" value.protected abstract voidinitVersion()Sets up the version number for this request.voidperformPostOutput(OutputStream outputStream)Default to not requiring POST.protected StringprocessKey(String key)Some Open Web Servers do not abide by the fact that parameter keys should be case insensitive.booleanrequiresPost()Default to not requiring POST.voidsetProperty(String name, String value)Sets the name/value property for this request.voidsetRequestHints(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:RequestOnce 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:
getFinalURLin 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:RequestSets 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
valueaccording 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:
setPropertyin interfaceRequest- Parameters:
name- the name of the propertyvalue- the value of the property
-
getProperties
public Properties getProperties()
- Specified by:
getPropertiesin 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:
getPostContentTypein 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:
performPostOutputin interfaceRequest- Throws:
IOException
-
requiresPost
public boolean requiresPost()
Default to not requiring POST. Implementors can override if they need to.- Specified by:
requiresPostin interfaceRequest- Returns:
- true if this request needs POST support, false otherwise.
-
getRequestHints
public Map<String,Object> getRequestHints()
Description copied from interface:RequestReturns the request hints- Specified by:
getRequestHintsin interfaceRequest
-
-