Revision 31491
Added by Alessia Bardi about 10 years ago
modules/cnr-data-information-oai-publisher-common/trunk/src/main/java/eu/dnetlib/data/information/oai/publisher/OAIController.java | ||
---|---|---|
77 | 77 |
private static final String DEFAULT_CONTENT_TYPE = "text/xml;charset=utf-8"; |
78 | 78 |
|
79 | 79 |
/** |
80 |
* optional base url. If present it overrides the X-Forwarded-Url. |
|
81 |
*/ |
|
82 |
private String baseUrl; |
|
83 |
|
|
84 |
/** |
|
85 | 80 |
* error messages map. |
86 | 81 |
*/ |
87 | 82 |
private static Map<String, String> errMessages = new HashMap<String, String>(); |
... | ... | |
302 | 297 |
} |
303 | 298 |
|
304 | 299 |
private String oaiError(final String errCode, final String verb, final ModelMap map) throws Exception { |
305 |
if ((verb == null) || (verb.equals(""))) return oaiError(errCode, map);
|
|
300 |
if (StringUtils.isBlank(verb)) return oaiError(errCode, map);
|
|
306 | 301 |
map.addAttribute("verb", verb); |
307 | 302 |
map.addAttribute("errcode", errCode); |
308 | 303 |
map.addAttribute("errmsg", OAIController.errMessages.get(errCode)); |
... | ... | |
327 | 322 |
@ModelAttribute("url") |
328 | 323 |
public String url(final HttpServletRequest request) { |
329 | 324 |
String forwardedUrl = request.getHeader(getForwardedUrlHeaderName()); |
330 |
if (baseUrl != null) return baseUrl; |
|
331 |
else if (forwardedUrl != null) return forwardedUrl; |
|
325 |
String baseURL = getBaseUrl(); |
|
326 |
if (StringUtils.isNotBlank(baseURL)) return baseURL; |
|
327 |
else if (StringUtils.isNotBlank(forwardedUrl)) return forwardedUrl; |
|
332 | 328 |
else return request.getRequestURL() + ""; |
333 | 329 |
} |
334 | 330 |
|
Also available in: Unified diff
Fixes baseURL handling used by the verb Identify