--- /dev/null
+// HttpFactory.java\r
+// $Id: HttpFactory.java,v 1.1 2010/06/15 12:19:45 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1996.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.www.http;\r
+\r
+import org.w3c.www.mime.MimeType;\r
+\r
+/**\r
+ * Use this class to create pre-defined header values of various kind.\r
+ */\r
+\r
+public class HttpFactory {\r
+\r
+ /**\r
+ * Create an <code>Accept</code> header clause.\r
+ * @param type The MIME type that you will accept.\r
+ * @param quality The quality you are willing to set to that MIME type.\r
+ * @return An instance of <strong>HttpAccept</strong>.\r
+ * @see HttpAccept\r
+ */\r
+\r
+ public static HttpAccept makeAccept(MimeType type, double quality) {\r
+ return new HttpAccept(true, type, quality);\r
+ }\r
+\r
+ /**\r
+ * Create an <code>Accept</code> header clause.\r
+ * This will be assigned the default <strong>1.0</strong> quality.\r
+ * @param type The MIME type that you will accept.\r
+ * @return An instance of <strong>HttpAccept</strong>.\r
+ * @see HttpAccept\r
+ */\r
+\r
+ public static HttpAccept makeAccept(MimeType type) {\r
+ return new HttpAccept(true, type, (double) 1.0);\r
+ }\r
+\r
+ /**\r
+ * Build an accept object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpAccept instance.\r
+ */\r
+\r
+ public static HttpAccept parseAccept(String strval) {\r
+ HttpAccept a = new HttpAccept();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a list of accept clause, ready for the <code>Accept</code> header.\r
+ * @param accepts The various accept clauses, as build through calls to\r
+ * <code>makeAccept</code> and gathered in an array, or <strong>null\r
+ * </strong> to create an empty list.\r
+ * @return An instance of <strojng>HttpAcceptList</code>.\r
+ * @see HttpAcceptList\r
+ */\r
+\r
+ public static HttpAcceptList makeAcceptList(HttpAccept accepts[]) {\r
+ if ( accepts == null )\r
+ return new HttpAcceptList(null);\r
+ else\r
+ return new HttpAcceptList(accepts);\r
+ }\r
+\r
+ /**\r
+ * Build an accept list object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpAcceptList instance.\r
+ */\r
+\r
+ public static HttpAcceptList parseAcceptList(String strval) {\r
+ HttpAcceptList a = new HttpAcceptList();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build an <code>Accept-Charset</code> header clause.\r
+ * @param charset The accepted charset.\r
+ * @param quality The quality under which this charset is accepted.\r
+ * @return An instance of HttpAcceptCharset.\r
+ * @see HttpAcceptCharset\r
+ */\r
+\r
+ public static HttpAcceptCharset makeAcceptCharset(String charset\r
+ , double quality) {\r
+ return new HttpAcceptCharset(true, charset, quality);\r
+ }\r
+\r
+ /**\r
+ * Build an <code>Accept-Charset</code> header clause.\r
+ * Uses the default <strong>1.0</strong> quality.\r
+ * @param charset The accepted charset.\r
+ * @return An instance of HttpAcceptCharset.\r
+ * @see HttpAcceptCharset\r
+ */\r
+\r
+ public static HttpAcceptCharset makeAcceptCharset(String charset) {\r
+ return new HttpAcceptCharset(true, charset, (double) 1.0);\r
+ }\r
+\r
+ /**\r
+ * Build an accept charset object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpAcceptCharset instance.\r
+ */\r
+\r
+ public static HttpAcceptCharset parseAcceptCharset(String strval) {\r
+ HttpAcceptCharset a = new HttpAcceptCharset();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a list of accepted charset for the <code>Accept-Charset</code>\r
+ * header.\r
+ * @param charsets A list of accepted charsets, encoded as an array\r
+ * or <strong>null</strong> to create an empty list.\r
+ * @return An instance of HttpAcceptCharsetList.\r
+ * @see HttpAcceptCharsetList\r
+ */\r
+\r
+ public static\r
+ HttpAcceptCharsetList makeAcceptCharsetList(HttpAcceptCharset charsets[]) {\r
+ return new HttpAcceptCharsetList(charsets);\r
+ }\r
+\r
+ /**\r
+ * Build an accept charset list object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpAcceptCharsetList instance.\r
+ */\r
+\r
+ public static HttpAcceptCharsetList parseAcceptCharsetList(String strval) {\r
+ HttpAcceptCharsetList a = new HttpAcceptCharsetList();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build an <code>Accept-Encoding</code> header clause.\r
+ * @param enc The accepted encoding.\r
+ * @param quality The quality at which this encoding is accepted.\r
+ * @return An instance of HttpAcceptEncoding.\r
+ * @see HttpAcceptEncoding\r
+ */\r
+\r
+ public static HttpAcceptEncoding makeAcceptEncoding(String enc\r
+ , double quality) {\r
+ return new HttpAcceptEncoding(true, enc, quality);\r
+ }\r
+\r
+ /**\r
+ * Build an <code>Accept-Encoding</code> header clause.\r
+ * Uses the default <strong>1.0</strong> quality.\r
+ * @param enc The accepted encoding.\r
+ * @return An instance of HttpAcceptEncoding.\r
+ * @see HttpAcceptEncoding\r
+ */\r
+\r
+ public static HttpAcceptEncoding makeAcceptEncoding(String enc) {\r
+ return new HttpAcceptEncoding(true, enc, (double) 1.0);\r
+ }\r
+\r
+ /**\r
+ * Build an accept encoding object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpAcceptLanguage instance.\r
+ */\r
+\r
+ public static HttpAcceptEncoding parseAcceptEncoding(String strval) {\r
+ HttpAcceptEncoding e = new HttpAcceptEncoding();\r
+ e.setString(strval);\r
+ return e;\r
+ }\r
+\r
+ /**\r
+ * Build a list of accept encoding clauses for the <code>Accept-Encoding\r
+ * </code> header.\r
+ * @param langs A list of accepted encodings, encoded as an array, or\r
+ * <strong>null</strong> to create an empty list.\r
+ */\r
+\r
+ public static \r
+ HttpAcceptEncodingList makeAcceptEncodingList(HttpAcceptEncoding encs[]) {\r
+ return new HttpAcceptEncodingList(encs);\r
+ }\r
+\r
+ /**\r
+ * Build an accept encoding list object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpAcceptENcodingList instance.\r
+ */\r
+\r
+ public static \r
+ HttpAcceptEncodingList parseAcceptEncodingList(String strval) {\r
+ HttpAcceptEncodingList a = new HttpAcceptEncodingList();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build an <code>Accept-Language</code> header clause.\r
+ * @param lang The accepted language.\r
+ * @param quality The quality at which this language is accepted.\r
+ * @return An instance of HttpAcceptLanguage.\r
+ * @see HttpAcceptLanguage\r
+ */\r
+\r
+ public static HttpAcceptLanguage makeAcceptLanguage(String lang\r
+ , double quality) {\r
+ return new HttpAcceptLanguage(true, lang, quality);\r
+ }\r
+\r
+ /**\r
+ * Build an <code>Accept-Language</code> header clause.\r
+ * Uses the default <strong>1.0</strong> quality.\r
+ * @param lang The accepted language.\r
+ * @return An instance of HttpAcceptLanguage.\r
+ * @see HttpAcceptLanguage\r
+ */\r
+\r
+ public static HttpAcceptLanguage makeAcceptLanguage(String lang) {\r
+ return new HttpAcceptLanguage(true, lang, (double) 1.0);\r
+ }\r
+\r
+ /**\r
+ * Build an accept language object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpAcceptLanguage instance.\r
+ */\r
+\r
+ public static HttpAcceptLanguage parseAcceptLanguage(String strval) {\r
+ HttpAcceptLanguage a = new HttpAcceptLanguage();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a list of accept language clauses for the <code>Accept-Language\r
+ * </code> header.\r
+ * @param langs A list of accepted languages, encoded as an array, or\r
+ * <strong>null</strong> to create an empty list.\r
+ */\r
+\r
+ public static \r
+ HttpAcceptLanguageList makeAcceptLanguageList(HttpAcceptLanguage langs[]) {\r
+ return new HttpAcceptLanguageList(langs);\r
+ }\r
+\r
+ /**\r
+ * Build an accept language list object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpAcceptLanguageList instance.\r
+ */\r
+\r
+ public static \r
+ HttpAcceptLanguageList parseAcceptLanguageList(String strval) {\r
+ HttpAcceptLanguageList a = new HttpAcceptLanguageList();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a empty bag instance.\r
+ * Bags are used in PEP and PICS.\r
+ * @param name The name of the bag to construct.\r
+ * @return An empty bag instance.\r
+ * @see HttpBag\r
+ */\r
+\r
+ public static HttpBag makeBag(String name) {\r
+ return new HttpBag(true, name);\r
+ }\r
+\r
+ /**\r
+ * Build a bag object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpBag instance.\r
+ */\r
+\r
+ public static HttpBag parseBag(String strval) {\r
+ HttpBag a = new HttpBag();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build an empty cache control directive.\r
+ * @return An instance of HttpCacheControl, with default settings.\r
+ * @see HttpCacheControl\r
+ */\r
+\r
+ public static HttpCacheControl makeCacheControl() {\r
+ return new HttpCacheControl(true);\r
+ }\r
+\r
+ /**\r
+ * Build a cache control object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpCacheControl instance.\r
+ */\r
+\r
+ public static HttpCacheControl parseCacheControl(String strval) {\r
+ HttpCacheControl a = new HttpCacheControl();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a challenge requesting authorization from a client.\r
+ * @param scheme The scheme used by that challenge.\r
+ * @return An HttpChallenge instance.\r
+ * @see HttpChallenge\r
+ */\r
+\r
+ public static HttpChallenge makeChallenge(String scheme) {\r
+ return new HttpChallenge(true, scheme);\r
+ }\r
+\r
+ /**\r
+ * Build a challenge object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpChallenge instance.\r
+ */\r
+\r
+ public static HttpChallenge parseChallenge(String strval) {\r
+ HttpChallenge a = new HttpChallenge();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build the description of a HTTP content range.\r
+ * @param unit The unit of that range.\r
+ * @param firstpos The first position of that range (can be <strong>-1\r
+ * </strong> to indicate a postfix range.\r
+ * @param lastpost The last position of that range (can be <strong>-1\r
+ * </strong> to indicate a prefix range).\r
+ * @param length The full length of the entity from which that range was\r
+ * taken.\r
+ * @return An instance of HttpContentRange.\r
+ * @see HttpContentRange\r
+ */\r
+\r
+ public static HttpContentRange makeContentRange(String unit\r
+ , int firstpos\r
+ , int lastpos\r
+ , int length) {\r
+ return new HttpContentRange(true, unit, firstpos, lastpos, length);\r
+ }\r
+\r
+ /**\r
+ * Build a content range object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpContantRange instance.\r
+ */\r
+\r
+ public static HttpContentRange parseContentRange(String strval) {\r
+ HttpContentRange a = new HttpContentRange();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a single cookie value.\r
+ * @param name The name of that cookie.\r
+ * @param value The value of that cookie.\r
+ * @return An instance of HttpCookie.\r
+ * @see HttpCookie\r
+ */\r
+\r
+ public static HttpCookie makeCookie(String name, String value) {\r
+ return new HttpCookie(true, name, value);\r
+ }\r
+\r
+ /**\r
+ * Build a list of cookies out of a set of cookies.\r
+ * @param cookies The cookies to be added to the list, may be\r
+ * <strong>null</strong> to create an empty list.\r
+ * @return An instance of HttpCookieList.\r
+ * @see HttpCookieList\r
+ */\r
+\r
+ public static HttpCookieList makeCookieList(HttpCookie cookies[]) {\r
+ return new HttpCookieList(cookies);\r
+ }\r
+\r
+ /**\r
+ * Build a cookie list object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpCookieList instance.\r
+ */\r
+\r
+ public static HttpCookieList parseCookieList(String strval) {\r
+ HttpCookieList a = new HttpCookieList();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build credential informations.\r
+ * @param scheme The scheme for that credentials.\r
+ * @return An instance of HttpCredential.\r
+ * @see HttpCredential\r
+ */\r
+\r
+ public static HttpCredential makeCredential(String scheme) {\r
+ return new HttpCredential(true, scheme);\r
+ }\r
+\r
+ /**\r
+ * Build a credential object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpCredential instance.\r
+ */\r
+\r
+ public static HttpCredential parseCredential(String strval) {\r
+ HttpCredential a = new HttpCredential();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build an HTTP date object.\r
+ * @param date The date, given in milliseconds since Java epoch.\r
+ * @return An instance of HttpDate.\r
+ * @see HttpDate\r
+ */\r
+\r
+ public static HttpDate makeDate(long date) {\r
+ return new HttpDate(true, date);\r
+ }\r
+\r
+ /**\r
+ * Build an HTTP date object representing the current time.\r
+ * @return An instance of HttpDate.\r
+ * @see HttpDate\r
+ */\r
+\r
+ public static HttpDate makeDate() {\r
+ return new HttpDate(true, System.currentTimeMillis());\r
+ }\r
+\r
+ /**\r
+ * Build a date object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpDate instance.\r
+ */\r
+\r
+ public static HttpDate parseDate(String strval) {\r
+ HttpDate a = new HttpDate();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build an entity tag object.\r
+ * @param isWeak Is this a weak entity tag.\r
+ * @param tag The tag encoded as a String.\r
+ * @return An instance of HttpEntityTag.\r
+ * @see HttpEntityTag\r
+ */\r
+\r
+ public static HttpEntityTag makeETag(boolean isWeak, String tag) {\r
+ return new HttpEntityTag(true, isWeak, tag);\r
+ }\r
+\r
+ /**\r
+ * Build an entity tag object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpEntityTag instance.\r
+ */\r
+\r
+ public static HttpEntityTag parseETag(String strval) {\r
+ HttpEntityTag a = new HttpEntityTag();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build an entity tag list.\r
+ * @param tags A list of enetity tags, encoded as an array, or <strong>\r
+ * null</strong> to create an empty list.\r
+ * @return An instance of HttpEntityTagList.\r
+ * @see HttpEntityTagList\r
+ */\r
+\r
+ public static HttpEntityTagList makeETagList(HttpEntityTag tags[]) {\r
+ return new HttpEntityTagList(tags);\r
+ }\r
+\r
+ /**\r
+ * Build an entity tag list object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpEntityTagList instance.\r
+ */\r
+\r
+ public static HttpEntityTagList parseEntityTagList(String strval) {\r
+ HttpEntityTagList a = new HttpEntityTagList();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a wrapper for an HTTP integer.\r
+ * @param i The integer to wrap for HTTP transportation.\r
+ * @return An instance of HttpInteger.\r
+ * @see HttpInteger\r
+ */\r
+\r
+ public static HttpInteger makeInteger(int i) {\r
+ return new HttpInteger(true, i);\r
+ }\r
+\r
+ /**\r
+ * Build an integer object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpInteger instance.\r
+ */\r
+\r
+ public static HttpInteger parseInteger(String strval) {\r
+ HttpInteger a = new HttpInteger();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a wrapper for a MIME type suitable for HTTP transportation.\r
+ * @param type The MIME type to wrap.\r
+ * @return An instance of HttpMimeType.\r
+ * @see HttpMimeType\r
+ */\r
+\r
+ public static HttpMimeType makeMimeType(MimeType type) {\r
+ return new HttpMimeType(true, type);\r
+ }\r
+\r
+ /**\r
+ * Build an MIME type object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpMimeType instance.\r
+ */\r
+\r
+ public static HttpMimeType parseMimeType(String strval) {\r
+ HttpMimeType a = new HttpMimeType();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build an object representing an HTTP range.\r
+ * @param unit The units in which that byte range is measured.\r
+ * @param firstpos The first position of requested byte range.\r
+ * @param lastpos The last position of requested byte range.\r
+ * @return An instance of HttpRange.\r
+ * @see HttpRange\r
+ */\r
+\r
+ public static HttpRange makeRange(String unit, int firstpos, int lastpos) {\r
+ return new HttpRange(true, unit, firstpos, lastpos);\r
+ }\r
+\r
+ /**\r
+ * Build a range object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpRange instance.\r
+ */\r
+\r
+ public static HttpRange parseRange(String strval) {\r
+ HttpRange a = new HttpRange();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a list of ranges.\r
+ * @param ranges A list of ranges, encoded as an array, or <strong>\r
+ * null</strong> to create an empty list.\r
+ * @return An instance of HttprangeList.\r
+ * @see HttpRangeList\r
+ */\r
+\r
+ public static HttpRangeList makeRangeList(HttpRange ranges[]) {\r
+ return new HttpRangeList(ranges);\r
+ }\r
+\r
+ /**\r
+ * Build a list of ranges object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpRangeList instance.\r
+ */\r
+\r
+ public static HttpRangeList parseRangeList(String strval) {\r
+ HttpRangeList a = new HttpRangeList();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a set cookie clause for the <code>Set-Cookie</code> header.\r
+ * @param name The name of the cookie we are requesting to be set.\r
+ * @param value It's value.\r
+ * @return An instance of HttpSetCookie.\r
+ * @see HttpSetCookie\r
+ */\r
+\r
+ public static HttpSetCookie makeSetCookie(String name, String value) {\r
+ return new HttpSetCookie(true, name, value);\r
+ }\r
+\r
+ /**\r
+ * Build a list of set cookies commands.\r
+ * @param setcookies A list of set cookie commands, encoded as an\r
+ * array, or <strong>null</strong> to build an empty list.\r
+ * @return An instance of HttpStCookieList.\r
+ * @see HttpSetCookieList\r
+ */\r
+\r
+ public static \r
+ HttpSetCookieList makeSetCookieList(HttpSetCookie setcookies[]) {\r
+ return new HttpSetCookieList(setcookies);\r
+ }\r
+\r
+ /**\r
+ * Build a list of set cookies object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpSetCookieList instance.\r
+ */\r
+\r
+ public static HttpSetCookieList parseSetCookieList(String strval) {\r
+ HttpSetCookieList a = new HttpSetCookieList();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a wrapper for a String, for HTTP transportation.\r
+ * @param str The String (or <em>token</em>) to wrap.\r
+ * @return An instance of HttpString.\r
+ * @see HttpString\r
+ */\r
+\r
+ public static HttpString makeString(String str) {\r
+ return new HttpString(true, str);\r
+ }\r
+\r
+ /**\r
+ * Build a String object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpString instance.\r
+ */\r
+\r
+ public static HttpString parseString(String strval) {\r
+ HttpString a = new HttpString();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a list of strings.\r
+ * @param list The list of strings, encoded as an array, or <strong>null\r
+ * </strong> to create an empty list.\r
+ * @return An instance of HttpTokenList.\r
+ * @see HttpTokenList\r
+ */\r
+\r
+ public static HttpTokenList makeStringList(String list[]) {\r
+ return new HttpTokenList(list);\r
+ }\r
+\r
+ /**\r
+ * Build a list of one string.\r
+ * @param item The item to be added to the list.\r
+ * @return An instance of HttpTokenList.\r
+ * @see HttpTokenList\r
+ */\r
+\r
+ public static HttpTokenList makeStringList(String item) {\r
+ String list[] = new String[1];\r
+ list[0] = item;\r
+ return new HttpTokenList(list);\r
+ }\r
+\r
+ /**\r
+ * Build a list of string object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpTokenList instance.\r
+ */\r
+\r
+ public static HttpTokenList parseTokenList(String strval) {\r
+ HttpTokenList a = new HttpTokenList();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build an HTTP Warning object.\r
+ * @param status The warning status code.\r
+ * @param agent The agent generating that warning.\r
+ * @param text The text for the warning.\r
+ * @return An instance of HttpWarning.\r
+ * @see HttpWarning\r
+ */\r
+\r
+ public static HttpWarning makeWarning(int status\r
+ , String agent\r
+ , String text) {\r
+ return new HttpWarning(true, status, agent, text);\r
+ }\r
+\r
+ /**\r
+ * Build an HTTP Warning object.\r
+ * @param status The warning status code.\r
+ * @return An instance of HttpWarning.\r
+ * @see HttpWarning\r
+ */\r
+\r
+ public static HttpWarning makeWarning(int status) {\r
+ return new HttpWarning(true, status, null, null);\r
+ }\r
+\r
+ /**\r
+ * Build a warning object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpWarning instance.\r
+ */\r
+\r
+ public static HttpWarning parseWarning(String strval) {\r
+ HttpWarning a = new HttpWarning();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+ /**\r
+ * Build a list of warnings for the <code>Warning</code> header.\r
+ * @param warnings A list of warning encoded as an array, or <strong>\r
+ * null</strong> to get an empty list.\r
+ * @return An instance of HttpWarningList.\r
+ * @see HttpWarningList\r
+ */\r
+\r
+ public static HttpWarningList makeWarningList(HttpWarning warnings[]) {\r
+ return new HttpWarningList(warnings);\r
+ }\r
+\r
+ /**\r
+ * Build a list of warnings object by parsing the given string.\r
+ * @param strval The String to parse.\r
+ * @return An HttpWarningList instance.\r
+ */\r
+\r
+ public static HttpWarningList parseWarningList(String strval) {\r
+ HttpWarningList a = new HttpWarningList();\r
+ a.setString(strval);\r
+ return a;\r
+ }\r
+\r
+}\r
+\r
+\r