Class HttpWebRequest
- java.lang.Object
-
- microsoft.exchange.webservices.data.core.request.HttpWebRequest
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
HttpClientWebRequest
public abstract class HttpWebRequest extends Object implements Closeable
The Class HttpWebRequest.
-
-
Constructor Summary
Constructors Constructor Description HttpWebRequest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclose()Close.abstract intexecuteRequest()Executes Request by sending request xml data to server.StringgetAccept()Gets the accept.abstract StringgetContentEncoding()Gets the content encoding.StringgetContentType()Gets the content type.StringgetDomain()Gets the domain.abstract InputStreamgetErrorStream()Gets the error stream.Map<String,String>getHeaders()Gets the Headers.abstract InputStreamgetInputStream()Gets the input stream.abstract OutputStreamgetOutputStream()Gets the output stream.StringgetPassword()Gets the password.WebProxygetProxy()Gets the Web Proxy.StringgetRequestMethod()Gets the request method type.abstract Map<String,String>getRequestProperty()Gets the request property.abstract intgetResponseCode()Gets the response code.abstract StringgetResponseContentType()Gets the response content type.abstract StringgetResponseHeaderField(String headerName)Gets the response header field.abstract Map<String,String>getResponseHeaders()Gets the response headers.abstract StringgetResponseText()Gets the response message.intgetTimeout()Gets the timeout.URLgetUrl()Gets the url.StringgetUserAgent()Gets the user agent.StringgetUsername()Gets the user name.booleanisAcceptGzipEncoding()Checks if is accept gzip encoding.booleanisAllowAuthentication()Whether web service authentication is allowed.booleanisAllowAutoRedirect()Checks if is allow auto redirect.booleanisHttpScheme()Checks if is http scheme.booleanisHttpsScheme()Checks if is https scheme.booleanisKeepAlive()Checks if is keep alive.booleanisPreAuthenticate()Whether to use preemptive authentication.booleanisUseDefaultCredentials()Checks if is use default credential.abstract voidprepareConnection()Prepare connection.voidsetAccept(String accept)Sets the accept.voidsetAcceptGzipEncoding(boolean acceptGzipEncoding)Sets the accept gzip encoding.voidsetAllowAuthentication(boolean allowAuthentication)Whether web service authentication is allowed.voidsetAllowAutoRedirect(boolean allowAutoRedirect)Sets the allow auto redirect.voidsetContentType(String contentType)Sets the content type.voidsetCredentials(String domain, String user, String pwd)Sets the credential.voidsetDomain(String domain)Sets the domain.voidsetHeaders(Map<String,String> headers)Sets the Headers.voidsetKeepAlive(boolean keepAlive)Sets the keep alive.voidsetPassword(String password)Sets the password.voidsetPreAuthenticate(boolean preAuthenticate)Whether to use preemptive authentication.voidsetProxy(WebProxy proxy)Sets the Web Proxy.voidsetRequestMethod(String requestMethod)Sets the request method type.voidsetTimeout(int timeout)Sets the timeout.voidsetUrl(URL url)Sets the url.voidsetUseDefaultCredentials(boolean useDefaultCredentials)Sets the use default credential.voidsetUserAgent(String userAgent)Sets the user agent.voidsetUsername(String username)Sets the user name.
-
-
-
Constructor Detail
-
HttpWebRequest
public HttpWebRequest()
-
-
Method Detail
-
setProxy
public void setProxy(WebProxy proxy)
Sets the Web Proxy.- Parameters:
proxy- The Web Proxy
-
isHttpScheme
public boolean isHttpScheme()
Checks if is http scheme.- Returns:
- true, if is http scheme
-
isHttpsScheme
public boolean isHttpsScheme()
Checks if is https scheme.- Returns:
- true, if is https scheme
-
getUsername
public String getUsername()
Gets the user name.- Returns:
- the user name
-
setUsername
public void setUsername(String username)
Sets the user name.- Parameters:
username- the new user name
-
getPassword
public String getPassword()
Gets the password.- Returns:
- the password
-
setPassword
public void setPassword(String password)
Sets the password.- Parameters:
password- the new password
-
setDomain
public void setDomain(String domain)
Sets the domain.- Parameters:
domain- the new domain
-
isPreAuthenticate
public boolean isPreAuthenticate()
Whether to use preemptive authentication. Currently not implemented, though.
-
setPreAuthenticate
public void setPreAuthenticate(boolean preAuthenticate)
Whether to use preemptive authentication. Currently not implemented, though.
-
getTimeout
public int getTimeout()
Gets the timeout.- Returns:
- the timeout
-
setTimeout
public void setTimeout(int timeout)
Sets the timeout.- Parameters:
timeout- the new timeout
-
getContentType
public String getContentType()
Gets the content type.- Returns:
- the content type
-
setContentType
public void setContentType(String contentType)
Sets the content type.- Parameters:
contentType- the new content type
-
setAccept
public void setAccept(String accept)
Sets the accept.- Parameters:
accept- the new accept
-
getUserAgent
public String getUserAgent()
Gets the user agent.- Returns:
- the user agent
-
setUserAgent
public void setUserAgent(String userAgent)
Sets the user agent.- Parameters:
userAgent- the new user agent
-
isAllowAutoRedirect
public boolean isAllowAutoRedirect()
Checks if is allow auto redirect.- Returns:
- true, if is allow auto redirect
-
setAllowAutoRedirect
public void setAllowAutoRedirect(boolean allowAutoRedirect)
Sets the allow auto redirect.- Parameters:
allowAutoRedirect- the new allow auto redirect
-
isKeepAlive
public boolean isKeepAlive()
Checks if is keep alive.- Returns:
- true, if is keep alive
-
setKeepAlive
public void setKeepAlive(boolean keepAlive)
Sets the keep alive.- Parameters:
keepAlive- the new keep alive
-
isAcceptGzipEncoding
public boolean isAcceptGzipEncoding()
Checks if is accept gzip encoding.- Returns:
- true, if is accept gzip encoding
-
setAcceptGzipEncoding
public void setAcceptGzipEncoding(boolean acceptGzipEncoding)
Sets the accept gzip encoding.- Parameters:
acceptGzipEncoding- the new accept gzip encoding
-
isUseDefaultCredentials
public boolean isUseDefaultCredentials()
Checks if is use default credential.- Returns:
- true, if is use default credential
-
setUseDefaultCredentials
public void setUseDefaultCredentials(boolean useDefaultCredentials)
Sets the use default credential.- Parameters:
useDefaultCredentials- the new use default credential
-
isAllowAuthentication
public boolean isAllowAuthentication()
Whether web service authentication is allowed. This can be set tofalseto disallow sending credential with this request. This is useful for the autodiscover request to the legacy HTTP url, because this single request doesn't require authentication and we don't want to send credential over HTTP.- Returns:
trueif authentication is allowed.
-
setAllowAuthentication
public void setAllowAuthentication(boolean allowAuthentication)
Whether web service authentication is allowed. This can be set tofalseto disallow sending credential with this request. This is useful for the autodiscover request to the legacy HTTP url, because this single request doesn't require authentication and we don't want to send credential over HTTP. Default istrue.- Parameters:
allowAuthentication-trueif authentication is allowed.
-
getRequestMethod
public String getRequestMethod()
Gets the request method type.- Returns:
- the request method type.
-
setRequestMethod
public void setRequestMethod(String requestMethod)
Sets the request method type.- Parameters:
requestMethod- the request method type.
-
getHeaders
public Map<String,String> getHeaders()
Gets the Headers.- Returns:
- the content type
-
setHeaders
public void setHeaders(Map<String,String> headers)
Sets the Headers.- Parameters:
headers- The headers
-
setCredentials
public void setCredentials(String domain, String user, String pwd)
Sets the credential.- Parameters:
domain- user domainuser- user namepwd- password
-
getInputStream
public abstract InputStream getInputStream() throws EWSHttpException, IOException
Gets the input stream.- Returns:
- the input stream
- Throws:
EWSHttpException- the eWS http exceptionIOException- the IO exception
-
getErrorStream
public abstract InputStream getErrorStream() throws EWSHttpException
Gets the error stream.- Returns:
- the error stream
- Throws:
EWSHttpException- the eWS http exception
-
getOutputStream
public abstract OutputStream getOutputStream() throws EWSHttpException
Gets the output stream.- Returns:
- the output stream
- Throws:
EWSHttpException- the eWS http exception
-
close
public abstract void close() throws IOException
Close.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
prepareConnection
public abstract void prepareConnection()
Prepare connection.
-
getResponseHeaders
public abstract Map<String,String> getResponseHeaders() throws EWSHttpException
Gets the response headers.- Returns:
- the response headers
- Throws:
EWSHttpException- the eWS http exception
-
getContentEncoding
public abstract String getContentEncoding() throws EWSHttpException
Gets the content encoding.- Returns:
- the content encoding
- Throws:
EWSHttpException- the EWS http exception
-
getResponseContentType
public abstract String getResponseContentType() throws EWSHttpException
Gets the response content type.- Returns:
- the response content type
- Throws:
EWSHttpException- the EWS http exception
-
getResponseCode
public abstract int getResponseCode() throws EWSHttpException
Gets the response code.- Returns:
- the response code
- Throws:
EWSHttpException- the EWS http exception
-
getResponseText
public abstract String getResponseText() throws EWSHttpException
Gets the response message.- Returns:
- the response message
- Throws:
EWSHttpException- the EWS http exception
-
getResponseHeaderField
public abstract String getResponseHeaderField(String headerName) throws EWSHttpException
Gets the response header field.- Parameters:
headerName- the header name- Returns:
- the response header field
- Throws:
EWSHttpException- the EWS http exception
-
getRequestProperty
public abstract Map<String,String> getRequestProperty() throws EWSHttpException
Gets the request property.- Returns:
- the request property
- Throws:
EWSHttpException- the EWS http exception
-
executeRequest
public abstract int executeRequest() throws EWSHttpException, IOException
Executes Request by sending request xml data to server.- Throws:
EWSHttpException- the EWS http exceptionIOException- the IO Exception
-
-