Package org.geotools.xsd.impl
Class HTTPURIHandler
- Object
-
- URIHandlerImpl
-
- HTTPURIHandler
-
- All Implemented Interfaces:
URIHandler
public class HTTPURIHandler extends URIHandlerImplA URI handler that handles HTTP connections with connection timeouts and read timeouts. The default timeouts are 10 seconds, they can be set interactively on an instance of theHTTPURIHandler, and default values can be overridden setting theorg.geotools.xsd.http.connection.timeoutandorg.geotools.xsd.http.read.timeoutsystem variables.- Author:
- Andrea Aime - GeoSolutions
-
-
Constructor Summary
Constructors Constructor Description HTTPURIHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanHandle(URI uri)InputStreamcreateInputStream(URI uri, Map<?,?> options)Creates an input stream for the URI, assuming it's a URL, and returns it.protected HttpURLConnectiongetConnection(URI uri)intgetConnectionTimeout()The current connection timeoutintgetReadTimeout()The current read timeoutvoidsetConnectionTimeout(int connectionTimeout)Sets the connection timeout, in milliseconds.voidsetReadTimeout(int readTimeout)Sets the read timeout, in milliseconds.
-
-
-
Method Detail
-
canHandle
public boolean canHandle(URI uri)
- Specified by:
canHandlein interfaceURIHandler- Overrides:
canHandlein classURIHandlerImpl
-
createInputStream
public InputStream createInputStream(URI uri, Map<?,?> options) throws IOException
Creates an input stream for the URI, assuming it's a URL, and returns it.- Specified by:
createInputStreamin interfaceURIHandler- Overrides:
createInputStreamin classURIHandlerImpl- Returns:
- an open input stream.
- Throws:
IOException- if there is a problem obtaining an open input stream.
-
getConnection
protected HttpURLConnection getConnection(URI uri) throws IOException
- Throws:
IOException
-
getConnectionTimeout
public int getConnectionTimeout()
The current connection timeout
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
Sets the connection timeout, in milliseconds. SeeURLConnection.setConnectTimeout(int)
-
getReadTimeout
public int getReadTimeout()
The current read timeout
-
setReadTimeout
public void setReadTimeout(int readTimeout)
Sets the read timeout, in milliseconds. SeeURLConnection.setReadTimeout(int)
-
-