public abstract class ExchangeServiceBase extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.http.impl.client.CloseableHttpClient |
httpClient |
protected org.apache.http.client.protocol.HttpClientContext |
httpContext |
protected org.apache.http.impl.client.CloseableHttpClient |
httpPoolingClient |
| Modifier | Constructor and Description |
|---|---|
protected |
ExchangeServiceBase()
Initializes a new instance.
|
protected |
ExchangeServiceBase(ExchangeServiceBase service,
ExchangeVersion requestedServerVersion) |
protected |
ExchangeServiceBase(ExchangeVersion requestedServerVersion) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkURIPath(String location) |
void |
close() |
String |
convertDateTimeToUniversalDateTimeString(Date dt)
Converts the date time to universal date time string.
|
protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> |
createConnectionSocketFactoryRegistry()
Create registry with configured
ConnectionSocketFactory instances. |
void |
doOnSerializeCustomSoapHeaders(XMLStreamWriter writer)
Calls the custom SOAP header serialisation event handlers, if defined.
|
boolean |
getAcceptGzipEncoding()
Gets a value indicating whether GZip compression encoding should be
accepted.
|
ExchangeCredentials |
getCredentials()
Gets the credential used to authenticate with the Exchange Web Services.
|
Map<String,String> |
getHttpHeaders()
Gets a collection of HTTP headers that will be sent with each request to
EWS.
|
Map<String,String> |
getHttpResponseHeaders()
Gets a collection of HTTP headers from the last response.
|
List<ICustomXmlSerialization> |
getOnSerializeCustomSoapHeaders()
Gets the on serialize custom soap headers.
|
ExchangeVersion |
getRequestedServerVersion()
Gets the requested server version.
|
ExchangeServerInfo |
getServerInfo()
Gets information associated with the server that processed the last
request.
|
static byte[] |
getSessionKey()
Gets the session key.
|
int |
getTimeout()
Gets the timeout used when sending HTTP request and when receiving HTTP
response, in milliseconds.
|
EnumSet<TraceFlags> |
getTraceFlags()
Gets the trace flags.
|
ITraceListener |
getTraceListener()
Gets the trace listener.
|
boolean |
getUseDefaultCredentials()
Gets a value indicating whether the credential of the user currently
logged into Windows should be used to authenticate with the Exchange Web
Services.
|
String |
getUserAgent()
Gets the user agent.
|
WebProxy |
getWebProxy()
Gets the web proxy that should be used when sending request to EWS.
|
protected void |
internalProcessHttpErrorResponse(HttpWebRequest httpWebResponse,
Exception webException,
TraceFlags responseHeadersTraceFlag,
TraceFlags responseTraceFlag)
This method doesn't handle 500 ISE errors.
|
boolean |
isPreAuthenticate()
Gets a value that indicates whether HTTP pre-authentication should be
performed.
|
boolean |
isTraceEnabled()
Gets a value indicating whether tracing is enabled.
|
boolean |
isTraceEnabledFor(TraceFlags traceFlags)
Determines whether tracing is enabled for specified trace flag(s).
|
protected void |
prepareCredentials(HttpWebRequest request) |
protected HttpWebRequest |
prepareHttpPoolingWebRequestForUrl(URI url,
boolean acceptGzipEncoding,
boolean allowAutoRedirect)
Creates an HttpWebRequest instance from a pooling connection manager and initialises it with
the appropriate parameters, based on the configuration of this service object.
|
protected HttpWebRequest |
prepareHttpWebRequestForUrl(URI url,
boolean acceptGzipEncoding,
boolean allowAutoRedirect)
Creates an HttpWebRequest instance and initialises it with the
appropriate parameters, based on the configuration of this service
object.
|
protected abstract void |
processHttpErrorResponse(HttpWebRequest httpWebResponse,
Exception webException) |
void |
processHttpResponseHeaders(TraceFlags traceType,
HttpWebRequest request)
Traces the HTTP response headers.
|
void |
setAcceptGzipEncoding(boolean acceptGzipEncoding)
Gets a value indicating whether GZip compression encoding should
be accepted.
|
void |
setCredentials(ExchangeCredentials credentials)
Sets the credential used to authenticate with the Exchange Web Services.
|
protected void |
setCustomUserAgent(String userAgent)
Sets the user agent to a custom value
|
void |
setMaximumPoolingConnections(int maximumPoolingConnections)
Sets the maximum number of connections for the pooling connection manager which is used for
subscriptions.
|
void |
setOnSerializeCustomSoapHeaders(List<ICustomXmlSerialization> onSerializeCustomSoapHeaders)
Sets the on serialize custom soap headers.
|
void |
setPreAuthenticate(boolean preAuthenticate)
Sets a value that indicates whether HTTP pre-authentication should be
performed.
|
void |
setServerInfo(ExchangeServerInfo serverInfo)
Sets information associated with the server that processed the last
request.
|
void |
setTimeout(int timeout)
Sets the timeout used when sending HTTP request and when receiving HTTP
respones, in milliseconds.
|
void |
setTraceEnabled(boolean traceEnabled)
Sets a value indicating whether tracing is enabled.
|
void |
setTraceFlags(EnumSet<TraceFlags> traceFlags)
Sets the trace flags.
|
void |
setTraceListener(ITraceListener traceListener)
Sets the trace listener.
|
void |
setUseDefaultCredentials(boolean value)
Sets a value indicating whether the credential of the user currently
logged into Windows should be used to authenticate with the Exchange Web
Services.
|
void |
setUserAgent(String userAgent)
Sets the user agent.
|
void |
setWebProxy(WebProxy value)
Sets the web proxy that should be used when sending request to EWS.
|
void |
traceHttpRequestHeaders(TraceFlags traceType,
HttpWebRequest request)
Traces the HTTP request headers.
|
void |
traceMessage(TraceFlags traceType,
String logEntry)
Logs the specified string to the TraceListener if tracing is enabled.
|
void |
traceXml(TraceFlags traceType,
ByteArrayOutputStream stream)
Logs the specified XML to the TraceListener if tracing is enabled.
|
void |
validate()
Validates this instance.
|
protected org.apache.http.impl.client.CloseableHttpClient httpClient
protected org.apache.http.client.protocol.HttpClientContext httpContext
protected org.apache.http.impl.client.CloseableHttpClient httpPoolingClient
protected ExchangeServiceBase()
protected ExchangeServiceBase(ExchangeVersion requestedServerVersion)
protected ExchangeServiceBase(ExchangeServiceBase service, ExchangeVersion requestedServerVersion)
public void setMaximumPoolingConnections(int maximumPoolingConnections)
Default is 10.
maximumPoolingConnections - Maximum number of pooling connectionsprotected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> createConnectionSocketFactoryRegistry()
ConnectionSocketFactory instances.
Override this method to change how to work with different schemas.public void close()
close in interface Closeableclose in interface AutoCloseablepublic void doOnSerializeCustomSoapHeaders(XMLStreamWriter writer)
writer - The XmlWriter to which to write the custom SOAP headers.protected HttpWebRequest prepareHttpWebRequestForUrl(URI url, boolean acceptGzipEncoding, boolean allowAutoRedirect) throws ServiceLocalException, URISyntaxException
url - The URL that the HttpWebRequest should target.acceptGzipEncoding - If true, ask server for GZip compressed content.allowAutoRedirect - If true, redirection response will be automatically followed.ServiceLocalException - the service local exceptionURISyntaxException - the uRI syntax exceptionprotected HttpWebRequest prepareHttpPoolingWebRequestForUrl(URI url, boolean acceptGzipEncoding, boolean allowAutoRedirect) throws ServiceLocalException, URISyntaxException
This is used for subscriptions.
url - The URL that the HttpWebRequest should target.acceptGzipEncoding - If true, ask server for GZip compressed content.allowAutoRedirect - If true, redirection response will be automatically followed.ServiceLocalException - the service local exceptionURISyntaxException - the uRI syntax exceptionprotected void prepareCredentials(HttpWebRequest request) throws ServiceLocalException, URISyntaxException
protected void internalProcessHttpErrorResponse(HttpWebRequest httpWebResponse, Exception webException, TraceFlags responseHeadersTraceFlag, TraceFlags responseTraceFlag) throws Exception
httpWebResponse - HTTP web responsewebException - web exceptionresponseHeadersTraceFlag - trace flag for response headersresponseTraceFlag - trace flag for responeException - on errorpublic static boolean checkURIPath(String location)
location - file pathprotected abstract void processHttpErrorResponse(HttpWebRequest httpWebResponse, Exception webException) throws Exception
httpWebResponse - HTTP web responsewebException - web exceptionException - on errorpublic boolean isTraceEnabledFor(TraceFlags traceFlags)
traceFlags - The trace flags.public void traceMessage(TraceFlags traceType, String logEntry) throws XMLStreamException, IOException
traceType - kind of trace entrylogEntry - the entry to logXMLStreamException - the XML stream exceptionIOException - signals that an I/O exception has occurredpublic void traceXml(TraceFlags traceType, ByteArrayOutputStream stream)
traceType - Kind of trace entry.stream - The stream containing XML.public void traceHttpRequestHeaders(TraceFlags traceType, HttpWebRequest request) throws URISyntaxException, EWSHttpException, XMLStreamException, IOException
traceType - Kind of trace entry.request - The requestEWSHttpException - EWS http exceptionURISyntaxException - URI syntax errorIOException - signals that an I/O exception has occurredXMLStreamException - the XML stream exceptionpublic String convertDateTimeToUniversalDateTimeString(Date dt)
dt - the dateprotected void setCustomUserAgent(String userAgent)
userAgent - User agent string to set on the servicepublic void validate() throws ServiceLocalException
ServiceLocalException - the service local exceptionpublic boolean isTraceEnabled()
public void setTraceEnabled(boolean traceEnabled)
traceEnabled - true to enable tracingpublic EnumSet<TraceFlags> getTraceFlags()
public void setTraceFlags(EnumSet<TraceFlags> traceFlags)
traceFlags - A set of trace flagspublic ITraceListener getTraceListener()
public void setTraceListener(ITraceListener traceListener)
traceListener - the trace listener.public ExchangeCredentials getCredentials()
public void setCredentials(ExchangeCredentials credentials)
credentials - Exchange credential.public boolean getUseDefaultCredentials()
public void setUseDefaultCredentials(boolean value)
value - the new use default credentialpublic int getTimeout()
public void setTimeout(int timeout)
timeout - timeout in millisecondspublic boolean isPreAuthenticate()
public void setPreAuthenticate(boolean preAuthenticate)
preAuthenticate - true to enable pre-authenticationpublic boolean getAcceptGzipEncoding()
public void setAcceptGzipEncoding(boolean acceptGzipEncoding)
acceptGzipEncoding - true to enable compressionpublic ExchangeVersion getRequestedServerVersion()
public String getUserAgent()
public void setUserAgent(String userAgent)
userAgent - The user agentpublic ExchangeServerInfo getServerInfo()
public void setServerInfo(ExchangeServerInfo serverInfo)
serverInfo - Server Informationpublic WebProxy getWebProxy()
public void setWebProxy(WebProxy value)
value - the Proxy Informationpublic Map<String,String> getHttpHeaders()
public List<ICustomXmlSerialization> getOnSerializeCustomSoapHeaders()
public void setOnSerializeCustomSoapHeaders(List<ICustomXmlSerialization> onSerializeCustomSoapHeaders)
onSerializeCustomSoapHeaders - the new on serialize custom soap headerspublic void processHttpResponseHeaders(TraceFlags traceType, HttpWebRequest request) throws XMLStreamException, IOException, EWSHttpException
traceType - kind of trace entryrequest - The requestEWSHttpException - EWS http exceptionIOException - signals that an I/O exception has occurredXMLStreamException - the XML stream exceptionpublic Map<String,String> getHttpResponseHeaders()
public static byte[] getSessionKey()
Copyright © 2012–2015 Microsoft. All rights reserved.