|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectorg.json.HTTP
public class HTTP
Convert an HTTP header to a JSONObject and back.
フィールドの概要 | |
---|---|
static String |
CRLF
Carriage return/line feed. |
コンストラクタの概要 | |
---|---|
HTTP()
|
メソッドの概要 | |
---|---|
static JSONObject |
toJSONObject(String string)
Convert an HTTP header string into a JSONObject. |
static String |
toString(JSONObject o)
Convert a JSONObject into an HTTP header. |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
public static final String CRLF
コンストラクタの詳細 |
---|
public HTTP()
メソッドの詳細 |
---|
public static JSONObject toJSONObject(String string) throws JSONException
{ Method: "POST" (for example), "Request-URI": "/" (for example), "HTTP-Version": "HTTP/1.1" (for example) }A response header will contain
{ "HTTP-Version": "HTTP/1.1" (for example), "Status-Code": "200" (for example), "Reason-Phrase": "OK" (for example) }In addition, the other parameters in the header will be captured, using the HTTP field names as JSON names, so that
Date: Sun, 26 May 2002 18:06:04 GMT Cookie: Q=q2=PPEAsg--; B=677gi6ouf29bn&b=2&f=s Cache-Control: no-cachebecome
{... Date: "Sun, 26 May 2002 18:06:04 GMT", Cookie: "Q=q2=PPEAsg--; B=677gi6ouf29bn&b=2&f=s", "Cache-Control": "no-cache", ...}It does no further checking or conversion. It does not parse dates. It does not do '%' transforms on URLs.
string
- An HTTP header string.
JSONException
public static String toString(JSONObject o) throws JSONException
{ Method: "POST" (for example), "Request-URI": "/" (for example), "HTTP-Version": "HTTP/1.1" (for example) }A response header must contain
{ "HTTP-Version": "HTTP/1.1" (for example), "Status-Code": "200" (for example), "Reason-Phrase": "OK" (for example) }Any other members of the JSONObject will be output as HTTP fields. The result will end with two CRLF pairs.
o
- A JSONObject
JSONException
- if the object does not contain enough
information.
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |