When debugging using GWT devmode, how do I redirect to URLs on my own server?

901 Views Asked by At

I'm writing an app using GWT and Java Google App Engine. When I launch a page of the app using devmode, I see a URL that has the suffix "?gwt.codesvr=127.0.0.1:9997". Without that suffix, devmode does not seem to work; therefore I assume it must be there when using devmode (to tell the devmode plugin the address of the server talking to the devmode UI, I presume).

In my app I sometimes either use a redirect on the server side to one of my own pages or emit an HTML page that contains a link to one of my own pages. As I want to browse the app the way a user would, in my URL generation code I look for the parameter "gwt.codesvr", get its value, and then put that suffix that back onto the URL as the query string; that is, I copy the query string. I have checked in the generated HTML that this is doing what I expect:

<form class="float-right" action="/foo/id123?gwt.codesvr=127.0.0.1:9997" method="GET" >
<input class="color-red" type=submit value="Get Started" />
</form>

Such links/redirects are intended to move the user from page to page and I thought generating such links would allow me to browse do the same as the user but in devmode; however, it does not seem to be working. In particular, when I click on the link to go to the next page, the query string does not show up in the URL in the browser. That is, the URL in the location bar of Chrome is:

http://127.0.0.1:8888/foo/id123?

I don't really know how it is possible to click on a link and have the browser go to the same url but minus the query string (but not missing the "?").

In my app, I am generating the link in Intro.jsp which should forward to /foo/id123?gwt.codesvr=127.0.0.1:9997. My app.yaml headers section says something similar to this:

handlers:

- url: /Intro
  jsp: Intro.jsp

# the internal rpc service
- url: /waga/rpc
  name: WagaServiceImpl
  servlet: com.waga.server.WagaServiceImpl
  login: required

- url: /foo/*
  name: FooServlet
  servlet: com.waga.server.FooServlet
  login: required
1

There are 1 best solutions below

0
On

Your problem is related to passing parameters in the action URL. This question has been answered here. It seems it is not possible to alter the query string in the action URL. One alternative would to use hidden inputs to pass parameters. Another approach will be to use hyperlinks.

<a href="/foo/id123?gwt.codesvr=127.0.0.1:9997">Link</a>