This mystery is solved.
http://stackoverflow.com/questions/10184020/in-gwt-devmode-a-simple-web-xml-file-not-is-mapping-a-url-to-a-jsp-even-though

While bug resulted from me not understanding that a servlet container
is basically a chroot bubble (and therefore redefining the notion of
an absolute path), somehow I think it would be more helpful to
document this a bit more explicitly and for webAppCreator to generate
the servlet mapping I show having an absolute path rather than a
welcome-file-list having a relative path.  I'm calling this a bug in
webAppCreator: a wizard should generate code that generalizes in a
straightforward manner.

On Mon, Apr 16, 2012 at 6:48 PM, dsw <[email protected]> wrote:
> http://stackoverflow.com/questions/10184020/in-gwt-devmode-a-simple-web-xml-file-not-is-mapping-a-url-to-a-jsp-even-though
>
> I am using GWT 2.4 to write an app and I am getting some very strange
> behavior with my web.xml file. I am trying to isolate exactly what is wrong
> by building the entire project from scratch as simply as possible and seeing
> if I can reproduce the behavior. So far I have found the following strange
> but simple example where web.xml just does not seem to work as expected. You
> can reproduce it as follows.
>
> Generate the basic app using webAppCreator
>
> gwt-2.4.0/webAppCreator -out waga2 -junit $HOME/junit-4.10/junit-4.10.jar
> com.waga2.Waga2
>
> Rename war/Waga2.html to war/Waga2.jsp. I also put the following at the top
> and bottom so I can see the .jsp run:
>
> <%@ page import="java.util.logging.Logger" %>
> <%
> Logger log = Logger.getLogger("Waga2.jsp");
> log.info("\n\n****Waga2.jsp top");
> %>
> ...
>
> <%
> log.info("****Waga2.jsp bottom");
> %>
>
> When I run this in GWT ant devmode this seems to work as expected: the log
> messages print to the console and I see the sample GWT client app. Now
> change the web.xml file as follows:
>
> diff -r 118335a447ba war/WEB-INF/web.xml
> --- a/war/WEB-INF/web.xml   Mon Apr 16 17:35:38 2012 -0700
> +++ b/war/WEB-INF/web.xml   Mon Apr 16 18:34:30 2012 -0700
> @@ -15,10 +15,14 @@
>      <servlet-name>greetServlet</servlet-name>
>      <url-pattern>/waga2/greet</url-pattern>
>    </servlet-mapping>
> -
> -  <!-- Default page to serve -->
> -  <welcome-file-list>
> -    <welcome-file>Waga2.jsp</welcome-file>
> -  </welcome-file-list>
> +
> +  <servlet>
> +    <servlet-name>Waga2jsp</servlet-name>
> +    <jsp-file>Waga2.jsp</jsp-file>
> +  </servlet>
> +  <servlet-mapping>
> +    <servlet-name>Waga2jsp</servlet-name>
> +    <url-pattern>/Waga2</url-pattern>
> +  </servlet-mapping>
>
>  </web-app>
>
> And modify the build.xml so that GWT devmode will visit the new URL:
>
> diff -r 118335a447ba build.xml
> --- a/build.xml Mon Apr 16 17:35:38 2012 -0700
> +++ b/build.xml Mon Apr 16 18:34:30 2012 -0700
> @@ -62,7 +62,7 @@
>        </classpath>
>        <jvmarg value="-Xmx256M"/>
>        <arg value="-startupUrl"/>
> -      <arg value="Waga2.jsp"/>
> +      <arg value="/Waga2"/>
>        <arg line="-war"/>
>        <arg value="war"/>
>        <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
>
> Now I just get a 404 when I try to visit the page.
>
> HTTP ERROR: 404
>
> Waga2.jsp
> RequestURI=/Waga2
>
> Powered by Jetty://
>
> I pasted in the whole output because it does seem that the server will find
> that /Waga2 maps to Waga2.jsp, but then it can't find Waga2.jsp, even though
> it's there.
>
> waga2$ find . | grep Waga2.jsp
> ./war/Waga2.jsp
>
> Somehow Waga2.jsp is found from the welcome file list, but not from a
> servlet mapping? What am I missing here?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/qtdU4hh30U8J.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to