Package io.milton.httpclient
Class Utils
java.lang.Object
io.milton.httpclient.Utils
- Author:
- mcevoyb
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildEncodedUrl(Path path) Convert the path to a url encoded string, by url encoding each path of the path.static voidclose(InputStream in) static voidclose(OutputStream out) static HttpResultexecuteHttpWithResult(org.apache.http.client.HttpClient client, org.apache.http.client.methods.HttpUriRequest m, OutputStream out, org.apache.http.protocol.HttpContext context) static intexecuteHttpWithStatus(org.apache.http.client.HttpClient client, org.apache.http.client.methods.HttpUriRequest m, OutputStream out, org.apache.http.protocol.HttpContext context) Execute the given request, populate any returned content to the outputstream, and return the status codestatic Stringstatic voidprocessResultCode(int result, String href) static longwrite(InputStream in, OutputStream out, ProgressListener listener) static longwriteBuffered(InputStream in, OutputStream out, ProgressListener listener) Wraps the outputstream in a bufferedoutputstream and writes to it the outputstream is closed and flushed before returning
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
buildEncodedUrl
Convert the path to a url encoded string, by url encoding each path of the path. Will not be suffixed with a slash- Parameters:
path-- Returns:
-
executeHttpWithStatus
public static int executeHttpWithStatus(org.apache.http.client.HttpClient client, org.apache.http.client.methods.HttpUriRequest m, OutputStream out, org.apache.http.protocol.HttpContext context) throws IOException Execute the given request, populate any returned content to the outputstream, and return the status code- Parameters:
client-m-out- - may be null- Returns:
- Throws:
IOException
-
executeHttpWithResult
public static HttpResult executeHttpWithResult(org.apache.http.client.HttpClient client, org.apache.http.client.methods.HttpUriRequest m, OutputStream out, org.apache.http.protocol.HttpContext context) throws IOException - Throws:
IOException
-
close
-
close
-
write
public static long write(InputStream in, OutputStream out, ProgressListener listener) throws IOException - Throws:
IOException
-
writeBuffered
public static long writeBuffered(InputStream in, OutputStream out, ProgressListener listener) throws IOException Wraps the outputstream in a bufferedoutputstream and writes to it the outputstream is closed and flushed before returning- Parameters:
in-out-listener-- Throws:
IOException
-
processResultCode
public static void processResultCode(int result, String href) throws HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException -
format
-