    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.www.http.HttpFactory

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

public class HttpFactory
extends Object

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

##

HttpFactory()

##

makeAccept(MimeType)
  Create an `Accept` header clause.
makeAccept(MimeType, double)
  Create an `Accept` header clause.
makeAcceptCharset(String)
  Build an `Accept-Charset` header clause.
makeAcceptCharset(String, double)
  Build an `Accept-Charset` header clause.
makeAcceptCharsetList(HttpAcceptCharset[])
  Build a list of accepted charset for the `Accept-Charset` header.
makeAcceptLanguage(String)
  Build an `Accept-Language` header clause.
makeAcceptLanguage(String, double)
  Build an `Accept-Language` header clause.
makeAcceptLanguageList(HttpAcceptLanguage[])
  Build a list of accept language clauses for the `Accept-Language` header.
makeAcceptList(HttpAccept[])
  Build a list of accept clause, ready for the `Accept` header.
makeBag(String)
  Build a empty bag instance.
makeCacheControl()
  Build an empty cache control directive.
makeChallenge(String)
  Build a challenge requesting authorization from a client.
makeContentRange(String, int, int, int)
  Build the description of a HTTP content range.
makeCookie(String, String)
  Build a single cookie value.
makeCookieList(HttpCookie[])
  Build a list of cookies out of a set of cookies.
makeCredential(String)
  Build credential informations.
makeDate()
  Build an HTTP date object representing the current time.
makeDate(long)
  Build an HTTP date object.
makeETag(boolean, String)
  Build an entity tag object.
makeETagList(HttpEntityTag[])
  Build an entity tag list.
makeInteger(int)
  Build a wrapper for an HTTP integer.
makeMimeType(MimeType)
  Build a wrapper for a MIME type suitable for HTTP transportation.
makeRange(String, int, int)
  Build an object representing an HTTP range.
makeRangeList(HttpRange[])
  Build a list of ranges.
makeSetCookie(String, String)
  Build a set cookie clause for the `Set-Cookie` header.
makeSetCookieList(HttpSetCookie[])
  Build a list of set cookies commands.
makeString(String)
  Build a wrapper for a String, for HTTP transportation.
makeStringList(String)
  Build a list of one string.
makeStringList(String[])
  Build a list of strings.
makeWarning(int)
  Build an HTTP Warning object.
makeWarning(int, String, String)
  Build an HTTP Warning object.
makeWarningList(HttpWarning[])
  Build a list of warnings for the `Warning` header.
parseAccept(String)
  Build an accept object by parsing the given string.
parseAcceptCharset(String)
  Build an accept charset object by parsing the given string.
parseAcceptCharsetList(String)
  Build an accept charset list object by parsing the given string.
parseAcceptLanguage(String)
  Build an accept language object by parsing the given string.
parseAcceptLanguageList(String)
  Build an accept language list object by parsing the given string.
parseAcceptList(String)
  Build an accept list object by parsing the given string.
parseBag(String)
  Build a bag object by parsing the given string.
parseCacheControl(String)
  Build a cache control object by parsing the given string.
parseChallenge(String)
  Build a challenge object by parsing the given string.
parseContentRange(String)
  Build a content range object by parsing the given string.
parseCookieList(String)
  Build a cookie list object by parsing the given string.
parseCredential(String)
  Build a credential object by parsing the given string.
parseDate(String)
  Build a date object by parsing the given string.
parseEntityTagList(String)
  Build an entity tag list object by parsing the given string.
parseETag(String)
  Build an entity tag object by parsing the given string.
parseInteger(String)
  Build an integer object by parsing the given string.
parseMimeType(String)
  Build an MIME type object by parsing the given string.
parseRange(String)
  Build a range object by parsing the given string.
parseRangeList(String)
  Build a list of ranges object by parsing the given string.
parseSetCookieList(String)
  Build a list of set cookies object by parsing the given string.
parseString(String)
  Build a String object by parsing the given string.
parseTokenList(String)
  Build a list of string object by parsing the given string.
parseWarning(String)
  Build a warning object by parsing the given string.
parseWarningList(String)
  Build a list of warnings object by parsing the given string.

##

HttpFactory

      public HttpFactory()

##

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(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(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(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(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(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(String strval)

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

makeAcceptLanguage

      public static HttpAcceptLanguage makeAcceptLanguage(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(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(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(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(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(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(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(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(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(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(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(String name,
                                          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(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(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(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(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,
                                           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(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(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(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(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(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(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(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(String name,
                                                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(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(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(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(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(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(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,
                                            String agent,
                                            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(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(String strval)

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

    All Packages  Class Hierarchy  This Package  Previous  Next  Index