summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Padgett2011-11-09 15:06:02 (EST)
committer Michael Fiedler2012-01-10 15:21:33 (EST)
commit4effec0b3987b23fd5a1ab9fc968841548cdf56e (patch)
treec807ac94227326473d0b5b9183afc05ac5de1aae
parent7046f4cfe7e0718b1b4d1ce48571d33cf0be069b (diff)
downloadorg.eclipse.lyo.server-4effec0b3987b23fd5a1ab9fc968841548cdf56e.zip
org.eclipse.lyo.server-4effec0b3987b23fd5a1ab9fc968841548cdf56e.tar.gz
org.eclipse.lyo.server-4effec0b3987b23fd5a1ab9fc968841548cdf56e.tar.bz2
Bug 363379 - Bugzilla adapater should accept application/xml, not just
application/rdf+xml
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java22
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestService.java6
2 files changed, 11 insertions, 17 deletions
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java
index c36d269..938d4da 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java
@@ -19,9 +19,7 @@ package org.eclipse.lyo.samples.bugzilla;
import java.io.IOException;
import java.net.URI;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
@@ -58,24 +56,17 @@ import com.hp.hpl.jena.rdf.model.ModelFactory;
*/
public class ChangeRequestCollectionService extends HttpServlet {
private static final long serialVersionUID = -5280734755943517104L;
- private static final Map<String, String> PREFIXES = new HashMap<String, String>();
- static {
- PREFIXES.put("oslc", "http://open-services.net/ns/core#");
- PREFIXES.put("oslc_cm", "http://open-services.net/ns/cm#");
- PREFIXES.put("dcterms", "http://purl.org/dc/terms/");
- PREFIXES.put("foaf", "http://xmlns.com/foaf/0.1/");
- PREFIXES.put("bugz", "http://www.bugzilla.org/rdf#");
- }
-
+
public ChangeRequestCollectionService() {}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String lang = null;
- if (request.getContentType().startsWith("application/rdf+xml")) {
- lang = "RDF/XML";
+ if (request.getContentType().startsWith("application/rdf+xml")
+ || request.getContentType().startsWith("application/xml")) {
+ lang = RdfUtils.JENA_LANG_RDF_XML;
} else if (request.getContentType().startsWith("text/turtle")) {
- lang = "TURTLE";
+ lang = RdfUtils.JENA_LANG_TURTLE;
} else {
response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
return;
@@ -193,7 +184,8 @@ public class ChangeRequestCollectionService extends HttpServlet {
final RequestDispatcher rd = request.getRequestDispatcher("/cm/changerequest_collection_html.jsp");
rd.forward(request, response);
response.flushBuffer();
- } else if (AcceptType.willAccept("application/rdf+xml", request)) {
+ } else if (AcceptType.willAccept("application/rdf+xml", request)
+ || AcceptType.willAccept("application/xml", request)) {
ResponseInfo responseInfo = new ResponseInfo();
responseInfo.setTitle("Bugzilla Query Result");
responseInfo.setNextPage(new URI(URLStrategy
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestService.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestService.java
index 1388b65..4a6e759 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestService.java
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestService.java
@@ -110,7 +110,8 @@ public class ChangeRequestService extends HttpServlet {
response.sendRedirect(BugzillaInitializer.getBugzillaUri() + "/show_bug.cgi?id=" + bugId);
return;
- } else if (AcceptType.willAccept("application/rdf+xml", request)) {
+ } else if (AcceptType.willAccept("application/rdf+xml", request)
+ || AcceptType.willAccept("application/xml", request)) {
response.setHeader("OSLC-Core-Version", "2.0");
response.setHeader("Content-Type", "application/rdf+xml");
RdfUtils.sendRdfResponse(response, bug, RdfUtils.JENA_LANG_ABBREVIATED_RDF_XML);
@@ -146,7 +147,8 @@ public class ChangeRequestService extends HttpServlet {
System.err.println("CR.doPUT - Accept: " + request.getHeader("Accept")
+ ", query=" + request.getQueryString());
- if (!request.getContentType().startsWith("application/rdf+xml")) {
+ if (!request.getContentType().startsWith("application/rdf+xml")
+ && !request.getContentType().startsWith("application/xml")) {
response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
return;
}