Comments in line below:

> For various reasons, my application has to generate URLs for pages/
> servlets/etc. in the same webapp (for things like images held in my
> database and served by a servlet). It's incredibly annoying that, when
> I'm debugging, I need to use a URL that looks like this:
>
> http://127.0.0.1:8888/Report.html?gwt.codesvr=127.0.0.1:9997#1
>
> and when I've deployed the application, the URL looks completely
> different:
>
> http://www.mysite.com/report/Report.html#1
>
> This difference makes it very difficult to debug my application
> without do a full deployment to the real server, and I *hate* to be
> forced to deploy code that cannot be tested locally, first.


You don't have to do that.


> I actually
> don't mind that the server name/port is different, though even that is
> annoying.


1. Build and deploy your app to a local app server (Tomcat works for me)

2. Edit your /etc/hosts file: 127.0.0.1 www.mysite.com

3. Port forward from 80 to 8080. This can be done with Apache or the
following ipfw rule:
sudo ipfw add 1000 fwd 127.0.0.1,8080 tcp from any to 127.0.0.1 80

4. Uncheck the "Run built-in server" under your Debug Configurations within
Eclipse. While you're there add the following Program arguments, under the
Arguments tab:
-startupUrl http://www.mysite.com/report/Report.html under the Arguments

You should now be able to debug with a URL that resembles:
http://www.mysite.com/report/Report.html?gwt.codesvr=127.0.0.1:9997


> The real problems are the "?gwt.conesvr" argument and the

lack of the the servlet-context name ("/report" in the above example)
> in the debug-mode URL.


See my previous post below for information on how to detect and preserve the
codesvr param:
http://groups.google.com/group/google-web-toolkit/msg/e6d2814e79bc3a45
 <http://groups.google.com/group/google-web-toolkit/msg/e6d2814e79bc3a45>

> Because of these differences, generating URLs is an annoying, fragile,
> and error-prone process. First, I have to detect that I'm running
> under GWT (which isn't too bad --- I can just look for localhost or
> equivalent) and then create special URLs for that situation (which is
> hideously bad, since that code runs only when I'm testing, and
> different code entirely runs when I'm deployed, and that code can't be
> tested properly).


You're generating relative URLs right?


> The fragility comes from the fact that I had to
> change all my if-in-hosted-mode-do-X code when GWT 2 came out, because
> the URL structure had changed.
>
> Ideally, I'd like:
>
> 1) a way to add a servlet-context (e.g., http:/127.0.0.1:8888/
> myServletContext)  to a URL used in debug mode so that I can generate
> a structurally-similar URL for both debugging and deployment. This
> servlet-context part of the URL could simply be ignored by the debug-
> mode web server. I'd be perfectly happy for reasonable restrictions to
> be in place (e.g., you could use "/context" but not "/context/
> subcontext"), or I could specify the context name in the module file
> or some other reasonable place.
>
> 2) no extra garbage (such as "?gwt.codesvr..." added to the URLS.
> Surly, this information can be passed to the debug-mode web server in
> some other way.
>

We've talked about using cookies, but that presents it's own set of issues
for developers. Mainly detecting when you're running in development mode vs.
web mode becomes tricky (and error prone).


>
> If there's some sort of workaround for these problems, I'd love to
> know about it. If there is no workaround, I consider this
> inconsistency to be a serious bug in GWT.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> 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 google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to