Skip to content

chazzzz/java-webapp-utilities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java WebApp Utilities

A collection of utility classes frequently used in building a web application

HttpUtil

Used in sending requests (e.g. get, post, put, delete) to a url resource. Every methods returns Apache's HttpResponse object. With this object, we can get the status code, headers, and content of the response.

Methods:

HttpUtil.post(String url, Map<String, String> params);

HttpUtil.get(String url, Map<String, String> params);

HttpUtil.get(String url, Map<String, String> params, Map<String, String> headers);

HttpUtil.postJson(String url, String jsonData, Map<String, String> headers);

HttpUtil.delete(String url, Map<String, String> headers);

To get the String content of the HttpResponse, use the method:

HttpUtil.getContent(HttpResponse response); //returns the string content of the response

To get the status code of the response, use the statement

response.getStatusLine().getStatusCode(); //returns int code

About

A collection of utility methods/functions frequently used in building a web application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages