summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Pitschke2012-07-19 12:36:30 (EDT)
committer Michael Fiedler2012-07-31 08:34:18 (EDT)
commit70d7b302803b82003e2d481293ef3ab5fd8f7ba9 (patch)
tree4c14ac883ac839d12b7c3aa5413022040c6b5546
parent5be15a37737c0a29fd8fea5a91c7ddba54659613 (diff)
downloadorg.eclipse.lyo.core-70d7b302803b82003e2d481293ef3ab5fd8f7ba9.zip
org.eclipse.lyo.core-70d7b302803b82003e2d481293ef3ab5fd8f7ba9.tar.gz
org.eclipse.lyo.core-70d7b302803b82003e2d481293ef3ab5fd8f7ba9.tar.bz2
Bug 385080: Fix usage of httpServletRequest to work on client.refs/changes/61/6861/2
Change-Id: I443554ea4132a55e9fd527bb411d4bafed4169dd Signed-off-by: Steve Pitschke <pitschke@us.ibm.com>
-rw-r--r--OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java16
-rw-r--r--OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java13
2 files changed, 24 insertions, 5 deletions
diff --git a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java
index 3a7f3f2..ef1fd47 100644
--- a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java
+++ b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java
@@ -25,6 +25,7 @@ import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
@@ -118,10 +119,18 @@ public abstract class AbstractOslcRdfXmlProvider
final OutputStream outputStream)
throws WebApplicationException
{
+ boolean isClientSide = false;
+
+ try {
+ httpServletRequest.getMethod();
+ } catch (RuntimeException e) {
+ isClientSide = true;
+ }
+
String descriptionURI = null;
String responseInfoURI = null;
-
- if (queryResult)
+
+ if (queryResult && ! isClientSide)
{
final String method = httpServletRequest.getMethod();
@@ -154,7 +163,8 @@ public abstract class AbstractOslcRdfXmlProvider
}
@SuppressWarnings("unchecked")
- final Map<String, Object> properties =
+ final Map<String, Object> properties = isClientSide ?
+ null :
(Map<String, Object>)httpServletRequest.getAttribute(OSLC4JConstants.OSLC4J_SELECTED_PROPERTIES);
try
diff --git a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java
index 14768cb..1d39e4d 100644
--- a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java
+++ b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java
@@ -100,10 +100,18 @@ public abstract class AbstractOslcRdfJsonProvider
final OutputStream outputStream)
throws WebApplicationException
{
+ boolean isClientSide = false;
+
+ try {
+ httpServletRequest.getMethod();
+ } catch (RuntimeException e) {
+ isClientSide = true;
+ }
+
String descriptionURI = null;
String responseInfoURI = null;
- if (queryResult)
+ if (queryResult && ! isClientSide)
{
final String method = httpServletRequest.getMethod();
@@ -125,7 +133,8 @@ public abstract class AbstractOslcRdfJsonProvider
final JSONObject jsonObject;
@SuppressWarnings("unchecked")
- final Map<String, Object> properties =
+ final Map<String, Object> properties = isClientSide ?
+ null :
(Map<String, Object>)httpServletRequest.getAttribute(OSLC4JConstants.OSLC4J_SELECTED_PROPERTIES);
try