|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.craftforge.essential.client.NetworkClient
public class NetworkClient
A network client performs client requests remotely via HTTP.
| Constructor Summary | |
|---|---|
NetworkClient(String urlBasePart)
Creates an HTTP client that uses the given URL base part for its requests. |
|
| Method Summary | |
|---|---|
protected ClientResponse |
getClientResponse(org.apache.http.HttpResponse httpResponse)
Gets the client response from the provided HTTP response. |
protected org.apache.http.client.methods.HttpRequestBase |
getHttpRequest(ClientRequest request)
Gets an HTTP request from the provided client request. |
protected org.apache.http.Header[] |
getRequestHeaders(Map<String,String[]> headers)
Gets the HTTP headers from the provided header map. |
protected org.apache.http.params.HttpParams |
getRequestParameters(Map<String,String[]> parameters)
Gets the HTTP parameters from the provided parameter map. |
protected Map<String,String[]> |
getResponseHeaders(org.apache.http.Header[] headers)
Gets the response header map from the given HTTP headers. |
ClientResponse |
performRequest(ClientRequest clientRequest)
Performs an HTTP request from the data provided by the given client request and retrieves an HTTP response that as provided as client response. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NetworkClient(String urlBasePart)
Creates an HTTP client that uses the given URL base part for its requests. The URL base part looks like follows.
schema: protocol://host:port/context
example: http://api.craftforge.net:8080/core
The URL base part is prefixed to every URL info part of a request. Together with an optional URL query part the complete request URL is assembled from these three parts.
urlBasePart - The URL base part| Method Detail |
|---|
public ClientResponse performRequest(ClientRequest clientRequest)
performRequest in interface ClientclientRequest - The client request
protected org.apache.http.client.methods.HttpRequestBase getHttpRequest(ClientRequest request)
throws URISyntaxException
request - The client request
URISyntaxException - if the request or base URI is not validprotected org.apache.http.params.HttpParams getRequestParameters(Map<String,String[]> parameters)
parameters - The parameter map
protected org.apache.http.Header[] getRequestHeaders(Map<String,String[]> headers)
headers - The header map
protected ClientResponse getClientResponse(org.apache.http.HttpResponse httpResponse)
throws IOException
httpResponse - The http response
IOException - if the response reading failedprotected Map<String,String[]> getResponseHeaders(org.apache.http.Header[] headers)
headers - The response HTTP headers
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||