public final class HttpRestProvider extends Object implements HttpProvider
| Constructor and Description |
|---|
HttpRestProvider(URL url) |
HttpRestProvider(URL url,
Integer timeout) |
| Modifier and Type | Method and Description |
|---|---|
HeaderAndBody |
delete(String id)
Issues an HTTP request, consumes the content, and cleans up
after itself.
|
HeaderAndBody |
get()
Issues an HTTP request, consumes the content, and cleans up
after itself.
|
URL |
getUrl() |
HeaderAndBody |
post(byte[] data)
Issues an HTTP request, consumes the content, and cleans up
after itself.
|
HeaderAndBody |
post(String data)
Issues an HTTP request, consumes the content, and cleans up
after itself.
|
HeaderAndBody |
put(String id,
byte[] data)
Issues an HTTP request, consumes the content, and cleans up
after itself.
|
HeaderAndBody |
put(String id,
String data)
Issues an HTTP request, consumes the content, and cleans up
after itself.
|
void |
setDefaultHeader(String headerName,
String headerValue)
Will set a default header value to be used on all calls
|
public HttpRestProvider(URL url)
public URL getUrl()
getUrl in interface HttpProviderpublic HeaderAndBody get() throws HttpException
get in interface HttpProviderHttpException - if the http request doesn't return status 200public HeaderAndBody post(String data) throws RuntimeException
post in interface HttpProviderdata - the string body of the http requestHttpException - if the http request doesn't return status 200RuntimeExceptionpublic HeaderAndBody post(byte[] data) throws RuntimeException
post in interface HttpProviderdata - the binary body of the http requestHttpException - if the http request doesn't return status 200RuntimeExceptionpublic HeaderAndBody put(String id, String data) throws RuntimeException
put in interface HttpProviderid - an ID which will be appended to the baseURLdata - the string body of the http requestHttpException - if the http request doesn't return status 200RuntimeExceptionpublic HeaderAndBody put(String id, byte[] data) throws RuntimeException
put in interface HttpProviderid - an ID which will be appended to the baseURLdata - the binary body of the http requestHttpException - if the http request doesn't return status 200RuntimeExceptionpublic HeaderAndBody delete(String id) throws RuntimeException
delete in interface HttpProviderid - an ID which will be appended to the baseURLHttpException - if the http request doesn't return status 200RuntimeExceptionpublic void setDefaultHeader(String headerName, String headerValue)
HttpProvidersetDefaultHeader in interface HttpProviderheaderName - nameheaderValue - valueCopyright © 2015 JBoss by Red Hat. All rights reserved.