Package com.jalios.io
Class HttpClient
- java.lang.Object
-
- com.jalios.io.HttpClient
-
public class HttpClient extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected java.net.HttpURLConnectionconnectionprotected java.lang.Stringcookiestatic java.lang.StringJSESSSIONIDprotected intresponseCodestatic java.lang.StringSET_COOKIE
-
Constructor Summary
Constructors Constructor Description HttpClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanconnect(java.lang.String url)Initialize a Connection to a given URLjava.lang.StringgetContents(java.lang.String url)Connect, get the content and disconnect.java.lang.StringreadCookie()Return the value of the cookie
-
-
-
Field Detail
-
SET_COOKIE
public static final java.lang.String SET_COOKIE
- See Also:
- Constant Field Values
-
JSESSSIONID
public static final java.lang.String JSESSSIONID
- See Also:
- Constant Field Values
-
connection
protected java.net.HttpURLConnection connection
-
cookie
protected java.lang.String cookie
-
responseCode
protected int responseCode
-
-
Method Detail
-
connect
public boolean connect(java.lang.String url)
Initialize a Connection to a given URL- Parameters:
url- the URL to connect- Returns:
- true if the connection is OK
-
getContents
public java.lang.String getContents(java.lang.String url)
Connect, get the content and disconnect.- Parameters:
url- the URL to request for the content- Returns:
- the content
-
readCookie
public java.lang.String readCookie() throws java.io.IOExceptionReturn the value of the cookie- Returns:
- the cookie
- Throws:
java.io.IOException- Exception thrown on cookie reading
-
-