/* Try to pipe the resulting stream into a GZipInputStream */
if (inS != null)
inS = pipeStream(inS, method);
} catch (IOException e) {
throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
}
/* In case authentication required / failed */
if (method.getStatusCode() == HTTP_ERROR_AUTH_REQUIRED) {
AuthState hostAuthState = method.getHostAuthState();
throw new AuthenticationRequiredException(hostAuthState != null ? hostAuthState.getRealm() : null, Activator.getDefault().createErrorStatus(Messages.DefaultProtocolHandler_ERROR_AUTHENTICATION_REQUIRED, null));
}
/* In case proxy-authentication required / failed */
if (method.getStatusCode() == HTTP_ERROR_PROXY_AUTH_REQUIRED)
throw new ProxyAuthenticationRequiredException(Activator.getDefault().createErrorStatus(Messages.DefaultProtocolHandler_ERROR_PROXY_AUTHENTICATION_REQUIRED, null));
/* If status code is 4xx, throw an IOException with the status code included */
if (method.getStatusCode() >= HTTP_ERRORS) {
String error = getError(method.getStatusCode());
if (error != null)
throw new ConnectionException(Activator.getDefault().createErrorStatus(NLS.bind(Messages.DefaultProtocolHandler_ERROR_HTTP_STATUS_MSG, String.valueOf(method.getStatusCode()), error), null));
throw new ConnectionException(Activator.getDefault().createErrorStatus(NLS.bind(Messages.DefaultProtocolHandler_ERROR_HTTP_STATUS, String.valueOf(method.getStatusCode())), null));
}
/* In case the Feed has not been modified since */
if (method.getStatusCode() == HTTP_STATUS_NOT_MODIFIED)
throw new NotModifiedException(Activator.getDefault().createInfoStatus(Messages.DefaultProtocolHandler_INFO_NOT_MODIFIED_SINCE, null));
/* In case response body is not available */
if (inS == null)
throw new ConnectionException(Activator.getDefault().createErrorStatus(Messages.DefaultProtocolHandler_ERROR_STREAM_UNAVAILABLE, null));
/* Check wether a Progress Monitor is provided to support early cancelation */
IProgressMonitor monitor = null;
if (properties != null && properties.containsKey(IConnectionPropertyConstants.PROGRESS_MONITOR))
monitor = (IProgressMonitor) properties.get(IConnectionPropertyConstants.PROGRESS_MONITOR);