public class HttpUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
HTTP_PREFIX |
static String |
HTTPS_PREFIX |
| Constructor and Description |
|---|
HttpUtils() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.http.entity.mime.MultipartEntity |
buildMultipartRequest(Map<String,org.apache.sling.api.request.RequestParameter[]> params)
Takes a map of parameters, and adds them to a multipart entity that can be used
|
static HttpURLConnection |
cloneConnection(HttpURLConnection httpURLConnection)
Deprecated.
- Not in use
|
static HttpURLConnection |
cloneConnection(String remoteHostUri,
String basicAuthToken,
javax.servlet.http.HttpServletRequest httpServletRequest)
A connection clone method.
|
static String |
createQueryString(Map<String,String> params) |
static String |
getBasicAuthToken(String username,
String password)
Create a new Basic Authentication token for use in an Authorization header
|
static void |
httpRequest(HttpsURLConnection httpsURLConnection,
OutputStream outputStream)
A helper to handle submitting custom HttpsURLConnection
|
static void |
httpRequest(HttpURLConnection httpsURLConnection,
OutputStream outputStream)
A helper to handle submitting custom HttpURLConnection
|
static void |
httpRequest(String requestURL,
String basicAuthToken,
String method,
OutputStream outputStream)
A convenience request handler to submit generic GET/POST requests to endpoints
|
static Map<String,org.apache.sling.api.request.RequestParameter[]> |
parseMultipartParams(org.apache.sling.api.SlingHttpServletRequest request)
Parses multipart parameters and returns a map or RequestParameters
|
static void |
proxyRequest(String remoteHostUri,
String basicAuthToken,
String acceptedResponse,
boolean enforceSSL,
org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response)
A method used to request delegation.
|
public static final String HTTPS_PREFIX
public static final String HTTP_PREFIX
public static String getBasicAuthToken(String username, String password)
username - password - public static String createQueryString(Map<String,String> params) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static void httpRequest(String requestURL, String basicAuthToken, String method, OutputStream outputStream) throws ServerException, IOException
requestURL - basicAuthToken - method - outputStream - ServerExceptionIOExceptionpublic static void httpRequest(HttpsURLConnection httpsURLConnection, OutputStream outputStream) throws ServerException, IOException
httpsURLConnection - basicAuthToken - method - outputStream - ServerExceptionIOExceptionpublic static void httpRequest(HttpURLConnection httpsURLConnection, OutputStream outputStream) throws ServerException, IOException
httpsURLConnection - basicAuthToken - method - outputStream - ServerExceptionIOExceptionpublic static void proxyRequest(String remoteHostUri, String basicAuthToken, String acceptedResponse, boolean enforceSSL, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws ServerException, IOException, javax.servlet.ServletException
remoteHostUri - basicAuthToken - enforceSSL - request - response - ServerExceptionIOExceptionjavax.servlet.ServletExceptionpublic static org.apache.http.entity.mime.MultipartEntity buildMultipartRequest(Map<String,org.apache.sling.api.request.RequestParameter[]> params) throws IOException
params - IOExceptionpublic static Map<String,org.apache.sling.api.request.RequestParameter[]> parseMultipartParams(org.apache.sling.api.SlingHttpServletRequest request) throws javax.servlet.ServletException
request - javax.servlet.ServletExceptionpublic static HttpURLConnection cloneConnection(HttpURLConnection httpURLConnection) throws IOException
httpURLConnection - IOExceptionpublic static HttpURLConnection cloneConnection(String remoteHostUri, String basicAuthToken, javax.servlet.http.HttpServletRequest httpServletRequest) throws IOException, javax.servlet.ServletException
httpServletRequest - IOExceptionjavax.servlet.ServletExceptionCopyright © 2021. All rights reserved.