aspose file tools*
The moose likes Servlets and the fly likes Asynchronous Filter post processing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Asynchronous Filter post processing" Watch "Asynchronous Filter post processing" New topic
Author

Asynchronous Filter post processing

Stoian Azarov
Ranch Hand

Joined: Jun 01, 2011
Posts: 113
To my understanding it is not possible to implement filter that will post-process a response buffer generated by asynchronous request process. Am I right?
Is there any possibility(or trick) to achieve this goal?
In fact, it doesn't make sense to force the container thread to wait, it is against the initial goal. I am just curious if it is possible.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

You can certainly write a filter which post-processes a response; every tutorial on the subject includes one which gzips the response, for example.

However I don't understand what you mean by "asynchronous request process". Perhaps you could explain that?
Stoian Azarov
Ranch Hand

Joined: Jun 01, 2011
Posts: 113
I will give an example

Servlet:
Filter:
German Gonzalez-Morris
Ranch Hand

Joined: Nov 16, 2009
Posts: 173

Filters are under HTTP Request/Response paradigm, then it cannot be Asynchronous.

Maybe what you need it is to do a Ajax call in someway if asynchronous is required otherwise Filter will keep waiting for an answer.


http://devwebcl.blogspot.com/
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

It looks like you are asking about the new features in Servlet 3.0, but you're getting answers (at least from me) which are irrelevant to that.

At any rate, I know nothing about the async support in Servlet 3.0, but Asynchronous Support in Servlet 3.0 seems to say something about your question, I think.
Stoian Azarov
Ranch Hand

Joined: Jun 01, 2011
Posts: 113
German Gonzalez-Morris wrote:Filters are under HTTP Request/Response paradigm, then it cannot be Asynchronous.

Maybe what you need it is to do a Ajax call in someway if asynchronous is required otherwise Filter will keep waiting for an answer.

@German, this confirms my expectations. I don't need it for something specific, I just wanted to check if I am not misunderstanding the concept.

@Paul, thanks for the link. The available information about asynchronous processing in Servlets is sparse and insufficient(in my opinion). The only source is Servlet 3.0 specification and few articles on the net.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Asynchronous Filter post processing