/** * Gets the base URL of the server, this value is retrieved from the current HTTP request. If no * HTTP request is in progress NULL is returned. Only the use cases where an OWS service or a * REST end-point was target are handled. */ private static String baseUrl() { // let's see if a OWS service was targeted Request owsRequest = Dispatcher.REQUEST.get(); if (owsRequest != null) { // retrieve the base URL from the dispatcher request return RequestUtils.baseURL(Dispatcher.REQUEST.get().getHttpRequest()); } // let's see if a REST end-point was targeted RequestInfo restRequest = RequestInfo.get(); if (restRequest != null) { // retrieve the base URL from REST request return restRequest.getBaseURL(); } // no HTTP request is in progress return null; } }