: Class HttpFactory

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.www.http
Class HttpFactory

    java.lang.Object
      |
      +--org.w3c.www.http.HttpFactory

public class HttpFactory
extends java.lang.Object

Use this class to create pre-defined header values of various kind.

Constructor Summary
`HttpFactory()`

Method Summary
`static HttpAccept` | `makeAccept(MimeType type)` Create an `Accept` header clause.
`static HttpAccept` | `makeAccept(MimeType type, double quality)` Create an `Accept` header clause.
`static HttpAcceptCharset` | `makeAcceptCharset(java.lang.String charset)` Build an `Accept-Charset` header clause.
`static HttpAcceptCharset` | `makeAcceptCharset(java.lang.String charset, double quality)` Build an `Accept-Charset` header clause.
`static HttpAcceptCharsetList` | `makeAcceptCharsetList(HttpAcceptCharset[] charsets)` Build a list of accepted charset for the `Accept-Charset` header.
`static HttpAcceptEncoding` | `makeAcceptEncoding(java.lang.String enc)` Build an `Accept-Encoding` header clause.
`static HttpAcceptEncoding` | `makeAcceptEncoding(java.lang.String enc, double quality)` Build an `Accept-Encoding` header clause.
`static HttpAcceptLanguage` | `makeAcceptLanguage(java.lang.String lang)` Build an `Accept-Language` header clause.
`static HttpAcceptLanguage` | `makeAcceptLanguage(java.lang.String lang, double quality)` Build an `Accept-Language` header clause.
`static HttpAcceptLanguageList` | `makeAcceptLanguageList(HttpAcceptLanguage[] langs)` Build a list of accept language clauses for the `Accept-Language` header.
`static HttpAcceptList` | `makeAcceptList(HttpAccept[] accepts)` Build a list of accept clause, ready for the `Accept` header.
`static HttpBag` | `makeBag(java.lang.String name)` Build a empty bag instance.
`static HttpCacheControl` | `makeCacheControl()` Build an empty cache control directive.
`static HttpChallenge` | `makeChallenge(java.lang.String scheme)` Build a challenge requesting authorization from a client.
`static HttpContentRange` | `makeContentRange(java.lang.String unit, int firstpos, int lastpos, int length)` Build the description of a HTTP content range.
`static HttpCookie` | `makeCookie(java.lang.String name, java.lang.String value)` Build a single cookie value.
`static HttpCookieList` | `makeCookieList(HttpCookie[] cookies)` Build a list of cookies out of a set of cookies.
`static HttpCredential` | `makeCredential(java.lang.String scheme)` Build credential informations.
`static HttpDate` | `makeDate()` Build an HTTP date object representing the current time.
`static HttpDate` | `makeDate(long date)` Build an HTTP date object.
`static HttpEntityTag` | `makeETag(boolean isWeak, java.lang.String tag)` Build an entity tag object.
`static HttpEntityTagList` | `makeETagList(HttpEntityTag[] tags)` Build an entity tag list.
`static HttpInteger` | `makeInteger(int i)` Build a wrapper for an HTTP integer.
`static HttpMimeType` | `makeMimeType(MimeType type)` Build a wrapper for a MIME type suitable for HTTP transportation.
`static HttpRange` | `makeRange(java.lang.String unit, int firstpos, int lastpos)` Build an object representing an HTTP range.
`static HttpRangeList` | `makeRangeList(HttpRange[] ranges)` Build a list of ranges.
`static HttpSetCookie` | `makeSetCookie(java.lang.String name, java.lang.String value)` Build a set cookie clause for the `Set-Cookie` header.
`static HttpSetCookieList` | `makeSetCookieList(HttpSetCookie[] setcookies)` Build a list of set cookies commands.
`static HttpString` | `makeString(java.lang.String str)` Build a wrapper for a String, for HTTP transportation.
`static HttpTokenList` | `makeStringList(java.lang.String item)` Build a list of one string.
`static HttpTokenList` | `makeStringList(java.lang.String[] list)` Build a list of strings.
`static HttpWarning` | `makeWarning(int status)` Build an HTTP Warning object.
`static HttpWarning` | `makeWarning(int status, java.lang.String agent, java.lang.String text)` Build an HTTP Warning object.
`static HttpWarningList` | `makeWarningList(HttpWarning[] warnings)` Build a list of warnings for the `Warning` header.
`static HttpAccept` | `parseAccept(java.lang.String strval)` Build an accept object by parsing the given string.
`static HttpAcceptCharset` | `parseAcceptCharset(java.lang.String strval)` Build an accept charset object by parsing the given string.
`static HttpAcceptCharsetList` | `parseAcceptCharsetList(java.lang.String strval)` Build an accept charset list object by parsing the given string.
`static HttpAcceptEncoding` | `parseAcceptEncoding(java.lang.String strval)` Build an accept encoding object by parsing the given string.
`static HttpAcceptLanguage` | `parseAcceptLanguage(java.lang.String strval)` Build an accept language object by parsing the given string.
`static HttpAcceptLanguageList` | `parseAcceptLanguageList(java.lang.String strval)` Build an accept language list object by parsing the given string.
`static HttpAcceptList` | `parseAcceptList(java.lang.String strval)` Build an accept list object by parsing the given string.
`static HttpBag` | `parseBag(java.lang.String strval)` Build a bag object by parsing the given string.
`static HttpCacheControl` | `parseCacheControl(java.lang.String strval)` Build a cache control object by parsing the given string.
`static HttpChallenge` | `parseChallenge(java.lang.String strval)` Build a challenge object by parsing the given string.
`static HttpContentRange` | `parseContentRange(java.lang.String strval)` Build a content range object by parsing the given string.
`static HttpCookieList` | `parseCookieList(java.lang.String strval)` Build a cookie list object by parsing the given string.
`static HttpCredential` | `parseCredential(java.lang.String strval)` Build a credential object by parsing the given string.
`static HttpDate` | `parseDate(java.lang.String strval)` Build a date object by parsing the given string.
`static HttpEntityTagList` | `parseEntityTagList(java.lang.String strval)` Build an entity tag list object by parsing the given string.
`static HttpEntityTag` | `parseETag(java.lang.String strval)` Build an entity tag object by parsing the given string.
`static HttpInteger` | `parseInteger(java.lang.String strval)` Build an integer object by parsing the given string.
`static HttpMimeType` | `parseMimeType(java.lang.String strval)` Build an MIME type object by parsing the given string.
`static HttpRange` | `parseRange(java.lang.String strval)` Build a range object by parsing the given string.
`static HttpRangeList` | `parseRangeList(java.lang.String strval)` Build a list of ranges object by parsing the given string.
`static HttpSetCookieList` | `parseSetCookieList(java.lang.String strval)` Build a list of set cookies object by parsing the given string.
`static HttpString` | `parseString(java.lang.String strval)` Build a String object by parsing the given string.
`static HttpTokenList` | `parseTokenList(java.lang.String strval)` Build a list of string object by parsing the given string.
`static HttpWarning` | `parseWarning(java.lang.String strval)` Build a warning object by parsing the given string.
`static HttpWarningList` | `parseWarningList(java.lang.String strval)` Build a list of warnings object by parsing the given string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HttpFactory

    public HttpFactory()

