public final class BackOfficeRequestHelper extends Object
Modifier and Type | Field and Description |
---|---|
private static Pattern |
__AUTHORIZED_HEADERS |
private static Set<String> |
__FILTERED_REQUEST_PARAMETERS |
Modifier | Constructor and Description |
---|---|
private |
BackOfficeRequestHelper() |
Modifier and Type | Method and Description |
---|---|
private static void |
_addMultipartEntityToBuilder(org.apache.http.entity.mime.MultipartEntityBuilder builder,
String paramName,
Object value) |
private static void |
_addRequestHeaders(Request request,
HttpUriRequest boRequest,
RequestHeaderExtensionPoint requestHeaderEP)
Add headers indicating this is a request from the front-office to the back-office,
specifying the user if applicable.
|
private static void |
_copyCookieHeaders(Request request,
HttpUriRequest boRequest)
Copy cookie headers that were sent by the client into the request
that will be sent to the back-office.
|
private static org.apache.http.entity.mime.MultipartEntityBuilder |
_getMultipartEntityBuilder(Request request)
Get the front-office request's parameters as an HttpClient MultipartEntity,
to be added to a POST back-office request.
|
private static String |
_getParameters(Request request)
Get the front-office request's parameters as a String, to be added to
a GET back-office request.
|
static CloseableHttpClient |
getHttpClient()
Build a HttpClient object parametrized
|
static HttpUriRequest |
getRequest(Map objectModel,
String page,
RequestHeaderExtensionPoint requestHeaderEP)
Build a HttpClient request object that will be sent to the back-office to query the page.
|
private static final Pattern __AUTHORIZED_HEADERS
private static final Set<String> __FILTERED_REQUEST_PARAMETERS
private BackOfficeRequestHelper()
public static CloseableHttpClient getHttpClient()
public static HttpUriRequest getRequest(Map objectModel, String page, RequestHeaderExtensionPoint requestHeaderEP) throws IOException
objectModel
- the current object model.page
- the wanted page path.requestHeaderEP
- The extension point for adding request headers in BO requestIOException
- if an error occurs building the request.private static org.apache.http.entity.mime.MultipartEntityBuilder _getMultipartEntityBuilder(Request request) throws IOException
request
- the front-office request.IOException
- if an error occurs extracting the parameters or building the entity.private static void _addMultipartEntityToBuilder(org.apache.http.entity.mime.MultipartEntityBuilder builder, String paramName, Object value) throws IOException
IOException
private static String _getParameters(Request request)
request
- the front-office request.private static void _addRequestHeaders(Request request, HttpUriRequest boRequest, RequestHeaderExtensionPoint requestHeaderEP)
request
- the front-office request.boRequest
- the request object to be sent to the back-office.requestHeaderEP
- The extension point for adding request headers in BO requestprivate static void _copyCookieHeaders(Request request, HttpUriRequest boRequest)
request
- the front-office request.boRequest
- the request object to be sent to the back-office.