@@ -208,30 +208,34 @@ public String getRecord(
208208 String acceptHeader = StringUtils .isBlank (request .getHeader (HttpHeaders .ACCEPT )) ? MediaType .APPLICATION_XML_VALUE : request .getHeader (HttpHeaders .ACCEPT );
209209 List <String > accept = Arrays .asList (acceptHeader .split ("," ));
210210
211- String defaultFormatter = "xsl-view" ;
211+ String formatterBasePath = metadataUuid + "/formatters/" ;
212+ String defaultFormatterPath = formatterBasePath + "xsl-view" ;
212213 if (accept .contains (MediaType .TEXT_HTML_VALUE ) || accept .contains (MediaType .APPLICATION_XHTML_XML_VALUE )) {
213214 // Check if the language query parameter is a real language supported by the system. If not, fallback to the request language.
214215 String resolvedLanguage = (StringUtils .isNotBlank (language ) && languageUtils .getUiLanguages ().contains (language .toLowerCase ()))
215216 ? language .toLowerCase ()
216217 : languageUtils .getIso3langCode (request .getLocales ());
217218 // If there is a redirect to a record view formatter configured use it, otherwise fallback to the default xsl-view formatter.
218219 String redirect = getRecordViewFormatterRedirect (resolvedLanguage , metadataUuid , recordViewFormatter );
219- return redirect != null ? redirect : "forward:" + (metadataUuid + "/formatters/" + defaultFormatter );
220+ if (StringUtils .isNotBlank (redirect )) {
221+ return redirect ;
222+ }
223+ return "forward:" + defaultFormatterPath ;
220224 } else if (accept .contains ("application/pdf" )) {
221- return "forward:" + ( metadataUuid + "/formatters/" + defaultFormatter ) ;
225+ return "forward:" + defaultFormatterPath ;
222226 } else if (accept .contains (MediaType .APPLICATION_XML_VALUE )) {
223- return "forward:" + (metadataUuid + "/formatters/ xml" );
227+ return "forward:" + (formatterBasePath + "xml" );
224228 } else if (accept .contains (MediaType .APPLICATION_JSON_VALUE )) {
225- return "forward:" + (metadataUuid + "/formatters/ json" );
229+ return "forward:" + (formatterBasePath + "json" );
226230 } else if (accept .contains ("application/zip" )
227231 || accept .contains (MEF_V1_ACCEPT_TYPE )
228232 || accept .contains (MEF_V2_ACCEPT_TYPE )) {
229- return "forward:" + (metadataUuid + "/formatters/ zip" );
233+ return "forward:" + (formatterBasePath + "zip" );
230234 } else {
231235 // FIXME this else is never reached because any of the accepted medias match one of the previous if conditions.
232236 response .setHeader (HttpHeaders .ACCEPT , MediaType .APPLICATION_XHTML_XML_VALUE );
233237 //response.sendRedirect(metadataUuid + "/formatters/" + defaultFormatter);
234- return "forward:" + ( metadataUuid + "/formatters/" + defaultFormatter ) ;
238+ return "forward:" + defaultFormatterPath ;
235239 }
236240 }
237241
0 commit comments