org.geotools.data.wfs.protocol.http
Class AbstractHttpProtocol

java.lang.Object
  extended by org.geotools.data.wfs.protocol.http.AbstractHttpProtocol
All Implemented Interfaces:
HTTPProtocol
Direct Known Subclasses:
DefaultHTTPProtocol, SimpleHttpProtocol

public abstract class AbstractHttpProtocol
extends java.lang.Object
implements HTTPProtocol

Base class for HTTPProtocol implementations that provides the basic property accessors and a good implementation for the URL factory helper method createUrl(URL, Map)

Since:
2.6
Version:
$Id: AbstractHttpProtocol.java 35134 2010-03-29 14:25:33Z groldan $
Author:
Gabriel Roldan (OpenGeo)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.geotools.data.wfs.protocol.http.HTTPProtocol
HTTPProtocol.POSTCallBack
 
Field Summary
protected  java.lang.String authPassword
           
protected  java.lang.String authUsername
           
protected static java.util.logging.Logger LOGGER
           
protected  int timeoutMillis
           
 
Constructor Summary
AbstractHttpProtocol()
           
 
Method Summary
protected  java.lang.String createUri(java.net.URL baseUrl, java.util.Map<java.lang.String,java.lang.String> queryStringKvp)
           
 java.net.URL createUrl(java.net.URL baseUrl, java.util.Map<java.lang.String,java.lang.String> queryStringKvp)
          Creates an URL with baseUrl and a query string defined by the kvp key/value pair of parameters.
 int getTimeoutMillis()
          Returns the request timeout in milliseconds, defaults to -1 meaning no timeout
 boolean isTryGzip()
          Returns whether gzip encoding is attempted when interacting with the HTTP server; default is false
 void setAuth(java.lang.String username, java.lang.String password)
          Sets the HTTP authentication realms (not required/used so far, but intended to be)
 void setTimeoutMillis(int milliseconds)
          Sets the request timeout in milliseconds.
 void setTryGzip(boolean tryGzip)
          Sets whether the server should be asked to return responses encoded in GZIP.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.data.wfs.protocol.http.HTTPProtocol
issueGet, issuePost
 

Field Detail

LOGGER

protected static final java.util.logging.Logger LOGGER

authUsername

protected java.lang.String authUsername

authPassword

protected java.lang.String authPassword

timeoutMillis

protected int timeoutMillis
Constructor Detail

AbstractHttpProtocol

public AbstractHttpProtocol()
Method Detail

isTryGzip

public boolean isTryGzip()
Description copied from interface: HTTPProtocol
Returns whether gzip encoding is attempted when interacting with the HTTP server; default is false

Specified by:
isTryGzip in interface HTTPProtocol
Returns:
true if gzip is being attempted.
See Also:
HTTPProtocol.isTryGzip()

setTryGzip

public void setTryGzip(boolean tryGzip)
Description copied from interface: HTTPProtocol
Sets whether the server should be asked to return responses encoded in GZIP.

Specified by:
setTryGzip in interface HTTPProtocol
Parameters:
tryGzip - true to ask the server to encode responses in GZIP.
See Also:
HTTPProtocol.setTryGzip(boolean)

setAuth

public void setAuth(java.lang.String username,
                    java.lang.String password)
Description copied from interface: HTTPProtocol
Sets the HTTP authentication realms (not required/used so far, but intended to be)

Specified by:
setAuth in interface HTTPProtocol
See Also:
HTTPProtocol.setAuth(String, String)

getTimeoutMillis

public int getTimeoutMillis()
Description copied from interface: HTTPProtocol
Returns the request timeout in milliseconds, defaults to -1 meaning no timeout

Specified by:
getTimeoutMillis in interface HTTPProtocol
Returns:
See Also:
HTTPProtocol#

setTimeoutMillis

public void setTimeoutMillis(int milliseconds)
Description copied from interface: HTTPProtocol
Sets the request timeout in milliseconds.

Specified by:
setTimeoutMillis in interface HTTPProtocol
See Also:
HTTPProtocol.setTimeoutMillis(int)

createUrl

public java.net.URL createUrl(java.net.URL baseUrl,
                              java.util.Map<java.lang.String,java.lang.String> queryStringKvp)
                       throws java.net.MalformedURLException
Description copied from interface: HTTPProtocol
Creates an URL with baseUrl and a query string defined by the kvp key/value pair of parameters.

If the base url query is not empty and already contains a parameter named as one of the parameters in kvp, the original parameter value in the baseUrl query is overriden by the one in the kvp map. For this purpose, the parameter name matching comparison is made case insensitively.

Specified by:
createUrl in interface HTTPProtocol
Parameters:
baseUrl - the original URL to create the new one from
Returns:
the new URL with baseUrl and the query string from queryStringKvp
Throws:
java.net.MalformedURLException - if the resulting URL is not valid
See Also:
HTTPProtocol.createUrl(URL, Map)

createUri

protected java.lang.String createUri(java.net.URL baseUrl,
                                     java.util.Map<java.lang.String,java.lang.String> queryStringKvp)


Copyright © 1996-2010 Geotools. All Rights Reserved.