users@jax-rpc.java.net

Re: HttpServletRequest error???

From: Jitendra Kotamraju <Jitendra.Kotamraju_at_Sun.COM>
Date: Mon, 07 Mar 2005 20:49:34 -0800

Brad,

You should cast property value(not name) to HttpServletContext.
Something like the following should work:
HttpServletRequest req =
(javax.servlet.http.HttpServletRequest)messageContext.getProperty("com.sun.xml.rpc.server.http.HttpServletRequest")

If you have any questions, let us know.

Thanks,
Jitu

Baker, Brad (Contr) wrote:

>Hi Doug,
>
>When I do:
>for (Iterator it = messageContext.getPropertyNames(); it.hasNext();) {
> Object obj = it.next();
> String name = obj.toString();
> System.out.println(name);
>}
>
>I get:
>com.sun.xml.rpc.server.http.HttpServletRequest
>com.sun.xml.rpc.server.http.ServletContext
>com.sun.xml.rpc.server.http.Implementor
>com.sun.xml.rpc.server.http.HttpServletResponse
>
>-----Original Message-----
>From: Doug Kohlert [mailto:Doug.Kohlert_at_Sun.COM]
>Sent: Monday, 07 March 2005 14:50
>To: users_at_jax-rpc.dev.java.net
>Subject: Re: HttpServletRequest error???
>
>Brad,
>Are you sure that the class name:
>com.sun.xml.rpc.server.http.HttpServletRequest is correct?
>I can't even find that class in JWSDP 1.5.
>
>Baker, Brad (Contr) wrote:
>
>
>
>>
>>
>>
>>
>>
>>
>>
>------------------------------------------------------------------------
>
>
>>From: Baker, Brad (Contr)
>>Sent: Monday, 07 March 2005 12:45
>>To: 'users_at_jwsdp.dev.java.net'
>>Subject: HttpServletRequest
>>
>>
>>
>>Hi all,
>>
>>
>>
>>I am creating a Web Service with JWSDP 1.5 and I am trying to get to
>>the HttpServletRequest object.
>>
>>
>>
>>This is what I have:
>>
>> messageContext = servletEndpointContext.getMessageContext();
>>
>> for(java.util.Iterator it = messageContext.getPropertyNames();
>>
>>
>
>
>
>>it.hasNext();) {
>>
>> Object obj = it.next();
>>
>> String name = obj.toString();
>>
>> try {
>>
>> if (name.indexOf("HttpServletRequest") != -1) {
>>
>> request = (HttpServletRequest) obj;
>>
>> }
>>
>> } catch (ClassCastException ex) {
>>
>> // I get the Exception
>>
>> }
>>
>>
>>
>>When I look at the object name I get:
>>
>>com.sun.xml.rpc.server.http.HttpServletRequest
>>
>>
>>
>>And I am trying to cast it to a:
>>
>>javax.servlet.http.HttpServletRequest
>>
>>
>>
>>Why? Well I am trying to do this generically so if we ever change
>>containers we are not hard coded to a specific implementation. It
>>seems like this would work if javax.servlet.http.HttpServletRequest is
>>
>>
>
>
>
>>implemented.
>>
>>
>>
>>Where is the documentation on
>>com.sun.xml.rpc.server.http.HttpServletRequest?
>>
>>
>>
>>Let me know if anyone has a solution!
>>
>>
>>
>>Thanks,
>>
>>Brad
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>
>