Method Detail

### makeAccept

    public static HttpAccept makeAccept(MimeType type,
                                        double quality)

  Create an `Accept` header clause.
  Parameters:
    `type` - The MIME type that you will accept.
    `quality` - The quality you are willing to set to that MIME type.
  Returns:
    An instance of HttpAccept.
  See Also:
    `HttpAccept`

### makeAccept

    public static HttpAccept makeAccept(MimeType type)

  Create an `Accept` header clause. This will be assigned the default 1.0 quality.
  Parameters:
    `type` - The MIME type that you will accept.
  Returns:
    An instance of HttpAccept.
  See Also:
    `HttpAccept`

### parseAccept

    public static HttpAccept parseAccept(java.lang.String strval)

  Build an accept object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpAccept instance.

### makeAcceptList

    public static HttpAcceptList makeAcceptList(HttpAccept[] accepts)

  Build a list of accept clause, ready for the `Accept` header.
  Parameters:
    `accepts` - The various accept clauses, as build through calls to `makeAccept` and gathered in an array, or null to create an empty list.
  Returns:
    An instance of HttpAcceptList.
  See Also:
    `HttpAcceptList`

### parseAcceptList

    public static HttpAcceptList parseAcceptList(java.lang.String strval)

  Build an accept list object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpAcceptList instance.

### makeAcceptCharset

    public static HttpAcceptCharset makeAcceptCharset(java.lang.String charset,
                                                      double quality)

  Build an `Accept-Charset` header clause.
  Parameters:
    `charset` - The accepted charset.
    `quality` - The quality under which this charset is accepted.
  Returns:
    An instance of HttpAcceptCharset.
  See Also:
    `HttpAcceptCharset`

