Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Asynchronous Filter post processing

 
Stoian Azarov
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will give an example

Servlet:
Filter:
 
German Gonzalez-Morris
Ranch Hand
Posts: 266
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic