Package org.ametys.site
Class BackOfficeRequestHelper
java.lang.Object
org.ametys.site.BackOfficeRequestHelper
Helper class that builds the request the front-office makes to the back-office to query a page or a resource.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CloseableHttpClientBuild a HttpClient object parametrizedstatic HttpUriRequestgetRequest(Map objectModel, String page, BackOfficeRequestProxyExtensionPoint requestProxyExtensionPoint) Build a HttpClient request object that will be sent to the back-office to query the page.static voidswitchOnMaintenanceIfNeeded(org.apache.http.HttpResponse cmsResponse) When the response is a 503 code from the BO, we may switch to maintenance mode if the BO is really in maintenance mode
-
Method Details
-
getHttpClient
Build a HttpClient object parametrized- Returns:
- The httpclient object
- Throws:
ServiceUnavailableException- If the server is in maintenance
-
switchOnMaintenanceIfNeeded
When the response is a 503 code from the BO, we may switch to maintenance mode if the BO is really in maintenance mode- Parameters:
cmsResponse- The BO response
-
getRequest
public static HttpUriRequest getRequest(Map objectModel, String page, BackOfficeRequestProxyExtensionPoint requestProxyExtensionPoint) throws IOException Build a HttpClient request object that will be sent to the back-office to query the page.- Parameters:
objectModel- the current object model.page- the wanted page path.requestProxyExtensionPoint- The extension point for adding request headers in BO request- Returns:
- the HttpClient request, to be sent to the back-office.
- Throws:
IOException- if an error occurs building the request.
-