### makeAcceptCharset

    public static HttpAcceptCharset makeAcceptCharset(java.lang.String charset)

  Build an `Accept-Charset` header clause. Uses the default 1.0 quality.
  Parameters:
    `charset` - The accepted charset.
  Returns:
    An instance of HttpAcceptCharset.
  See Also:
    `HttpAcceptCharset`

### parseAcceptCharset

    public static HttpAcceptCharset parseAcceptCharset(java.lang.String strval)

  Build an accept charset object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpAcceptCharset instance.

### makeAcceptCharsetList

    public static HttpAcceptCharsetList makeAcceptCharsetList(HttpAcceptCharset[] charsets)

  Build a list of accepted charset for the `Accept-Charset` header.
  Parameters:
    `charsets` - A list of accepted charsets, encoded as an array or null to create an empty list.
  Returns:
    An instance of HttpAcceptCharsetList.
  See Also:
    `HttpAcceptCharsetList`

### parseAcceptCharsetList

    public static HttpAcceptCharsetList parseAcceptCharsetList(java.lang.String strval)

  Build an accept charset list object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpAcceptCharsetList instance.

### makeAcceptEncoding

    public static HttpAcceptEncoding makeAcceptEncoding(java.lang.String enc,
                                                        double quality)

  Build an `Accept-Encoding` header clause.
  Parameters:
    `enc` - The accepted encoding.
    `quality` - The quality at which this encoding is accepted.
  Returns:
    An instance of HttpAcceptEncoding.
  See Also:
    `HttpAcceptEncoding`

### makeAcceptEncoding

    public static HttpAcceptEncoding makeAcceptEncoding(java.lang.String enc)

  Build an `Accept-Encoding` header clause. Uses the default 1.0 quality.
  Parameters:
    `enc` - The accepted encoding.
  Returns:
    An instance of HttpAcceptEncoding.
  See Also:
    `HttpAcceptEncoding`

### parseAcceptEncoding

    public static HttpAcceptEncoding parseAcceptEncoding(java.lang.String strval)

  Build an accept encoding object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpAcceptLanguage instance.

### makeAcceptLanguage

    public static HttpAcceptLanguage makeAcceptLanguage(java.lang.String lang,
                                                        double quality)

  Build an `Accept-Language` header clause.
  Parameters:
    `lang` - The accepted language.
    `quality` - The quality at which this language is accepted.
  Returns:
    An instance of HttpAcceptLanguage.
  See Also:
    `HttpAcceptLanguage`

### makeAcceptLanguage

    public static HttpAcceptLanguage makeAcceptLanguage(java.lang.String lang)

  Build an `Accept-Language` header clause. Uses the default 1.0 quality.
  Parameters:
    `lang` - The accepted language.
  Returns:
    An instance of HttpAcceptLanguage.
  See Also:
    `HttpAcceptLanguage`

### parseAcceptLanguage

    public static HttpAcceptLanguage parseAcceptLanguage(java.lang.String strval)

  Build an accept language object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpAcceptLanguage instance.

### makeAcceptLanguageList

    public static HttpAcceptLanguageList makeAcceptLanguageList(HttpAcceptLanguage[] langs)

  Build a list of accept language clauses for the `Accept-Language` header.
  Parameters:
    `langs` - A list of accepted languages, encoded as an array, or null to create an empty list.

### parseAcceptLanguageList

    public static HttpAcceptLanguageList parseAcceptLanguageList(java.lang.String strval)

  Build an accept language list object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpAcceptLanguageList instance.

### makeBag

    public static HttpBag makeBag(java.lang.String name)

  Build a empty bag instance. Bags are used in PEP and PICS.
  Parameters:
    `name` - The name of the bag to construct.
  Returns:
    An empty bag instance.
  See Also:
    `HttpBag`

### parseBag

    public static HttpBag parseBag(java.lang.String strval)

  Build a bag object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpBag instance.

### makeCacheControl

    public static HttpCacheControl makeCacheControl()

  Build an empty cache control directive.
  Returns:
    An instance of HttpCacheControl, with default settings.
  See Also:
    `HttpCacheControl`

### parseCacheControl

    public static HttpCacheControl parseCacheControl(java.lang.String strval)

  Build a cache control object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpCacheControl instance.

