public class GZConnectionRequest
- Object
- ConnectionRequest
- GZConnectionRequest
ImplementsIOProgressListener
A connection request that can detect a GZipped response, parse it automatically and unzip it.
Notice that some devices (iOS) always request gzip’ed data and always decompress it for us, however in
the case of iOS it doesn’t remove the gziped header. The GZConnectionRequest is aware of such
behaviors so it’s better to use that when connecting to the network (if applicable).
By default GZConnectionRequest doesn’t request gzipped data (only unzips it when its received) but it’s
pretty easy to do so just add the HTTP header Accept-Encoding: gzip e.g.:
GZConnectionRequest con = new GZConnectionRequest();
con.addRequestHeader("Accept-Encoding", "gzip");
Constructors
public GZConnectionRequest() |
Methods
public boolean equals(Object o) | Indicates whether some other object is “equal to” this one. |
public int hashCode() | Returns a hash code value for the object. |
protected void readHeaders(Object connection)
throws IOException | Allows reading the headers from the connection by calling the getHeader() method. |
protected final void readResponse(InputStream input)
throws IOException | Overridden to convert the input stream you should now override readUnzipedResponse() |
protected void readUnzipedResponse(InputStream input)
throws IOException | This method can be overridden instead of readResponse |
Inherited nested types
Inherited fields
Inherited methods
From ConnectionRequest
getDefaultCacheMode, setDefaultCacheMode, isReadResponseForErrorsDefault, setReadResponseForErrorsDefault, isHandleErrorCodesInGlobalErrorHandler, setHandleErrorCodesInGlobalErrorHandler, getCookieHeader, setCookieHeader, isCookiesEnabledDefault, setCookiesEnabledDefault, isDefaultFollowRedirects, setDefaultFollowRedirects, isReadTimeoutSupported, purgeCacheDirectory, getDefaultUserAgent, setDefaultUserAgent, setUseNativeCookieStore, isNativeCookieSharingSupported, fetchJSON, fetchJSONAsync, getCacheMode, setCacheMode, isCheckSSLCertificates, setCheckSSLCertificates, isInsecure, setInsecure, getResponseData, getHttpMethod, setHttpMethod, addRequestHeader, removeRequestHeader, removeRequestHeaderIfUnchanged, checkSSLCertificates, getReadTimeout, setReadTimeout, initConnection, getCachedData, purgeCache, cacheUnmodified, cookieReceived, cookieSent, initCookieHeader, getResponseCode, getResposeCode, shouldConvertPostToGetOnRedirect, readErrorCodeHeaders, getHeader, getHeaders, getHeaderFieldNames, getYield, shouldAutoCloseResponse, handleIOException, handleRuntimeException, handleException, canGetSSLCertificates, getSSLCertificates, handleErrorResponseCode, retry, onRedirect, postResponse, createRequestURL, buildRequestBody, shouldWriteUTFAsGetBytes, kill, shouldStop, isPausable, pause, resume, isPost, setPost, addArgument, removeArgument, removeAllArguments, addArgumentNoEncoding, addArgumentNoEncoding, addArgumentNoEncodingArray, addArgument, addArgumentArray, addArgument, addArguments, getContentType, setContentType, isWriteRequest, setWriteRequest, isReadRequest, setReadRequest, isPaused, setPaused, isKilled, setKilled, getPriority, setPriority, getUserAgent, setUserAgent, isFollowRedirects, setFollowRedirects, getTimeout, setTimeout, getContentLength, ioStreamUpdate, getUrl, setUrl, addResponseListener, removeResponseListener, addResponseCodeListener, addExceptionListener, removeResponseCodeListener, removeExceptionListener, hasResponseListeners, fireResponseListener, isDuplicateSupported, setDuplicateSupported, validate, getDisposeOnCompletion, setDisposeOnCompletion, getShowOnInit, setShowOnInit, getSilentRetryCount, setSilentRetryCount, isFailSilently, setFailSilently, isReadResponseForErrors, setReadResponseForErrors, getResponseContentType, isRedirecting, getDestinationFile, setDestinationFile, getDestinationStorage, setDestinationStorage, isCookiesEnabled, setCookiesEnabled, setChunkedStreamingMode, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, getRequestBody, setRequestBody, setRequestBody, getRequestBodyData, getResponseErrorMessage
Constructor details
GZConnectionRequest
public GZConnectionRequest()Method details
equals
public boolean equals(Object o)hashCode
public int hashCode()readHeaders
protected void readHeaders(Object connection)
throws IOExceptionParameters
connectionObject- used when invoking getHeader
Throws
java.io.IOException- thrown on failure
readResponse
protected final void readResponse(InputStream input)
throws IOExceptionParameters
inputInputStream- the input stream containing the response
Throws
IOException- when a read input occurs
readUnzipedResponse
protected void readUnzipedResponse(InputStream input)
throws IOExceptionParameters
inputInputStream- an input stream that is guaranteed to be deflated