mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 18:14:26 +00:00
Adds content negotiation to XMLUI.
This commit is contained in:
@@ -76,10 +76,19 @@ public class NegotiationFilter implements Filter
|
|||||||
|
|
||||||
String handle = null;
|
String handle = null;
|
||||||
String extraPathInfo = null;
|
String extraPathInfo = null;
|
||||||
|
String path = hrequest.getPathInfo();
|
||||||
|
// in JSPUI the pathInfo starts after /handle, in XMLUI it starts with /handle
|
||||||
|
Pattern handleCheckPattern = Pattern.compile("^/*handle/(.*)$");
|
||||||
|
Matcher handleCheckMatcher = handleCheckPattern.matcher(path);
|
||||||
|
if (handleCheckMatcher.matches())
|
||||||
|
{
|
||||||
|
// remove trailing /handle
|
||||||
|
path = handleCheckMatcher.group(1);
|
||||||
|
}
|
||||||
// we expect the path to be in the form <prefix>/<suffix>/[<stuff>],
|
// we expect the path to be in the form <prefix>/<suffix>/[<stuff>],
|
||||||
// where <prefix> is a handle prefix, <suffix> is the handle suffix
|
// where <prefix> is a handle prefix, <suffix> is the handle suffix
|
||||||
// and <stuff> may be further information.
|
// and <stuff> may be further information.
|
||||||
String path = hrequest.getPathInfo();
|
log.debug("PathInfo: " + path);
|
||||||
if (path == null) path = "";
|
if (path == null) path = "";
|
||||||
Pattern pathPattern =
|
Pattern pathPattern =
|
||||||
Pattern.compile("^/*([^/]+)/+([^/]+)(?:/*||/+(.*))?$");
|
Pattern.compile("^/*([^/]+)/+([^/]+)(?:/*||/+(.*))?$");
|
||||||
@@ -89,6 +98,7 @@ public class NegotiationFilter implements Filter
|
|||||||
handle = pathMatcher.group(1) + "/" + pathMatcher.group(2);
|
handle = pathMatcher.group(1) + "/" + pathMatcher.group(2);
|
||||||
extraPathInfo = pathMatcher.group(3);
|
extraPathInfo = pathMatcher.group(3);
|
||||||
}
|
}
|
||||||
|
log.debug("handle: " + handle + "\n" + "extraPathInfo: " + extraPathInfo);
|
||||||
|
|
||||||
int requestedContent = Negotiator.negotiate(acceptHeader);
|
int requestedContent = Negotiator.negotiate(acceptHeader);
|
||||||
|
|
||||||
|
@@ -110,6 +110,15 @@
|
|||||||
</init-param>
|
</init-param>
|
||||||
</filter>
|
</filter>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Declare a filter to do content negotiation in combination for our
|
||||||
|
Linked Data support.
|
||||||
|
-->
|
||||||
|
<filter>
|
||||||
|
<filter-name>rdf-content-negotiation</filter-name>
|
||||||
|
<filter-class>org.dspace.rdf.negotiation.NegotiationFilter</filter-class>
|
||||||
|
</filter>
|
||||||
|
|
||||||
|
|
||||||
<!-- Filter mappings ================================================ -->
|
<!-- Filter mappings ================================================ -->
|
||||||
|
|
||||||
@@ -137,6 +146,11 @@
|
|||||||
<servlet-name>spring</servlet-name>
|
<servlet-name>spring</servlet-name>
|
||||||
</filter-mapping>
|
</filter-mapping>
|
||||||
|
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>rdf-content-negotiation</filter-name>
|
||||||
|
<url-pattern>/handle/*</url-pattern>
|
||||||
|
</filter-mapping>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
- Use the Cocoon debug filter together with the Cocoon demo webapp
|
- Use the Cocoon debug filter together with the Cocoon demo webapp
|
||||||
<filter-mapping>
|
<filter-mapping>
|
||||||
|
Reference in New Issue
Block a user