Skip to content

Commit

Permalink
Merge pull request DSpace#861 from tdonohue/DS-2278
Browse files Browse the repository at this point in the history
DS-2278 : Fix two issues in XMLUI which block proper 404 error pages from displaying for some URL patterns
  • Loading branch information
Hardy Pottinger committed Feb 23, 2015
2 parents 0db8178 + b009562 commit 229396d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -66,7 +66,7 @@ public String processHandle(HttpServletRequest request, @PathVariable String pre

DSpaceObject dso = dis.resolve(context, prefix);

if (dso == null) throw new RuntimeException("Cannot find Item!");
if (dso == null) throw new IdentifierNotFoundException("Cannot find Item " + prefix + "!");

request.setAttribute(DSPACE_OBJECT, dso);

Expand Down
8 changes: 8 additions & 0 deletions dspace-xmlui/src/main/webapp/sitemap.xmap
Expand Up @@ -646,6 +646,14 @@
<map:read src="static/{1}/{2}"/>
</map:match>

<!-- DSpace does not have any paths beginning with numbers (0-9). If one is accessed,
assume that it is an identifier & redirect it. This also avoids an internal
error, where the XMLUI AspectMatcher wrongly assumes numbers at beginning
of path are direct references to individual Aspects in the aspect chain.-->
<map:match type="regexp" pattern="(^[0-9]+\/?.*$)">
<map:redirect-to uri="{request:contextPath}/handle/{1}" permanent="yes"/>
</map:match>

</map:pipeline>

<!-- pipline to run external handle server -->
Expand Down

0 comments on commit 229396d

Please sign in to comment.