aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornegrello2013-11-11 13:53:16 (EST)
committerSamuel Padgett2013-11-14 08:33:48 (EST)
commitc6edf19719c6a0a9cdb20cd1ba2f3e02b06db186 (patch)
tree94cdecb131c7af2ae029e2a2d7d6dc6a52c68b7c
parent90cd085cb2709e72aa2d15344ffe25922890e416 (diff)
downloadorg.eclipse.lyo.core-c6edf19719c6a0a9cdb20cd1ba2f3e02b06db186.zip
org.eclipse.lyo.core-c6edf19719c6a0a9cdb20cd1ba2f3e02b06db186.tar.gz
org.eclipse.lyo.core-c6edf19719c6a0a9cdb20cd1ba2f3e02b06db186.tar.bz2
Bug 421476: Allow custom URI for ResponseInfo containerrefs/changes/15/18315/2
Change-Id: I8f785552b4569315d35851a27612fe673c952f80 Signed-off-by: negrello <fnegre@br.ibm.com>
-rw-r--r--org.eclipse.lyo.oslc4j.provider.jena/src/main/java/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlProvider.java23
-rw-r--r--org.eclipse.lyo.oslc4j.provider.json4j/src/main/java/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonProvider.java25
2 files changed, 39 insertions, 9 deletions
diff --git a/org.eclipse.lyo.oslc4j.provider.jena/src/main/java/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlProvider.java b/org.eclipse.lyo.oslc4j.provider.jena/src/main/java/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlProvider.java
index 67f2fd6..2faf7e2 100644
--- a/org.eclipse.lyo.oslc4j.provider.jena/src/main/java/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlProvider.java
+++ b/org.eclipse.lyo.oslc4j.provider.jena/src/main/java/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlProvider.java
@@ -27,6 +27,7 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.net.URI;
import java.util.Collection;
import java.util.Map;
@@ -163,8 +164,24 @@ public class OslcRdfXmlProvider
if (filteredResource instanceof ResponseInfo<?>)
{
- descriptionURI = OSLC4JUtils.resolveURI(httpServletRequest, true);
- responseInfoURI = descriptionURI;
+ responseInfo = (ResponseInfo<?>)filteredResource;
+
+ String requestURI = OSLC4JUtils.resolveURI(httpServletRequest, true);
+ responseInfoURI = requestURI;
+
+ FilteredResource<?> container = responseInfo.getContainer();
+ if (container != null)
+ {
+ URI containerAboutURI = container.getAbout();
+ if (containerAboutURI != null)
+ {
+ descriptionURI = containerAboutURI.toString();
+ }
+ }
+ if (null == descriptionURI)
+ {
+ descriptionURI = requestURI;
+ }
final String queryString = httpServletRequest.getQueryString();
@@ -185,8 +202,6 @@ public class OslcRdfXmlProvider
objects = collection.toArray(new Object[collection.size()]);
}
-
- responseInfo = (ResponseInfo<?>)filteredResource;
}
else
{
diff --git a/org.eclipse.lyo.oslc4j.provider.json4j/src/main/java/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonProvider.java b/org.eclipse.lyo.oslc4j.provider.json4j/src/main/java/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonProvider.java
index 5e045a7..28bfda6 100644
--- a/org.eclipse.lyo.oslc4j.provider.json4j/src/main/java/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonProvider.java
+++ b/org.eclipse.lyo.oslc4j.provider.json4j/src/main/java/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonProvider.java
@@ -27,6 +27,7 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.net.URI;
import java.util.Collection;
import java.util.Map;
@@ -159,9 +160,25 @@ public final class OslcRdfJsonProvider
properties = filteredResource.properties();
if (filteredResource instanceof ResponseInfo<?>)
- {
- descriptionURI = OSLC4JUtils.resolveURI(httpServletRequest, true);
- responseInfoURI = descriptionURI;
+ {
+ responseInfo = (ResponseInfo<?>)filteredResource;
+
+ String requestURI = OSLC4JUtils.resolveURI(httpServletRequest, true);
+ responseInfoURI = requestURI;
+
+ FilteredResource<?> container = responseInfo.getContainer();
+ if (container != null)
+ {
+ URI containerAboutURI = container.getAbout();
+ if (containerAboutURI != null)
+ {
+ descriptionURI = containerAboutURI.toString();
+ }
+ }
+ if (null == descriptionURI)
+ {
+ descriptionURI = requestURI;
+ }
final String queryString = httpServletRequest.getQueryString();
@@ -182,8 +199,6 @@ public final class OslcRdfJsonProvider
objects = collection.toArray(new Object[collection.size()]);
}
-
- responseInfo = (ResponseInfo<?>)filteredResource;
}
else
{