[
https://issues.apache.org/jira/browse/SHINDIG-62?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570160#action_12570160
]
Martin Webb commented on SHINDIG-62:
------------------------------------
That maybe so, hjowever a 400 is not a valid response in this scenario. 400 as
per http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
"The request could not be understood by the server due to malformed syntax. The
client SHOULD NOT repeat the request without modifications."
The syntax of the client's request (the browser) is not malformed. The syntax
of the gadget is well-formed.
Can I propose the following patch:
Index:
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/GadgetRenderingServlet.java
===================================================================
---
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/GadgetRenderingServlet.java
(revision 629053)
+++
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/GadgetRenderingServlet.java
(working copy)
@@ -119,7 +119,7 @@
RenderingContext.GADGET, options);
outputGadget(gadget, view, options, contentFilters, resp);
} catch (GadgetServer.GadgetProcessException e) {
- outputErrors(e, resp);
+ outputErrors(e, req, resp);
}
}
@@ -287,6 +287,7 @@
}
private void outputErrors(GadgetServer.GadgetProcessException errs,
+ HttpServletRequest req,
HttpServletResponse resp)
throws IOException {
// TODO: make this way more robust
@@ -301,7 +302,13 @@
// for different error codes.
logger.log(Level.INFO, "Failed to render gadget", error);
}
- resp.sendError(HttpServletResponse.SC_BAD_REQUEST, err.toString());
+ try {
+ req.setAttribute("GadgetServer.GadgetProcessException", errs);
+
req.getRequestDispatcher("pages/processErrors.jsp").include(req, resp);
+ } catch (ServletException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@SuppressWarnings("unchecked")
Along with the attached jsp
(/trunk/java/gadgets/src/main/webapp/pages/processErrors.jsp)
Regards
Martin
> shindig throws an exception when a feature is not supported and outputs HTTP
> ERROR: 400
> ---------------------------------------------------------------------------------------
>
> Key: SHINDIG-62
> URL: https://issues.apache.org/jira/browse/SHINDIG-62
> Project: Shindig
> Issue Type: Bug
> Components: Gadgets Server - Java
> Reporter: Martin Webb
> Assignee: John Hjelmstad
> Attachments: google-examples1.html, google-examples2.html,
> processErrors.jsp
>
>
> I've created a set of gadgets from the examples in the Google Gadget API
> documentation
> I've create two test pages to host the gadgets - the only difference between
> the pages is that the first uses gmodules.com as the gadget server, and the
> second uses the latest shindig codebase:
> http://irtorg.dyndns.org/gadgets/files/container/google-examples1.html -
> gmodules.com
> http://irtorg.dyndns.org/gadgets/files/container/google-examples2.html -
> shindig
> I will use the above two pages to start documenting JIRA issues...
> * shindig throws an exception when a feature is not supported:
> 14-Feb-2008 09:05:57 org.apache.shindig.gadgets.http.GadgetRenderingServlet
> outputErrors
> INFO: Failed to render gadget
> org.apache.shindig.gadgets.GadgetException: drag
> at
> org.apache.shindig.gadgets.GadgetServer$EnqueueFeaturesTask.run(GadgetServer.java:383)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:492)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:475)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> at java.lang.Thread.run(Thread.java:619)
> 2008-02-14 09:05:57.201::WARN: /gadgets/ifr: java.io.IOException: Closed
> 14-Feb-2008 09:05:58 org.apache.shindig.gadgets.http.GadgetRenderingServlet
> outputErrors
> INFO: Failed to render gadget
> org.apache.shindig.gadgets.GadgetException: finance
> at
> org.apache.shindig.gadgets.GadgetServer$EnqueueFeaturesTask.run(GadgetServer.java:383)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:492)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:475)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> at java.lang.Thread.run(Thread.java:619)
> 2008-02-14 09:05:58.421::WARN: /gadgets/ifr: java.io.IOException: Closed
> 14-Feb-2008 09:05:58 org.apache.shindig.gadgets.http.GadgetRenderingServlet
> outputErrors
> INFO: Failed to render gadget
> org.apache.shindig.gadgets.GadgetException: grid
> at
> org.apache.shindig.gadgets.GadgetServer$EnqueueFeaturesTask.run(GadgetServer.java:383)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:492)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:475)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> at java.lang.Thread.run(Thread.java:619)
> 2008-02-14 09:05:58.698::WARN: /gadgets/ifr: java.io.IOException: Closed
> 14-Feb-2008 09:05:58 org.apache.shindig.gadgets.http.GadgetRenderingServlet
> outputErrors
> INFO: Failed to render gadget
> org.apache.shindig.gadgets.GadgetException: grid
> at
> org.apache.shindig.gadgets.GadgetServer$EnqueueFeaturesTask.run(GadgetServer.java:383)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:492)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:475)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> at java.lang.Thread.run(Thread.java:619)
> 2008-02-14 09:05:58.746::WARN: /gadgets/ifr: java.io.IOException: Closed
> 14-Feb-2008 09:05:58 org.apache.shindig.gadgets.http.GadgetRenderingServlet
> outputErrors
> INFO: Failed to render gadget
> org.apache.shindig.gadgets.GadgetException:
> java.lang.IllegalArgumentException: URI is not absolute
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:497)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:475)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.IllegalArgumentException: URI is not absolute
> at java.net.URI.toURL(URI.java:1080)
> at
> org.apache.shindig.gadgets.BasicRemoteContentFetcher.getConnection(BasicRemoteContentFetcher.java:56)
> at
> org.apache.shindig.gadgets.BasicRemoteContentFetcher.fetch(BasicRemoteContentFetcher.java:100)
> at
> org.apache.shindig.gadgets.GadgetServer$SpecLoadTask.run(GadgetServer.java:325)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:492)
> ... 9 more
> 2008-02-14 09:05:58.760::WARN: /gadgets/ifr: java.io.IOException: Closed
> 14-Feb-2008 09:05:59 org.apache.shindig.gadgets.http.GadgetRenderingServlet
> outputErrors
> INFO: Failed to render gadget
> org.apache.shindig.gadgets.GadgetException: drag
> at
> org.apache.shindig.gadgets.GadgetServer$EnqueueFeaturesTask.run(GadgetServer.java:383)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:492)
> at
> org.apache.shindig.gadgets.GadgetServer$WorkflowTask.call(GadgetServer.java:475)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> at java.lang.Thread.run(Thread.java:619)
> 2008-02-14 09:05:59.643::WARN: /gadgets/ifr: java.io.IOException: Closed
> * additionally the gadget outputs:
> HTTP ERROR: 400
> BAD_REQUEST
> RequestURI=/gadgets/ifr
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.