pathInfo in a custom tag

2001-07-19 Thread Chris Callaghan

Hi all,

I'm trying to get the request path for a page from inside a custom tag. 
The tag itself extends TagSupport.

I'm getting the ServletRequest object from the pageContext.getRequest() 
- this object is an instanceof HttpServletObject, but when I ask it for 
pathInfo() I get null...

HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
String path = request.getPathInfo(); // aways null?

Is there a way to do this inside the tag, or will I have to pass the 
path in from the JSP?

Cheers
Chris





Re: pathInfo in a custom tag

2001-07-19 Thread Jeff Hubbach

Chris,

I just wanted to make sure you're checking for the right thing in your
code, and if you are I apologize. 
For the following example URL:
http://www.foo.com/FooServlet/testme?hey=you

Assume that FooServlet and FooServlet* are both mapped to FooServlet.

Here are the results of the following calls:
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
String servletPath = request.getServletPath();
// here servletPath = /FooServlet, same as cgi.SCRIPT_NAME
String pathInfo = request.getPathInfo();
// here pathInfo = /testme, same as cgi.PATH_INFO
String queryString = request.getQueryString();
// here queryString = hey=you, same as cgi.QUERY_STRING

If you want some very helpful documentation on CGI variables and their
definitions, check out this URL:
http://cgi-spec.golux.com/draft-coar-cgi-v11-03.html

Jeff Hubbach.

On Fri, 20 Jul 2001 10:36:40 +1200
Chris Callaghan [EMAIL PROTECTED] wrote:

Hi all,

I'm trying to get the request path for a page from inside a custom tag. 
The tag itself extends TagSupport.

I'm getting the ServletRequest object from the pageContext.getRequest() 
- this object is an instanceof HttpServletObject, but when I ask it for 
pathInfo() I get null...

HttpServletRequest request = (HttpServletRequest)
pageContext.getRequest();
String path = request.getPathInfo(); // aways null?

Is there a way to do this inside the tag, or will I have to pass the 
path in from the JSP?

Cheers
Chris






Re: pathInfo in a custom tag

2001-07-19 Thread Chris Callaghan

Haha, got it...

The url I had was http://localhost/myApp/logon.jsp,
so getPathInfo() is null, but getServletPath() was logon.jsp

Kinda obvious really :)
Cheers
Chris

Jeff Hubbach wrote:

Chris,

I just wanted to make sure you're checking for the right thing in your
code, and if you are I apologize. 
For the following example URL:
http://www.foo.com/FooServlet/testme?hey=you

Assume that FooServlet and FooServlet* are both mapped to FooServlet.

Here are the results of the following calls:
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
String servletPath = request.getServletPath();
// here servletPath = /FooServlet, same as cgi.SCRIPT_NAME
String pathInfo = request.getPathInfo();
// here pathInfo = /testme, same as cgi.PATH_INFO
String queryString = request.getQueryString();
// here queryString = hey=you, same as cgi.QUERY_STRING

If you want some very helpful documentation on CGI variables and their
definitions, check out this URL:
http://cgi-spec.golux.com/draft-coar-cgi-v11-03.html

Jeff Hubbach.

On Fri, 20 Jul 2001 10:36:40 +1200
Chris Callaghan [EMAIL PROTECTED] wrote:

Hi all,

I'm trying to get the request path for a page from inside a custom tag. 
The tag itself extends TagSupport.

I'm getting the ServletRequest object from the pageContext.getRequest() 
- this object is an instanceof HttpServletObject, but when I ask it for 
pathInfo() I get null...

HttpServletRequest request = (HttpServletRequest)

pageContext.getRequest();

String path = request.getPathInfo(); // aways null?

Is there a way to do this inside the tag, or will I have to pass the 
path in from the JSP?

Cheers
Chris