Package org.cdlib.mrt.utility
Class HttpGet
java.lang.Object
org.cdlib.mrt.utility.HttpGet
- Author:
- dloy This routine is specifically designed to handle dropped connections during an http request
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
build()
void
buildContentLength
(org.apache.http.HttpEntity entity) This routine will perform multiple calls to fix broken connection when content-length existsprotected void
buildNoContentLength
(org.apache.http.HttpEntity entity) This routine is called only when Content-Length not provided on GET responsestatic void
static void
static HttpGet
getHttpGet
(URL contentURL, File outFile, long testSize, int timeout, LoggerInf logger) static InputStream
static InputStream
static DeleteOnCloseFileInputStream
setTempGet
(URL contentURL, long testLength, int timeout, LoggerInf logger) static void
stream2File
(InputStream inStream, File outFile, boolean append) Create a file from a streamurl2Stream
(String urlS, long startByte, long endByte)
-
Field Details
-
NAME
- See Also:
-
MESSAGE
- See Also:
-
BUFSIZE
protected static final int BUFSIZE- See Also:
-
SEGMENT
public static final long SEGMENT- See Also:
-
MAX_RETRY
public static final long MAX_RETRY- See Also:
-
testLength
protected long testLength -
contentLength
protected long contentLength -
timeout
protected int timeout -
contentURL
-
logger
-
outFile
-
-
Constructor Details
-
HttpGet
public HttpGet(URL contentURL, File outFile, long testSize, int timeout, LoggerInf logger) throws TException - Throws:
TException
-
-
Method Details
-
getFile
public static void getFile(URL contentURL, File outFile, int timeout, LoggerInf logger) throws TException - Throws:
TException
-
getFile
public static void getFile(URL contentURL, File outFile, long testLength, int timeout, LoggerInf logger) throws TException - Throws:
TException
-
getStream
public static InputStream getStream(URL contentURL, int timeout, LoggerInf logger) throws TException - Throws:
TException
-
getStream
public static InputStream getStream(URL contentURL, long testLength, int timeout, LoggerInf logger) throws TException - Throws:
TException
-
setTempGet
public static DeleteOnCloseFileInputStream setTempGet(URL contentURL, long testLength, int timeout, LoggerInf logger) throws TException - Throws:
TException
-
getHttpGet
public static HttpGet getHttpGet(URL contentURL, File outFile, long testSize, int timeout, LoggerInf logger) throws TException - Throws:
TException
-
build
- Throws:
TException
-
buildContentLength
This routine will perform multiple calls to fix broken connection when content-length exists- Parameters:
entity
- response entity- Throws:
TException
-
buildNoContentLength
This routine is called only when Content-Length not provided on GET response- Parameters:
entity
- response entity- Throws:
TException
-
stream2File
public static void stream2File(InputStream inStream, File outFile, boolean append) throws TException Create a file from a stream- Parameters:
inStream
- stream used to create fileoutFile
- file to create- Throws:
org.cdlib.mrt.utility.MException
TException
-
url2Stream
- Throws:
TException
-