On Sun, 26 Jan 2003, Paul Phillips wrote:
> Date: Sun, 26 Jan 2003 12:08:32 -0600 > From: Paul Phillips <[EMAIL PROTECTED]> > Reply-To: Tomcat Users List <[EMAIL PROTECTED]> > To: Tomcat Users List <[EMAIL PROTECTED]> > Subject: URL alias > > I have a web application that I have written that uses a controller > servlet. The controller fires off event handlers that process the various > forms submitted by the user in various parts of the webapp. > > I am also using container managed security (forms based). > > A typical URL will look like this: > > http://myhost:8080/webappname/controller?event=login > > or event=whatever, depending on where they are in the webapp. > > Just for convenience sake, I would like to make an alias for login purposes > that looks something like: > > http://myhost:8080/webappname/login > > I can't figure out how to map that to my controller servlet AND at the same > time include the parameter event=login. > > The servlet-mapping configuration in web.xml will allow me to map login -> > controller, but how do I throw in the parameter and its value? > You cannot map a security constraint to a pattern like this (including the query parameter) - the closest you could come would be mapping to the "/controller" part, but that would mean all events have the same security constraint -- most likely not what you want. Instead, consider mapping your controller servlet to the pattern "/controller/*" and changing the way your event selection works. Make the URL look like this instead: http://myhost:8080/webappname/controller/login and you'll be able to define different security constraints to different events. In your controller servlet, you retrieve the selected event by calling request.getPathInfo(). A third alternative would be to use extension mapping (in Struts-based apps, a common convention is to map the "*.do" pattern because it implies "go DO something"). Then, the URL would be something like: http://myhost:8080/webappname/login.do and grab the event name by calling request.getServletPath() and stripping the extension off. > Thanks > Paul Phillips > Craig McClanahan -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>