/** * Performs an HTTP HEAD request using the {@link #performRequest} method. * * @param bucketName the bucket's name * @param objectKey the object's key name, may be null if the operation is on a bucket only. * @param requestParameters parameters to add to the request URL as GET params * @param requestHeaders headers to add to the request * @return the HTTP method object used to perform the request * @throws org.jets3t.service.ServiceException * */ protected HttpResponse performRestHead(String bucketName, String objectKey, Map<String, String> requestParameters, Map<String, Object> requestHeaders) throws ServiceException { HttpUriRequest httpMethod = setupConnection( HTTP_METHOD.HEAD, bucketName, objectKey, requestParameters); // Add all request headers. addRequestHeadersToConnection(httpMethod, requestHeaders); return performRequest(httpMethod, new int[]{200}); }
/** * Performs an HTTP GET request using the {@link #performRequest} method. * * @param bucketName the bucket's name * @param objectKey the object's key name, may be null if the operation is on a bucket only. * @param requestParameters parameters to add to the request URL as GET params * @param requestHeaders headers to add to the request * @param expectedStatusCodes HTTP status response codes expected, anything else causes an exception. * @return The HTTP method object used to perform the request. * @throws org.jets3t.service.ServiceException * */ protected HttpResponse performRestGet(String bucketName, String objectKey, Map<String, String> requestParameters, Map<String, Object> requestHeaders, int[] expectedStatusCodes) throws ServiceException { HttpUriRequest httpMethod = setupConnection( HTTP_METHOD.GET, bucketName, objectKey, requestParameters); // Add all request headers. addRequestHeadersToConnection(httpMethod, requestHeaders); return performRequest(httpMethod, expectedStatusCodes); }
/** * Performs an HTTP HEAD request using the {@link #performRequest} method. * * @param bucketName the bucket's name * @param objectKey the object's key name, may be null if the operation is on a bucket only. * @param requestParameters parameters to add to the request URL as GET params * @param requestHeaders headers to add to the request * @return the HTTP method object used to perform the request * @throws org.jets3t.service.ServiceException * */ protected HttpResponse performRestHead(String bucketName, String objectKey, Map<String, String> requestParameters, Map<String, Object> requestHeaders) throws ServiceException { HttpUriRequest httpMethod = setupConnection( HTTP_METHOD.HEAD, bucketName, objectKey, requestParameters); // Add all request headers. addRequestHeadersToConnection(httpMethod, requestHeaders); return performRequest(httpMethod, new int[]{200}); }
/** * Performs an HTTP GET request using the {@link #performRequest} method. * * @param bucketName the bucket's name * @param objectKey the object's key name, may be null if the operation is on a bucket only. * @param requestParameters parameters to add to the request URL as GET params * @param requestHeaders headers to add to the request * @param expectedStatusCodes HTTP status response codes expected, anything else causes an exception. * @return The HTTP method object used to perform the request. * @throws org.jets3t.service.ServiceException * */ protected HttpResponse performRestGet(String bucketName, String objectKey, Map<String, String> requestParameters, Map<String, Object> requestHeaders, int[] expectedStatusCodes) throws ServiceException { HttpUriRequest httpMethod = setupConnection( HTTP_METHOD.GET, bucketName, objectKey, requestParameters); // Add all request headers. addRequestHeadersToConnection(httpMethod, requestHeaders); return performRequest(httpMethod, expectedStatusCodes); }