Class GetUrlContent
java.lang.Object
org.epics.archiverappliance.utils.ui.GetUrlContent
Small utility for getting the contents of an URL as various things
- Author:
- mshankar
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCheck if we get a valid response from this URLstatic org.json.simple.JSONArraycombineJSONArrays(List<String> urlStrs) Combine JSON arrays from multiple URL's in sequence and return a JSON Array.static voidcombineJSONArrays(List<Map<String, String>> dest, org.json.simple.JSONArray additionalDetails) A static utilty method to combine JSON objectsstatic voidcombineJSONArraysAndPrintln(List<String> urlStrs, PrintWriter out) Combine JSON arrays of JSON objects from multiple URL's in sequence and sends them to the writer..static voidcombineJSONObjects(Map<String, String> dest, org.json.simple.JSONObject additionalDetails) A static utilty method to combine JSON objectsstatic voidcombineJSONObjectsWithArrays(Map<String, Object> dest, org.json.simple.JSONObject additionalDetails) static org.json.simple.JSONAwarestatic StringgenerateURLWithQueryString(String url, Map<String, String> queryParameters) static org.json.simple.JSONArraygetURLContentAsJSONArray(String urlStr) static org.json.simple.JSONArraygetURLContentAsJSONArray(String urlStr, boolean logErrors) static org.json.simple.JSONObjectgetURLContentAsJSONObject(String urlStr) static org.json.simple.JSONObjectgetURLContentAsJSONObject(String urlStr, boolean logErrors) static InputStreamgetURLContentAsStream(String serverURL) static InputStreamgetURLContentAsStream(String serverURL, boolean redirect) static org.json.simple.JSONAwaregetURLContentWithQueryParameters(String url, Map<String, String> queryParameters, boolean logErrors) Given an URL and some query parameters, get the content of the URLstatic org.json.simple.JSONArraygetURLContentWithQueryParametersAsJSONArray(String url, Map<String, String> queryParameters) static org.json.simple.JSONArraygetURLContentWithQueryParametersAsJSONArray(String url, Map<String, String> queryParameters, boolean logErrors) static org.json.simple.JSONObjectgetURLContentWithQueryParametersAsJSONObject(String url, Map<String, String> queryParameters) static org.json.simple.JSONObjectgetURLContentWithQueryParametersAsJSONObject(String url, Map<String, String> queryParameters, boolean logErrors) static org.json.simple.JSONAwarepostDataAndGetContent(String url, org.json.simple.JSONAware postBody) static org.json.simple.JSONArraypostDataAndGetContentAsJSONArray(String url, org.json.simple.JSONAware postBody) static org.json.simple.JSONObjectpostDataAndGetContentAsJSONObject(String url, org.json.simple.JSONAware postBody) static <T> TpostStringListAndGetJSON(String url, String paramName, Collection<String> params) Post a list of strings to the remove server as a CSV and return the results as a array of JSONObjectsstatic voidGet the contents of a redirect URL and use as reponse for the provided HttpServletResponse.
-
Field Details
-
ARCHAPPL_COMPONENT
- See Also:
-
-
Method Details
-
generateURLWithQueryString
-
getURLContentWithQueryParameters
public static org.json.simple.JSONAware getURLContentWithQueryParameters(String url, Map<String, String> queryParameters, boolean logErrors) Given an URL and some query parameters, get the content of the URL- Parameters:
url- URLqueryParameters- Map- Returns:
- URL content as a JSON Object
-
getURLContentWithQueryParametersAsJSONObject
-
getURLContentWithQueryParametersAsJSONArray
-
getURLContentWithQueryParametersAsJSONObject
-
getURLContentWithQueryParametersAsJSONArray
-
getURLContentAsJSONArray
-
getURLContentAsJSONArray
-
getURLContentAsJSONObject
-
getURLContentAsJSONObject
public static org.json.simple.JSONObject getURLContentAsJSONObject(String urlStr, boolean logErrors) -
combineJSONArrays
Combine JSON arrays from multiple URL's in sequence and return a JSON Array. We need the supress warnings here as JSONArray is a raw collection.- Parameters:
urlStrs- multiple URLs- Returns:
- Combined JSON arrays
-
combineJSONArraysAndPrintln
Combine JSON arrays of JSON objects from multiple URL's in sequence and sends them to the writer.. The difference from combineJSONArrays is that inserts a newline after each element.- Parameters:
urlStrs- multiple URLsout- PrintWriter
-
combineJSONObjects
public static void combineJSONObjects(Map<String, String> dest, org.json.simple.JSONObject additionalDetails) A static utilty method to combine JSON objects- Parameters:
dest- Details from additionalDetails are added to this.additionalDetails- JSONObject
-
combineJSONArrays
public static void combineJSONArrays(List<Map<String, String>> dest, org.json.simple.JSONArray additionalDetails) A static utilty method to combine JSON objects- Parameters:
dest- Details from additionalDetails are added to this.additionalDetails- JSONArray
-
combineJSONObjectsWithArrays
-
postDataAndGetContent
public static org.json.simple.JSONAware postDataAndGetContent(String url, org.json.simple.JSONAware postBody) throws IOException - Throws:
IOException
-
postDataAndGetContentAsJSONObject
public static org.json.simple.JSONObject postDataAndGetContentAsJSONObject(String url, org.json.simple.JSONAware postBody) throws IOException - Throws:
IOException
-
postDataAndGetContentAsJSONArray
public static org.json.simple.JSONArray postDataAndGetContentAsJSONArray(String url, org.json.simple.JSONAware postBody) throws IOException - Throws:
IOException
-
from
-
postStringListAndGetJSON
public static <T> T postStringListAndGetJSON(String url, String paramName, Collection<String> params) throws IOException Post a list of strings to the remove server as a CSV and return the results as a array of JSONObjects- Parameters:
url- URLparamName-params- a list of strings- Returns:
- JSONArray
- Throws:
IOException-
-
checkURL
Check if we get a valid response from this URL- Parameters:
urlStr- URL
-
getURLContentAsStream
- Throws:
IOException
-
getURLContentAsStream
public static InputStream getURLContentAsStream(String serverURL, boolean redirect) throws IOException - Throws:
IOException
-
proxyURL
public static void proxyURL(String redirectURIStr, javax.servlet.http.HttpServletResponse resp) throws IOException Get the contents of a redirect URL and use as reponse for the provided HttpServletResponse. If possible, pass in error responses as well.- Parameters:
redirectURIStr-resp- HttpServletResponse- Throws:
IOException-
-