• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Asynchronous Filter post processing

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 26791
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will give an example

Servlet:
Filter:
 
Ranch Hand
Posts: 368
2
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 26791
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic