Re: Is there any way to read content of a POJO object in servlet filter?
There is no direct method to do that. You will have to copy/paste code from RemoteServiceServlet into your Filter to achieve what you want. And it will have an impact on your peformance, since the deserialization will happen twice - in your filter and in the rpc servlet.
If you want to read parameters in your filter, your best bet would be to put it in the URL. In GWT 2.0, you can set a custom RPCRequestBuilder in your Async Interface. See this link. In your custom builder, just append the sessionId parameter to all RPC requests that the browser makes, and then read it in the filter.
--Sri
2009/10/29 Alex Luya <alexander.luya@gmail.com>
I don't mean that,I mean I have a POJO object:
-----------------------------
Class POJOObject implements IsSerializable{
private long id;
private String sessionId;
....getters and setters.....
}
-------------------------------
and I want to know is there any way to get sessionId in servlet
filter?
On 29 oct, 18:37, Michael Sullivan <msull...@yahoo.com> wrote:
> Alex, can you be a little more clear please?
>
> You want to change the content of an HTTP Header as it passes through
> your servlet filter?
>
> While there are no setters, as far as I know, for the headers
> available in the filter, you can wrap the incoming header in an
> instance of HttpServletRequestWrapper. This wrapper delegates all of
> its method calls to the HTTPServletRequest you have wrapped. Then you
> override the getHeader related methods to return the desired result
> for the header you want to change.
>
> When you call chain.doFilter, you pass the wrapper instead of the
> original request.
>
> Mike
>
> On Oct 29, 5:35 am,AlexLuya<alexander.l...@gmail.com> wrote:
>
>
>
> > Currently,I know only content in HTTP HEADER can read and
> > modified,and seemly,it is impossible to do anything in content of
> > HEADER.So can anybody provide me a way,thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home