How to change the base URL for the app in Hosted Mode??

155 views
Skip to first unread message

TimOnGmail

unread,
May 1, 2009, 11:01:21 PM5/1/09
to Google Web Toolkit
Hi all...

When I run a GWT app in Tomcat, I can specify the base URL in the
web.xml, or just by the fact that the webapp is known by the name of
the directory it's in in the webapps directory.

However, running in the Eclipse plugin, in hosted mode, it seems it
always runs as http://localhost:8080.

How can I change it so that it's http://localhost:8080/myApp or
something different than the default?

- Tim

Rajeev Dayal

unread,
May 4, 2009, 11:03:25 AM5/4/09
to Google-We...@googlegroups.com
Hey Tim,

Right now, we have not built functionality into the Eclipse Plugin to detect when you want to launch your app and hit a particular servlet; we only append to http://localhost:8080/ when you perform a right-click launch against a particular file (HTML or JSP).

To change the default URL for a launch, follow the instructions here (esp. the "GWT Settings" section):

http://code.google.com/eclipse/docs/running_and_debugging.html



Rajeev

k9mab

unread,
May 5, 2009, 11:38:54 AM5/5/09
to Google Web Toolkit
Is it possible to get this to use the actual hostname instead of
localhost?

I'm trying to tie this into CAS auth filter which redirects to a login
page on the CAS server, which in turn redirects back to my page after
auth is successful. I get through the CAS auth ok but the redirect
back to my app doesn't work. I'm guessing that this is because the CAS
client on my side is passing a localhost URL to the CAS server and the
CAS server post-auth redirect back to my app fails because localhost
doesn't have the same meaning over there.

Mike

On May 4, 11:03 am, Rajeev Dayal <rda...@google.com> wrote:
> Hey Tim,
>
> Right now, we have not built functionality into the Eclipse Plugin to detect
> when you want to launch your app and hit a particular servlet; we only
> append tohttp://localhost:8080/when you perform a right-click launch
> against a particular file (HTML or JSP).
>
> To change the default URL for a launch, follow the instructions here (esp.
> the "GWT Settings" section):
>
> http://code.google.com/eclipse/docs/running_and_debugging.html
>
> Rajeev
>
> On Fri, May 1, 2009 at 11:01 PM, TimOnGmail <timbes...@gmail.com> wrote:
>
> > Hi all...
>
> > When I run a GWT app in Tomcat, I can specify the base URL in the
> > web.xml, or just by the fact that the webapp is known by the name of
> > the directory it's in in the webapps directory.
>
> > However, running in the Eclipse plugin, in hosted mode, it seems it
> > always runs ashttp://localhost:8080.

k9mab

unread,
May 5, 2009, 8:52:47 PM5/5/09
to Google Web Toolkit
Never mind (I think). Got it working now, returning from CAS auth and
proceeding as expected. Had to specify host/port in several places and
was overlooking one of them. Still gotta tinker and see how http vs
https plays out, but looking better now than it was.

Mike

On May 5, 11:38 am, k9mab <mab.m...@gmail.com> wrote:
> Is it possible to get this to use the actual hostname instead of
> localhost?
>
> I'm trying to tie this into CAS auth filter which redirects to a login
> page on the CAS server, which in turn redirects back to my page after
> auth is successful. I get through the CAS auth ok but the redirect
> back to my app doesn't work. I'm guessing that this is because the CAS
> client on my side is passing a localhost URL to the CAS server and the
> CAS server post-auth redirect back to my app fails because localhost
> doesn't have the same meaning over there.
>
> Mike
>
> On May 4, 11:03 am, Rajeev Dayal <rda...@google.com> wrote:
>
> > Hey Tim,
>
> > Right now, we have not built functionality into the Eclipse Plugin to detect
> > when you want to launch your app and hit a particular servlet; we only
> > append tohttp://localhost:8080/whenyou perform a right-click launch

X

unread,
May 5, 2009, 10:43:02 PM5/5/09
to Google-We...@googlegroups.com
I use a deferred-binding method to get my urls right for every app / build.

Basically,

public class xSettings{
public String xDatiiUrl(){
   return Document.get().getDomain()+"x51/";
}

and

public class xYourSettings extends xSettings{
@Override
public String xDatiiUrl(){
   return Document.get().getDomain()+"yourUrl/";
}
}

and a module replace-class for each project, so each one can target it's own build folder.

the new module attribute rename-to is handy, as you can define short, SEO-friendly urls, and just compile in a settings class to target that folder.

Keeps your war clean and concise, but might not be useful if your independant modules need to reference common material...  Unless you remember to use Document.get().getDomain()+urlFromWar();
--
"He whose desires are drawn toward knowledge in every form will be absorbed in the pleasures of the soul, and will hardly feel bodily pleasure --I mean, if he be a true philosopher and not a sham one." - Plato
"Wise Words Woven With Will Wakes Worlds" - Alyxandor Artistocles

Rajeev Dayal

unread,
May 6, 2009, 9:30:41 AM5/6/09
to Google-We...@googlegroups.com
If you'd like, you can enter a full URL in the URL field for the launch configuration. That is, you can enter http://yourhostname.com:8080, and the hosted browser will start up and attempt to navigate to that URL. In this example, I'm assuming that you're launch configuration specifies that the built-in server will be listening on port 8080.
Reply all
Reply to author
Forward
0 new messages