com.ephox.editlive.http.manager
Interface HttpManager


public interface HttpManager

Basic HttpManager interface for low-level control over HTTP requests. Instance available via HttpManagerFactory.

NOTE: No caching is performed when using these methods; for cached responses use one of the specific managers.

Since:
7.5

Field Summary
static String CONTENT_ENCODING
           
static String CONTENT_LENGTH
           
static String CONTENT_TYPE
           
 
Method Summary
 HttpResponse get(URL url)
          Sends a GET request.
 HttpResponse headRequest(URL url)
          Sends a HEAD request.
 HttpResponse post(URL url, String charset, NameValuePair... formFields)
          Sends a POST request.
 HttpResponse postFile(URL url, File file)
          Uploads a file using a multipart POST request.
 HttpResponse postFile(URL url, File file, String uploadFileFieldName, List<NameValuePair> headers, List<NameValuePair> formFields)
          Uploads a file using a multipart POST request with complete control over the request including the uploadFileFieldName.
 HttpResponse putFile(URL url, File file)
          Uploads a file using a PUT request.
 

Field Detail

CONTENT_TYPE

static final String CONTENT_TYPE
See Also:
Constant Field Values

CONTENT_ENCODING

static final String CONTENT_ENCODING
See Also:
Constant Field Values

CONTENT_LENGTH

static final String CONTENT_LENGTH
See Also:
Constant Field Values
Method Detail

get

HttpResponse get(URL url)
Sends a GET request.

Parameters:
url - the URL to open a connection to.

post

HttpResponse post(URL url,
                  String charset,
                  NameValuePair... formFields)
Sends a POST request.

Parameters:
url - the URL to post to.
charset - the character set that will be used to encode POST data
formFields - fields to send with the post request
Returns:
the response details.

postFile

HttpResponse postFile(URL url,
                      File file)
Uploads a file using a multipart POST request. The file will be uploaded with the form field name "image" unless one is specified in the uploadFileFieldName attribute of the httpUpload configuration file element.

Note that as of 8.1.0.133 httpUploadData/httpPostData settings in the configuration are not used here due to availablity of the new method below.

Parameters:
url - the URL to upload to.
file - the file to upload.
Returns:
the response details.

postFile

HttpResponse postFile(URL url,
                      File file,
                      String uploadFileFieldName,
                      List<NameValuePair> headers,
                      List<NameValuePair> formFields)
Uploads a file using a multipart POST request with complete control over the request including the uploadFileFieldName. As such, unlike regular postFile(URL, File) this API ignores the uploadFileFieldName attribute in the config. httpUploadData/httpPostData settings in the configuration are not used here.

Parameters:
url - the URL to upload to.
file - the file to upload.
uploadFileFieldName - the POST form field name to use for the file.
headers - A list of additional request headers to include.
formFields - A list of form fields, which will be included in the POST form data with content type text/plain.
Returns:
response details.
Since:
8.1.0.133

putFile

HttpResponse putFile(URL url,
                     File file)
Uploads a file using a PUT request.

NOTE: As noted in HttpLayer.SUN documentation, this will always use a HttpClient connection.

Note that httpUploadData/httpPostData settings in the configuration are not used here.

Parameters:
url - the URL to upload to.
file - the file to upload.
Returns:
the response details.

headRequest

HttpResponse headRequest(URL url)
Sends a HEAD request.

Parameters:
url - the URL to request.
Returns:
the response details.

Copyright (c) 2005-2012 Ephox Pty Ltd. All rights reserved.