Entry Point

27 views
Skip to first unread message

athul gopal

unread,
Dec 14, 2011, 5:39:38 AM12/14/11
to Google Web Toolkit
Hi,
How we can use multiple entry points in a page..??

Ed

unread,
Dec 14, 2011, 10:08:31 AM12/14/11
to google-we...@googlegroups.com
What do you want to do?

Javo Rosales

unread,
Dec 14, 2011, 9:40:33 AM12/14/11
to google-we...@googlegroups.com
Nope, you only have one entry point

2011/12/14 athul gopal <mr....@gmail.com>
Hi,
    How we can use multiple entry points in a page..??

--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Maximilian Eberl

unread,
Dec 20, 2011, 3:53:34 AM12/20/11
to google-we...@googlegroups.com
I do the following:

Create an application in a war named ROOT.war - when deployed to
Tomcat this reacts to
www.myserver.com/index.html

Let us assume You want three "entry points"
/ - (the main application - public)
/membersonly - login secured area
/admin - the admin area

So create two folders in /war
/war/admin
/war/members

In these folders create an HTML page like
!DOCTYPE html
html
head
meta http-equiv="refresh" content="0; URL=/index.html?admin"
/head
body /body
/html

So any call to www.myserver.com/admin
will be redirected to
www.myserver.com/index.html?admin

Now create a Main.java as real entry point:

public void onModuleLoad() {
String url = Window.Location.getHref();

if ( url.indexOf("?admin")>-1 ) {
Admin admin = new Admin();
RootPanel.get().add(admin);
} else if ( url.indexOf("?member")>-1 ) {
Member member = new Member();
RootPanel.get().add(member);
} else {
Application app = new Application();
RootPanel.get().add(app);
}
}

Any of these (Admin.java, Member.java, Application.java) is the base
of its own GWT client app. They share all services, libs and shared
classes and resources.

Works perfect for me.

Ed Bras

unread,
Dec 20, 2011, 10:12:57 AM12/20/11
to google-we...@googlegroups.com
> I do the following:
It's not a very elegant solution and you still have only one entry point.
You mainly dispatch depending on the action found in the url.

I would definitely get ride of the refresh action which causes an extra server-client round trip. Round trips should be minimized as much as possible as they are costly.
In your case they aren't needed.
Examples:
You use Tomcat, so use a dynamic hosting page that uses a servlet that set some properties in the html page that will be used by the dispatcher. Works very fast.
Or if you use a front-end web server (in front of your tomcat) let the web server do the redirection.
etc.... pick one..

- Ed


Reply all
Reply to author
Forward
0 new messages