### makeChallenge

    public static HttpChallenge makeChallenge(java.lang.String scheme)

  Build a challenge requesting authorization from a client.
  Parameters:
    `scheme` - The scheme used by that challenge.
  Returns:
    An HttpChallenge instance.
  See Also:
    `HttpChallenge`

### parseChallenge

    public static HttpChallenge parseChallenge(java.lang.String strval)

  Build a challenge object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpChallenge instance.

### makeContentRange

    public static HttpContentRange makeContentRange(java.lang.String unit,
                                                    int firstpos,
                                                    int lastpos,
                                                    int length)

  Build the description of a HTTP content range.
  Parameters:
    `unit` - The unit of that range.
    `firstpos` - The first position of that range (can be -1 to indicate a postfix range.
    `lastpost` - The last position of that range (can be -1 to indicate a prefix range).
    `length` - The full length of the entity from which that range was taken.
  Returns:
    An instance of HttpContentRange.
  See Also:
    `HttpContentRange`

### parseContentRange

    public static HttpContentRange parseContentRange(java.lang.String strval)

  Build a content range object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpContantRange instance.

### makeCookie

    public static HttpCookie makeCookie(java.lang.String name,
                                        java.lang.String value)

  Build a single cookie value.
  Parameters:
    `name` - The name of that cookie.
    `value` - The value of that cookie.
  Returns:
    An instance of HttpCookie.
  See Also:
    `HttpCookie`

### makeCookieList

    public static HttpCookieList makeCookieList(HttpCookie[] cookies)

  Build a list of cookies out of a set of cookies.
  Parameters:
    `cookies` - The cookies to be added to the list, may be null to create an empty list.
  Returns:
    An instance of HttpCookieList.
  See Also:
    `HttpCookieList`

### parseCookieList

    public static HttpCookieList parseCookieList(java.lang.String strval)

  Build a cookie list object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpCookieList instance.

### makeCredential

    public static HttpCredential makeCredential(java.lang.String scheme)

  Build credential informations.
  Parameters:
    `scheme` - The scheme for that credentials.
  Returns:
    An instance of HttpCredential.
  See Also:
    `HttpCredential`

### parseCredential

    public static HttpCredential parseCredential(java.lang.String strval)

  Build a credential object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpCredential instance.

### makeDate

    public static HttpDate makeDate(long date)

  Build an HTTP date object.
  Parameters:
    `date` - The date, given in milliseconds since Java epoch.
  Returns:
    An instance of HttpDate.
  See Also:
    `HttpDate`

### makeDate

    public static HttpDate makeDate()

  Build an HTTP date object representing the current time.
  Returns:
    An instance of HttpDate.
  See Also:
    `HttpDate`

### parseDate

    public static HttpDate parseDate(java.lang.String strval)

  Build a date object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpDate instance.

### makeETag

    public static HttpEntityTag makeETag(boolean isWeak,
                                         java.lang.String tag)

  Build an entity tag object.
  Parameters:
    `isWeak` - Is this a weak entity tag.
    `tag` - The tag encoded as a String.
  Returns:
    An instance of HttpEntityTag.
  See Also:
    `HttpEntityTag`

### parseETag

    public static HttpEntityTag parseETag(java.lang.String strval)

  Build an entity tag object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpEntityTag instance.

### makeETagList

    public static HttpEntityTagList makeETagList(HttpEntityTag[] tags)

  Build an entity tag list.
  Parameters:
    `tags` - A list of enetity tags, encoded as an array, or null to create an empty list.
  Returns:
    An instance of HttpEntityTagList.
  See Also:
    `HttpEntityTagList`

### parseEntityTagList

    public static HttpEntityTagList parseEntityTagList(java.lang.String strval)

  Build an entity tag list object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpEntityTagList instance.

### makeInteger

    public static HttpInteger makeInteger(int i)

  Build a wrapper for an HTTP integer.
  Parameters:
    `i` - The integer to wrap for HTTP transportation.
  Returns:
    An instance of HttpInteger.
  See Also:
    `HttpInteger`

### parseInteger

    public static HttpInteger parseInteger(java.lang.String strval)

  Build an integer object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpInteger instance.

### makeMimeType

    public static HttpMimeType makeMimeType(MimeType type)

  Build a wrapper for a MIME type suitable for HTTP transportation.
  Parameters:
    `type` - The MIME type to wrap.
  Returns:
    An instance of HttpMimeType.
  See Also:
    `HttpMimeType`

### parseMimeType

    public static HttpMimeType parseMimeType(java.lang.String strval)

  Build an MIME type object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpMimeType instance.

### makeRange

    public static HttpRange makeRange(java.lang.String unit,
                                      int firstpos,
                                      int lastpos)

  Build an object representing an HTTP range.
  Parameters:
    `unit` - The units in which that byte range is measured.
    `firstpos` - The first position of requested byte range.
    `lastpos` - The last position of requested byte range.
  Returns:
    An instance of HttpRange.
  See Also:
    `HttpRange`

### parseRange

    public static HttpRange parseRange(java.lang.String strval)

  Build a range object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpRange instance.

### makeRangeList

    public static HttpRangeList makeRangeList(HttpRange[] ranges)

  Build a list of ranges.
  Parameters:
    `ranges` - A list of ranges, encoded as an array, or null to create an empty list.
  Returns:
    An instance of HttprangeList.
  See Also:
    `HttpRangeList`

### parseRangeList

    public static HttpRangeList parseRangeList(java.lang.String strval)

  Build a list of ranges object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpRangeList instance.

### makeSetCookie

    public static HttpSetCookie makeSetCookie(java.lang.String name,
                                              java.lang.String value)

  Build a set cookie clause for the `Set-Cookie` header.
  Parameters:
    `name` - The name of the cookie we are requesting to be set.
    `value` - It's value.
  Returns:
    An instance of HttpSetCookie.
  See Also:
    `HttpSetCookie`

### makeSetCookieList

    public static HttpSetCookieList makeSetCookieList(HttpSetCookie[] setcookies)

  Build a list of set cookies commands.
  Parameters:
    `setcookies` - A list of set cookie commands, encoded as an array, or null to build an empty list.
  Returns:
    An instance of HttpStCookieList.
  See Also:
    `HttpSetCookieList`

### parseSetCookieList

    public static HttpSetCookieList parseSetCookieList(java.lang.String strval)

  Build a list of set cookies object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpSetCookieList instance.

### makeString

    public static HttpString makeString(java.lang.String str)

  Build a wrapper for a String, for HTTP transportation.
  Parameters:
    `str` - The String (or token) to wrap.
  Returns:
    An instance of HttpString.
  See Also:
    `HttpString`

### parseString

    public static HttpString parseString(java.lang.String strval)

  Build a String object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpString instance.

### makeStringList

    public static HttpTokenList makeStringList(java.lang.String[] list)

  Build a list of strings.
  Parameters:
    `list` - The list of strings, encoded as an array, or null to create an empty list.
  Returns:
    An instance of HttpTokenList.
  See Also:
    `HttpTokenList`

### makeStringList

    public static HttpTokenList makeStringList(java.lang.String item)

  Build a list of one string.
  Parameters:
    `item` - The item to be added to the list.
  Returns:
    An instance of HttpTokenList.
  See Also:
    `HttpTokenList`

### parseTokenList

    public static HttpTokenList parseTokenList(java.lang.String strval)

  Build a list of string object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpTokenList instance.

### makeWarning

    public static HttpWarning makeWarning(int status,
                                          java.lang.String agent,
                                          java.lang.String text)

  Build an HTTP Warning object.
  Parameters:
    `status` - The warning status code.
    `agent` - The agent generating that warning.
    `text` - The text for the warning.
  Returns:
    An instance of HttpWarning.
  See Also:
    `HttpWarning`

### makeWarning

    public static HttpWarning makeWarning(int status)

  Build an HTTP Warning object.
  Parameters:
    `status` - The warning status code.
  Returns:
    An instance of HttpWarning.
  See Also:
    `HttpWarning`

### parseWarning

    public static HttpWarning parseWarning(java.lang.String strval)

  Build a warning object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpWarning instance.

### makeWarningList

    public static HttpWarningList makeWarningList(HttpWarning[] warnings)

  Build a list of warnings for the `Warning` header.
  Parameters:
    `warnings` - A list of warning encoded as an array, or null to get an empty list.
  Returns:
    An instance of HttpWarningList.
  See Also:
    `HttpWarningList`

### parseWarningList

    public static HttpWarningList parseWarningList(java.lang.String strval)

  Build a list of warnings object by parsing the given string.
  Parameters:
    `strval` - The String to parse.
  Returns:
    An HttpWarningList instance.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD