[jira] Commented: (NANO-70) Make the sample-nanoweb example actually work
jira-yCVjj/[email protected] Sat, 8 May 2004 02:19:55 -0400 (EDT)
| Newsgroups | gmane.comp.java.nanocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
The following comment has been added to this issue:
Author: Jacob Kjome
Created: Sat, 8 May 2004 2:19 AM
Body:
Hi Kouhei,
Ok, I see how it works now. However, the confusion came from having the game.groovy file in the root of the webapp and knowing that one can use both ".nano" and ".groovy" as action extensions. Without understanding the naming convention (and having a directory listing), it seems logical that clicking on the game.groovy file in the root of the webapp should result in running the action. Instead it produces this...
exception
javax.servlet.ServletException: Path .groovy does not start with a "/" character
org.nanocontainer.nanoweb.NanoWebServlet.getActionObject(NanoWebServlet.java:106)
org.nanocontainer.nanoweb.NanoWebServlet.service(NanoWebServlet.java:61)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
root cause
java.net.MalformedURLException: Path .groovy does not start with a "/" character
org.nanocontainer.nanoweb.NanoWebServlet.getScriptAction(NanoWebServlet.java:117)
org.nanocontainer.nanoweb.NanoWebServlet.getActionObject(NanoWebServlet.java:103)
org.nanocontainer.nanoweb.NanoWebServlet.service(NanoWebServlet.java:61)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
This is not intuitive at all. If we want to have nanoweb actions run per the naming convention, then we shouldn't run a directly accessed .groovy action file. Solutions to this are:
1. Don't recognize .groovy as an action extension, only .nano. Of course what if the file was named "groovy.nano"? Same problem, so this isn't a very good solution.
2. Move action classes inside WEB-INF rather than being available for direct access in the root of the webapp since they aren't supposed to be directly accessed, nor should application logic in action classes be unnecessarily exposed to the outside world. This also applies to the view (.vm, .jsp, etc...).
Or, a compromise on #2. For people that don't care about leaving their action classes out in the open for all to see, let them do that, but also support loading the .groovy templates from, say..., WEB-INF/nano/game.groovy (applies to the view templates as well).
Thoughts? I think the "compromise" would actually be ideal.
Jake
---------------------------------------------------------------------
View this comment:
http://jira.codehaus.org/secure/ViewIssue.jspa?key=NANO-70&page=comments#action_19535
---------------------------------------------------------------------
View the issue:
http://jira.codehaus.org/secure/ViewIssue.jspa?key=NANO-70
Here is an overview of the issue:
---------------------------------------------------------------------
Key: NANO-70
Summary: Make the sample-nanoweb example actually work
Type: Bug
Status: Unassigned
Priority: Major
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NanoContainer
Components:
nanoweb
Assignee:
Reporter: Jacob Kjome
Created: Fri, 23 Apr 2004 3:10 PM
Updated: Sat, 8 May 2004 2:19 AM
Description:
When I tried out the sample-nanoweb app, all I got was a lousy exception. I will be attaching a patch to fix both nanoweb and sample-nanoweb that allows everything to work. I find it odd that existing unit testing doesn't fail, but when running in the real world (under Tomcat-5.0.22) it crashes hard. Makes me think there is a bit of blind faith in the unit tests, since a simple test deployment of the sample-nanoweb webapp in Tomcat would have pointed immediately pointed to a problem with the current implementation.
Anyway, if you want to test it before my patch, just check out the latest CVS and build everything. Copy the generated nanocontainer-sample-nanoweb.war into Tomcat's "webapps" directory. Go to...
http://localhost:8080/nanocontainer-sample-nanoweb/game.groovy
or
http://localhost:8080/nanocontainer-sample-nanoweb/game.nano
Watch it blow up.
Now apply my patch, rebuild, delete the old webapp from Tomcat and copy in the new one. Go to either of the URL's above again and watch it work.
Jake
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira