Title: Message Title
|
|
So, I've *finally* made some headway on this today. Here's a "workaround" that individual institutions can use to tell their DSpace XMLUI to *instead* use a static HTML error page. (It does not use the DSpace theme, but it will let you easily override the ugly DSpace error page with a static one). (1) In your Theme directory (e.g. Mirage/) add one or more static HTML error pages, (e.g. "error.html", "error-404.html", "error-400.html") depending on which errors you want sent to a static page (2) In your Theme's "sitemap.xmap" (e.g. Mirage/sitemap.xmap), add the following to the *END* of the </map:pipelines> tag. For example, you'd add it just before this tag for Mirage: https://github.com/DSpace/DSpace/blob/master/dspace-xmlui/src/main/webapp/themes/Mirage/sitemap.xmap#L168 <!-- Handle any errors thrown by XMLUI --> <map:handle-errors> <map:select type="exception"> <!-- HTTP 400 Bad Request --> <map:when test="bad-request"> <map:generate src="" <map:serialize type="html" status-code="400"/> </map:when> <!-- HTTP 404 Page Not Found --> <map:when test="not-found"> <map:generate src="" <map:serialize type="html" status-code="404"/> </map:when> <!-- All other errors (HTTP 500 Internal Server Error) --> <map:otherwise> <map:generate src="" <map:serialize type="html" status-code="500"/> </map:otherwise> </map:select> </map:handle-errors> (NOTICE: The above "handle-errors" code loads different "error.html" pages based on the actual error. You can obviously customize the *name* of the HTML pages it loads, and even limit it to just display a pretty page for 404 exceptions or similar) (3) Finally, try it out. Go to an invalid URL. You should see your custom "error-404.html" page, and get a 404 response code. Note however that there still may be *some* situations (extreme errors, e.g. the theme itself throws an error) where you'd still encounter the default DSpace error page. But, this would catch most of them. The NEXT STEP is to find an actual fix using the theme itself. I suspect this may require building a "exception2dri.xslt" (which transforms a Cocoon exception into valid DRI). Then, you *should* (hypothetically speaking) be able to apply the DSpace theme itself to get an even better looking error message.
|
|
|
|
|
A wrong URL, producing a 404 Page not Found shows a page like the attached screen shot. Because of the stacktraces and the cryptic error message it almost looks like something serious goes wrong. However, it's just a standard 404. The user experience would be better if the message is at least shown in the DSpace UI the user is familiar with, similar to...
|
|
|
|
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Dspace-devel mailing list
Dspace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-devel