Class URLConnectionEngine
- java.lang.Object
-
- org.jboss.resteasy.client.jaxrs.engines.URLConnectionEngine
-
- All Implemented Interfaces:
ClientHttpEngine
public class URLConnectionEngine extends Object implements ClientHttpEngine
- Version:
- $Revision: 1 $
- Author:
- Alexey Ogarkov
-
-
Field Summary
Fields Modifier and Type Field Description protected IntegerconnectTimeoutprotected booleanfollowRedirectsprotected HostnameVerifierhostnameVerifierprotected StringproxyHostprotected IntegerproxyPortprotected StringproxySchemeprotected IntegerreadTimeoutprotected SSLContextsslContext
-
Constructor Summary
Constructors Constructor Description URLConnectionEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidcommitHeaders(ClientInvocation request, HttpURLConnection connection)Add headers to HttpURLConnection from ClientInvocation.protected HttpURLConnectioncreateConnection(ClientInvocation request)Create HttpUrlConnection from ClientInvorcation and set request method.protected voidexecuteRequest(ClientInvocation request, HttpURLConnection connection)Execute request using HttpURLConnection with body from invocation if needed.protected javax.ws.rs.core.MultivaluedMap<String,String>getHeaders(HttpURLConnection connection)Create map with response headers.HostnameVerifiergetHostnameVerifier(){inheritDoc}SSLContextgetSslContext(){inheritDoc}javax.ws.rs.core.Responseinvoke(javax.ws.rs.client.Invocation inv)booleanisFollowRedirects()voidsetConnectTimeout(Integer connectTimeout)voidsetFollowRedirects(boolean followRedirects)voidsetHostnameVerifier(HostnameVerifier hostnameVerifier)voidsetProxyHost(String proxyHost)voidsetProxyPort(Integer proxyPort)voidsetProxyScheme(String proxyScheme)voidsetReadTimeout(Integer readTimeout)voidsetSslContext(SSLContext sslContext)
-
-
-
Field Detail
-
sslContext
protected SSLContext sslContext
-
hostnameVerifier
protected HostnameVerifier hostnameVerifier
-
readTimeout
protected Integer readTimeout
-
connectTimeout
protected Integer connectTimeout
-
proxyHost
protected String proxyHost
-
proxyPort
protected Integer proxyPort
-
proxyScheme
protected String proxyScheme
-
followRedirects
protected boolean followRedirects
-
-
Method Detail
-
invoke
public javax.ws.rs.core.Response invoke(javax.ws.rs.client.Invocation inv)
- Specified by:
invokein interfaceClientHttpEngine
-
getHeaders
protected javax.ws.rs.core.MultivaluedMap<String,String> getHeaders(HttpURLConnection connection)
Create map with response headers.- Parameters:
connection- - HttpURLConnection- Returns:
- map key - list of values
-
close
public void close()
- Specified by:
closein interfaceClientHttpEngine
-
createConnection
protected HttpURLConnection createConnection(ClientInvocation request) throws IOException
Create HttpUrlConnection from ClientInvorcation and set request method.- Parameters:
request- ClientInvocation- Returns:
- HttpURLConnection with method & url already set
- Throws:
IOException- if url or io exceptions
-
executeRequest
protected void executeRequest(ClientInvocation request, HttpURLConnection connection)
Execute request using HttpURLConnection with body from invocation if needed.- Parameters:
request- ClientInvocationconnection- HttpURLConnection
-
commitHeaders
protected void commitHeaders(ClientInvocation request, HttpURLConnection connection)
Add headers to HttpURLConnection from ClientInvocation. Should be executed before writing body.- Parameters:
request- ClientInvocationconnection- HttpURLConnection
-
getSslContext
public SSLContext getSslContext()
{inheritDoc}- Specified by:
getSslContextin interfaceClientHttpEngine- Returns:
SSLContext
-
getHostnameVerifier
public HostnameVerifier getHostnameVerifier()
{inheritDoc}- Specified by:
getHostnameVerifierin interfaceClientHttpEngine- Returns:
HostnameVerifier
-
setSslContext
public void setSslContext(SSLContext sslContext)
-
setHostnameVerifier
public void setHostnameVerifier(HostnameVerifier hostnameVerifier)
-
setConnectTimeout
public void setConnectTimeout(Integer connectTimeout)
-
setReadTimeout
public void setReadTimeout(Integer readTimeout)
-
setProxyHost
public void setProxyHost(String proxyHost)
-
setProxyPort
public void setProxyPort(Integer proxyPort)
-
setProxyScheme
public void setProxyScheme(String proxyScheme)
-
setFollowRedirects
public void setFollowRedirects(boolean followRedirects)
- Specified by:
setFollowRedirectsin interfaceClientHttpEngine
-
isFollowRedirects
public boolean isFollowRedirects()
- Specified by:
isFollowRedirectsin interfaceClientHttpEngine
-
-