Hi all,

I have developed a simple MVC framework, Theseus
(www.brainopolis.com/theseus). It works great for most things, and is very
small (15K jar file) and easy to use. Similar to Struts, but a bit different
in how you develop with it..same principal though.

Recently I am having the pleasure of redeploying our site as a WAR file on
Orion app server. In doing so, I decided to separate the site into 3 WAR
files. Outside, Inside and Admin. First, the outside site is mostly static
with the Login, Signup and Lost Password feature available in that app. The
inside app is after a user logs in. The admin..well, for our internal
employees. I first learned that to log in to the "inside" web-app, I had to
explicitly call the action as part of the inside path. For example, I deploy
the outside site as "root" context /. I deploy the inside site in the
/inside context, and the admin site as the /admin context. Now, the login
process is on the outside of the site, but because the login process creates
and stores an HttpSession object indicating the user is logged in (and
stores their profile info, among other things as it is used on most inside
pages), it is necessary to call /admin/Login.do (part of the MVC
framework..mapped the .do to my controller servlet). If I don't, the login
object is created in the outside context, and the inside site doesn't see
it.

So all this works fine. The problem arises when a user wants to log out.
Because they are in the /inside web-app context, to go to the outside site
it is generally used as /index.jsp... the / being the "root" application
context and pointing to the root web-app. However, the way the MVC
controller works is it gets a RequestDispatcher, then forwards to the
resource. So, if in the .xml config file the resource is /index.jsp,
currently the MVC controller forwards to the index.jsp page in the context
the controller is running in. Therefore, it never seems to be able to get to
the root context when forwarding to the resource.

So I figured if I have each resource in the config file(s) using "relative"
paths via the root, this should solve the problem, but this did not work
either. I looked in the Servlet api, and it appears the
ServletContext.getContext(uri) will return a ServletContext for the web-app
context in the URI. So if the resource is mapped at /admin/page.jsp, the
ServletContext returned should be that of the /admin context. If the
resource is just /index.jsp, the ServletContext shoudld be the root web-app
context. The RequestDispatcher can then be had and used to forward to a
resource in that web-context.

My question is..anyone know if this should work? I am using Orion 1.5.2, and
I assume it works correctly in this manner. My code may not be correct at
this point, but in reading the Servlet 2.2 API, I am not sure if I am
understanding the use of getContext() correctly, and IF once I have that
context, if I need to forward to a URL witin that context.

Interesting trying to prepare to deploy multiple web-apps in which they have
to forward to one another as one navigates the various sites. I think most
people probably deploy single-used web-apps in which all links stay within
the one web-app.

Thanks for any ideas or help.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to