Package com.kheops.util
Class HttpUtil
java.lang.Object
com.kheops.util.HttpUtil
A usefull class to send request to a HTTP server.
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringDecodes the specified string with the default encoding defined byENCODING.static StringEncodes the specified string with the default encoding defined byENCODING.static HttpUtilstatic voidsetProxySettings(String host, int port, String username, String password) static StringsetUserInfo(String url, String userInfos) Opens a connection to the specified URL and sends the specified request using the specified submit method.
- 
Field Details- 
GET_COMMAND- See Also:
 
- 
POST_COMMAND- See Also:
 
- 
ENCODING- See Also:
 
 
- 
- 
Method Details- 
getInstance
- 
submitOpens a connection to the specified URL and sends the specified request using the specified submit method.- Parameters:
- url- the URL to connect to.
- request- the request to be posted.
- command- the method to be used (either "GET" or "POST").
- Returns:
- a HttpResponse that contains the server's response.
- Throws:
- Exception- if an error occurs.
 
- 
submitpublic HttpResponse submit(URL url, byte[] request, String command, Map<String, String> headerParameters) throws Exception- Throws:
- Exception
 
- 
setProxySettings
- 
encodeEncodes the specified string with the default encoding defined byENCODING.- Parameters:
- str- the string to encode.
- Returns:
- the encoded string.
- See Also:
 
- 
decodeDecodes the specified string with the default encoding defined byENCODING.- Parameters:
- str- the string to decode.
- Returns:
- the decoded string.
- See Also:
 
- 
setUserInfo- Throws:
- MalformedURLException
 
 
-