Package ucar.nc2.util.net
Class HttpClientManager
- java.lang.Object
-
- ucar.nc2.util.net.HttpClientManager
-
public class HttpClientManager extends Object
Convenience routines that wrap HTTPSession.
-
-
Constructor Summary
Constructors Constructor Description HttpClientManager()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static long
appendUrlContentsToFile(String urlencoded, File file, long start, long end)
static long
appendUrlContentsToFile(HTTPSession session, String urlencoded, File file, long start, long end)
Deprecated.static void
copyUrlContentsToFile(String urlencoded, File file)
static void
copyUrlContentsToFile(HTTPSession session, String urlencoded, File file)
Deprecated.static String
getContentAsString(String urlencoded)
Get the content from a url.static String
getContentAsString(HTTPSession session, String urlencoded)
Deprecated.static String
getUrlContentsAsString(String urlencoded, int maxKbytes)
static String
getUrlContentsAsString(HTTPSession session, String urlencoded, int maxKbytes)
Deprecated.static void
init(org.apache.http.client.CredentialsProvider provider, String userAgent)
initialize the HttpClient layer.static int
putContent(String urlencoded, String content)
Put content to a url, using HTTP PUT.
-
-
-
Method Detail
-
init
public static void init(org.apache.http.client.CredentialsProvider provider, String userAgent)
initialize the HttpClient layer.- Parameters:
provider
- CredentialsProvider.userAgent
- Content of User-Agent header, may be null
-
getContentAsString
public static String getContentAsString(String urlencoded) throws IOException
Get the content from a url. For large returns, its better to use getResponseAsStream.- Parameters:
urlencoded
- url as a String- Returns:
- contents of url as a String
- Throws:
IOException
- on error
-
getContentAsString
@Deprecated public static String getContentAsString(HTTPSession session, String urlencoded) throws IOException
Deprecated.Get the content from a url. For large returns, its better to use getResponseAsStream.- Parameters:
session
- use this session, if null, create a new oneurlencoded
- url as a String- Returns:
- contents of url as a String
- Throws:
IOException
- on error
-
putContent
public static int putContent(String urlencoded, String content) throws IOException
Put content to a url, using HTTP PUT. Handles one level of 302 redirection.- Parameters:
urlencoded
- url as a Stringcontent
- PUT this content at the given url.- Returns:
- the HTTP status return code
- Throws:
IOException
- on error
-
getUrlContentsAsString
public static String getUrlContentsAsString(String urlencoded, int maxKbytes) throws IOException
- Throws:
IOException
-
getUrlContentsAsString
@Deprecated public static String getUrlContentsAsString(HTTPSession session, String urlencoded, int maxKbytes) throws IOException
Deprecated.- Throws:
IOException
-
copyUrlContentsToFile
public static void copyUrlContentsToFile(String urlencoded, File file) throws IOException
- Throws:
IOException
-
copyUrlContentsToFile
@Deprecated public static void copyUrlContentsToFile(HTTPSession session, String urlencoded, File file) throws IOException
Deprecated.- Throws:
IOException
-
appendUrlContentsToFile
public static long appendUrlContentsToFile(String urlencoded, File file, long start, long end) throws IOException
- Throws:
IOException
-
appendUrlContentsToFile
@Deprecated public static long appendUrlContentsToFile(HTTPSession session, String urlencoded, File file, long start, long end) throws IOException
Deprecated.- Throws:
IOException
-
-