Dmitri Namiot wrote:

> Hello,
>
> developing own tag I can obtain ServletRequest:
> ServletRequest req=pageContext.getRequest()
> But how can I get HttpServletRequest ?
> I need to access to the header (HttpServletRequest.getHeader())
> within my tag.
>

You will note from the servlet API javadocs that HttpServletRequest extends 
ServletRequest.
Therefore, you can use a class cast:

    HttpServletRequest req =
        (HttpServletRequest) pageContext.getRequest();

This will throw a ClassCastException if the underlying request is not actually an
HttpServletRequest, but most servlet containers I am familiar with only serve HTTP 
requests,
so this should not be a problem.

>
> thank you,
>   Dmitry.

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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