Results 1 to 3 of 3
Thread: Servlet Mapping question.
- 02-17-2010, 10:11 AM #1
Member
- Join Date
- Feb 2010
- Posts
- 2
- Rep Power
- 0
Servlet Mapping question.
Hi everybody :)
This is my first post here, so I apologize in advance for anything I probably will do :p
I need help with a servlet mapping issue. I've created a servlet. The URL to the servlet looks like this:
http://localhost/ec/mail?id=523/8PysK6GF034
"mail" is the servlet, with takes one parameter, id, which I retrieve later with:
req.getParameter("id")
That works fine, no problems there. The slash "523/8PysK6GF034" is just a commodity I have to help me "split" the above string later, inside my servlet.
Again, all this work. However, I want to part the above like this:
http://localhost/ec/mail/523/8PysK6GF034
That means, I want to, somehow, get the string being parsed after the servlet. (523/8PysK6GF034)
How can I do that? My web.xml looks like this (the relevant parts):
The server I use is JBoss, if that is worthy mentioning :)Java Code:<servlet> <servlet-name>WebMailServlet</servlet-name> <servlet-class>xx.xx.xx.xx.WebMailServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>WebMailServlet</servlet-name> <url-pattern>/mail/*</url-pattern> </servlet-mapping>
Thanks in advance.
X
- 02-17-2010, 11:54 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,448
- Rep Power
- 16
Does that mapping get to your servlet then?
If so, what do you have at the moment to try and extract that suffix?
- 02-17-2010, 02:15 PM #3
Member
- Join Date
- Feb 2010
- Posts
- 2
- Rep Power
- 0
Thanks Tolls
I was here trying to find a way to fix this, and I've managed it. All I had to do was to use req.getPathInfo(). That did the trick. Then, with:
And I had all I needed. It is important to notice that the url-pattern:Java Code:String[] temp = req.getPathInfo().split("/"); String message_id =temp[1]; String access_password = temp[2];
made it possible here ;)Java Code:<servlet-mapping> <servlet-name>WebMailServlet</servlet-name> <url-pattern>[B]/mail/*[/B]</url-pattern> </servlet-mapping>
Similar Threads
-
Servlet mapping
By cozsmin in forum Java ServletReplies: 1Last Post: 04-04-2009, 09:15 AM -
Question regarding url-pattern in Servlet
By basark in forum Java ServletReplies: 1Last Post: 09-06-2008, 01:05 PM -
Servlet Question
By sandor in forum Java ServletReplies: 5Last Post: 12-19-2007, 11:27 AM -
About servlet-mapping
By Heather in forum Java ServletReplies: 1Last Post: 07-14-2007, 06:00 PM -
Servlet question
By Peter in forum Java ServletReplies: 2Last Post: 07-04-2007, 01:34 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks