Class HTTPRequest
- java.lang.Object
-
- org.tmatesoft.svn.core.internal.io.dav.http.HTTPRequest
-
class HTTPRequest extends java.lang.Object- Version:
- 1.3
-
-
Field Summary
Fields Modifier and Type Field Description static char[]CRLFprivate java.lang.StringmyAuthenticationprivate java.lang.StringmyCharsetprivate HTTPConnectionmyConnectionprivate java.util.Map<java.lang.String,java.util.List<java.lang.String>>myCookieHeadersprivate SVNErrorMessagemyErrorMessageprivate booleanmyIsKeepAliveprivate booleanmyIsProxiedprivate booleanmyIsProxyAuthForcedprivate booleanmyIsSecuredprivate java.lang.StringmyProxyAuthenticationprivate byte[]myRequestBodyprivate java.io.InputStreammyRequestStreamprivate org.xml.sax.helpers.DefaultHandlermyResponseHandlerprivate HTTPHeadermyResponseHeaderprivate java.io.OutputStreammyResponseStreamprivate HTTPStatusmyStatusprivate longmyTimeout
-
Constructor Summary
Constructors Constructor Description HTTPRequest(java.lang.String charset)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringBuffercomposeHTTPHeader(java.lang.String request, java.lang.String path, HTTPHeader header, long length, boolean keepAlive)private java.lang.StringcomposeRequestURI(java.lang.String request, java.lang.String path)private static longcomputeTimeout(HTTPStatus status, HTTPHeader header)static SVNErrorMessagecreateDefaultErrorMessage(SVNURL host, java.lang.String path, HTTPStatus status, java.lang.String context, java.lang.Object[] contextObjects)voiddispatch(java.lang.String request, java.lang.String path, HTTPHeader header, int ok1, int ok2, SVNErrorMessage context)heart of http engine.SVNErrorMessagegetErrorMessage()longgetNextRequestTimeout()HTTPHeadergetResponseHeader()HTTPStatusgetStatus()voidinitCredentials(HTTPAuthentication authentication, java.lang.String method, java.lang.String path)private SVNErrorMessagereadError(java.lang.String request, java.lang.String path, SVNErrorMessage context)voidreset()voidsetAuthentication(java.lang.String auth)voidsetConnection(HTTPConnection connection)voidsetCookies(java.util.Map<java.lang.String,java.util.List<java.lang.String>> cookieHeader)voidsetForceProxyAuth(boolean force)voidsetKeepAlive(boolean isKeepAlive)voidsetProxied(boolean proxied)voidsetProxyAuthentication(java.lang.String auth)voidsetRequestBody(byte[] body)voidsetRequestBody(java.io.InputStream is)voidsetRequestBody(java.lang.StringBuffer sb)voidsetResponseHandler(org.xml.sax.helpers.DefaultHandler handler)voidsetResponseHeader(HTTPHeader header)voidsetResponseStream(java.io.OutputStream os)voidsetSecured(boolean secured)voidsetStatus(HTTPStatus status)
-
-
-
Field Detail
-
CRLF
public static final char[] CRLF
-
myIsSecured
private boolean myIsSecured
-
myIsProxied
private boolean myIsProxied
-
myConnection
private HTTPConnection myConnection
-
myAuthentication
private java.lang.String myAuthentication
-
myProxyAuthentication
private java.lang.String myProxyAuthentication
-
myResponseHeader
private HTTPHeader myResponseHeader
-
myStatus
private HTTPStatus myStatus
-
myErrorMessage
private SVNErrorMessage myErrorMessage
-
myResponseHandler
private org.xml.sax.helpers.DefaultHandler myResponseHandler
-
myResponseStream
private java.io.OutputStream myResponseStream
-
myRequestBody
private byte[] myRequestBody
-
myRequestStream
private java.io.InputStream myRequestStream
-
myIsProxyAuthForced
private boolean myIsProxyAuthForced
-
myIsKeepAlive
private boolean myIsKeepAlive
-
myCharset
private java.lang.String myCharset
-
myTimeout
private long myTimeout
-
myCookieHeaders
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> myCookieHeaders
-
-
Method Detail
-
reset
public void reset()
-
setProxied
public void setProxied(boolean proxied)
-
setSecured
public void setSecured(boolean secured)
-
setConnection
public void setConnection(HTTPConnection connection)
-
initCredentials
public void initCredentials(HTTPAuthentication authentication, java.lang.String method, java.lang.String path)
-
setAuthentication
public void setAuthentication(java.lang.String auth)
-
setProxyAuthentication
public void setProxyAuthentication(java.lang.String auth)
-
setForceProxyAuth
public void setForceProxyAuth(boolean force)
-
setResponseHandler
public void setResponseHandler(org.xml.sax.helpers.DefaultHandler handler)
-
setResponseStream
public void setResponseStream(java.io.OutputStream os)
-
setRequestBody
public void setRequestBody(byte[] body)
-
setRequestBody
public void setRequestBody(java.lang.StringBuffer sb)
-
setRequestBody
public void setRequestBody(java.io.InputStream is)
-
dispatch
public void dispatch(java.lang.String request, java.lang.String path, HTTPHeader header, int ok1, int ok2, SVNErrorMessage context) throws java.io.IOExceptionheart of http engine. features: // all this should be moved outside this method: - authentication callback to process 401 and 403 codes, failure results in returning error message. - another callback to process 301 and 302 codes, failure results in returning error message. - code that process ssl exceptions and re-prompts for client certificate when allowed. // auth error, ssl exception and "moved" errors should be processed by the caller. - code to send request body. - code to parse svn error response in case return code is not ok1 and ok2. - standard http error should be returned otherwise. - body may be resetable inputStream + length - IMeasurable. // this may throw IOException that will be converted to: timeout error, can't connect error, or ssl will re-prompt.- Throws:
java.io.IOException
-
computeTimeout
private static long computeTimeout(HTTPStatus status, HTTPHeader header)
-
readError
private SVNErrorMessage readError(java.lang.String request, java.lang.String path, SVNErrorMessage context)
-
getResponseHeader
public HTTPHeader getResponseHeader()
-
getNextRequestTimeout
public long getNextRequestTimeout()
-
getStatus
public HTTPStatus getStatus()
-
setStatus
public void setStatus(HTTPStatus status)
-
setResponseHeader
public void setResponseHeader(HTTPHeader header)
-
getErrorMessage
public SVNErrorMessage getErrorMessage()
-
composeHTTPHeader
private java.lang.StringBuffer composeHTTPHeader(java.lang.String request, java.lang.String path, HTTPHeader header, long length, boolean keepAlive)
-
composeRequestURI
private java.lang.String composeRequestURI(java.lang.String request, java.lang.String path)
-
createDefaultErrorMessage
public static SVNErrorMessage createDefaultErrorMessage(SVNURL host, java.lang.String path, HTTPStatus status, java.lang.String context, java.lang.Object[] contextObjects)
-
setKeepAlive
public void setKeepAlive(boolean isKeepAlive)
-
setCookies
public void setCookies(java.util.Map<java.lang.String,java.util.List<java.lang.String>> cookieHeader)
-
-