public class HttpHelper
extends java.lang.Object
Constructor and Description |
---|
HttpHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
configure(org.apache.commons.httpclient.HttpClient client,
org.apache.commons.httpclient.URI targetURI,
org.w3c.dom.Element authPart,
org.apache.commons.httpclient.params.HttpParams params) |
static int |
isFaultOrFailure(int s) |
static org.w3c.dom.Element |
prepareDetailsElement(org.apache.commons.httpclient.HttpMethod method)
Build a "details" element that looks like this:
|
static java.lang.String |
replaceCRLFwithLWS(java.lang.String header)
This method ensures that a header value containing CRLF does not mess up the HTTP request.
|
static java.lang.String |
requestToString(org.apache.commons.httpclient.HttpMethod m) |
static java.lang.String |
responseToString(org.apache.commons.httpclient.HttpMethod m) |
static org.w3c.dom.Element |
statusLineToElement(org.w3c.dom.Document doc,
org.apache.commons.httpclient.StatusLine statusLine)
Convert a HTTP status line into an xml element like this:
< Status-line>
< HTTP-Version>HTTP/1.1< /HTTP-Version>
< Status-Code>200< /Status-Code>
< Reason-Phrase>Success - The action was successfully received, understood, and accepted< /Reason-Phrase>
< /Status-line>
|
static org.w3c.dom.Element |
statusLineToElement(org.apache.commons.httpclient.StatusLine statusLine) |
static org.w3c.dom.Element |
statusLineToElement(java.lang.String statusLine)
Parse and convert a HTTP status line into an aml element.
|
public static void configure(org.apache.commons.httpclient.HttpClient client, org.apache.commons.httpclient.URI targetURI, org.w3c.dom.Element authPart, org.apache.commons.httpclient.params.HttpParams params) throws org.apache.commons.httpclient.URIException
org.apache.commons.httpclient.URIException
public static org.w3c.dom.Element statusLineToElement(java.lang.String statusLine) throws org.apache.commons.httpclient.HttpException
statusLine
- org.apache.commons.httpclient.HttpException
statusLineToElement(org.w3c.dom.Document, org.apache.commons.httpclient.StatusLine)
public static org.w3c.dom.Element statusLineToElement(org.apache.commons.httpclient.StatusLine statusLine)
public static org.w3c.dom.Element statusLineToElement(org.w3c.dom.Document doc, org.apache.commons.httpclient.StatusLine statusLine)
statusLine
- - the StatusLine
instance to be converteddoc
- - the document to use to create new nodespublic static org.w3c.dom.Element prepareDetailsElement(org.apache.commons.httpclient.HttpMethod method)
method
- java.io.IOException
public static java.lang.String replaceCRLFwithLWS(java.lang.String header)
HTTP/1.1 header field values can be folded onto multiple lines if the continuation line begins with a space or horizontal tab. All linear white space, including folding, has the same semantics as SP. A recipient MAY replace any linear white space with a single SP before interpreting the field value or forwarding the message downstream. LWS = [CRLF] 1*( SP | HT )FYI, HttpClient 3.x.x does not check this.
header
- public static java.lang.String requestToString(org.apache.commons.httpclient.HttpMethod m)
public static java.lang.String responseToString(org.apache.commons.httpclient.HttpMethod m)
public static int isFaultOrFailure(int s)
s,
- the status code to test, must be in [400, 600[