Package org.duracloud.common.web
Class RestHttpHelper
- java.lang.Object
-
- org.duracloud.common.web.RestHttpHelper
-
public class RestHttpHelper extends Object
Provides helper methods for REST tests- Author:
- Bill Branan
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRestHttpHelper.HttpResponse
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description RestHttpHelper()RestHttpHelper(int socketTimeoutMs)ConstructorRestHttpHelper(Credential credential)RestHttpHelper(Credential credential, int socketTimeoutMs)
-
Method Summary
-
-
-
Constructor Detail
-
RestHttpHelper
public RestHttpHelper()
-
RestHttpHelper
public RestHttpHelper(int socketTimeoutMs)
Constructor- Parameters:
socketTimeoutMs- A socket timeout of less than zero indicates "no timeout".
-
RestHttpHelper
public RestHttpHelper(Credential credential)
-
RestHttpHelper
public RestHttpHelper(Credential credential, int socketTimeoutMs)
-
-
Method Detail
-
get
public RestHttpHelper.HttpResponse get(String url) throws Exception
- Throws:
Exception
-
get
public RestHttpHelper.HttpResponse get(String url, Map<String,String> headers) throws Exception
- Throws:
Exception
-
head
public RestHttpHelper.HttpResponse head(String url) throws Exception
- Throws:
Exception
-
delete
public RestHttpHelper.HttpResponse delete(String url) throws Exception
- Throws:
Exception
-
post
public RestHttpHelper.HttpResponse post(String url, String requestContent, Map<String,String> headers) throws Exception
- Throws:
Exception
-
post
public RestHttpHelper.HttpResponse post(String url, String requestContent, String mimeType, Map<String,String> headers) throws Exception
- Throws:
Exception
-
post
public RestHttpHelper.HttpResponse post(String url, InputStream requestContent, String mimeType, long contentLength, Map<String,String> headers) throws Exception
- Throws:
Exception
-
put
public RestHttpHelper.HttpResponse put(String url, String requestContent, Map<String,String> headers) throws Exception
- Throws:
Exception
-
put
public RestHttpHelper.HttpResponse put(String url, String requestContent, String mimeType, Map<String,String> headers) throws Exception
- Throws:
Exception
-
put
public RestHttpHelper.HttpResponse put(String url, InputStream requestContent, String mimeType, long contentLength, Map<String,String> headers) throws Exception
- Throws:
Exception
-
multipartFilePost
public RestHttpHelper.HttpResponse multipartFilePost(String url, File file) throws Exception
- Throws:
Exception
-
multipartFileStreamPost
public RestHttpHelper.HttpResponse multipartFileStreamPost(String url, String fileName, InputStream stream) throws Exception
- Throws:
Exception
-
multipartPost
public RestHttpHelper.HttpResponse multipartPost(String url, org.apache.http.HttpEntity reqEntity) throws Exception
- Throws:
Exception
-
-