Package ghidra.net.http
Class HttpUtil
- java.lang.Object
-
- ghidra.net.http.HttpUtil
-
public class HttpUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description HttpUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.HttpURLConnectiongetContent(java.lang.String httpUrlString, java.util.Properties httpRequestProperties, boolean allowRedirect)Execute an HTTP/HTTPS GET request and return the resulting HttpURLConnection.static java.lang.StringgetFile(java.lang.String httpUrlString, java.util.Properties httpRequestProperties, boolean allowRedirect, java.io.File destFile)Download a file by executing an HTTP/HTTPS GET request.static voidmain(java.lang.String[] args)
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
-
getContent
public static java.net.HttpURLConnection getContent(java.lang.String httpUrlString, java.util.Properties httpRequestProperties, boolean allowRedirect) throws java.net.MalformedURLException, java.io.IOExceptionExecute an HTTP/HTTPS GET request and return the resulting HttpURLConnection.- Parameters:
httpUrlString- HTTP/HTTPS URLhttpRequestProperties- optional HTTP request header values to be included (may be null)allowRedirect- allow site redirects to be handled if true- Returns:
- HttpURLConnection which contains information about the URL
- Throws:
java.net.MalformedURLException- bad httpUrlString specifiedjava.io.IOException- if an error occurs while executing request
-
getFile
public static java.lang.String getFile(java.lang.String httpUrlString, java.util.Properties httpRequestProperties, boolean allowRedirect, java.io.File destFile) throws java.net.MalformedURLException, java.io.IOExceptionDownload a file by executing an HTTP/HTTPS GET request.- Parameters:
httpUrlString- HTTP/HTTPS URLhttpRequestProperties- optional HTTP request header values to be included (may be null)allowRedirect- allow site redirects to be handled if truedestFile- destination file- Returns:
- String representing the content-type of the file, or null if the information is not available
- Throws:
java.net.MalformedURLException- bad httpUrlString specifiedjava.io.IOException- if an error occurs while executing request
-
-