Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > ServletFilters and Servlets: Is Running a "Request" in the same Thread?

Reply
Thread Tools

ServletFilters and Servlets: Is Running a "Request" in the same Thread?

 
 
joes
Guest
Posts: n/a
 
      03-14-2007
Hello

I have a basic question regarding Servlet and ServletFilters. If I do
have a filter, can I assume that the request is running in the same
thread? Or could it be that the filter is running in another context
as the servlet?
Background: we have an existing framework which is using ThreadLocal
variables and therefore it is essential to know how the specification
of a servletciontainer does look like and if someone has experiences
on that?

Many thanks

regards
Mark

 
Reply With Quote
 
 
 
 
Adam Maass
Guest
Posts: n/a
 
      03-17-2007

"joes" <(E-Mail Removed)> wrote:
> Hello
>
> I have a basic question regarding Servlet and ServletFilters. If I do
> have a filter, can I assume that the request is running in the same
> thread? Or could it be that the filter is running in another context
> as the servlet?
> Background: we have an existing framework which is using ThreadLocal
> variables and therefore it is essential to know how the specification
> of a servletciontainer does look like and if someone has experiences
> on that?
>
> Many thanks
>


I'm not exactly sure what the specification says, but the reference
implementation (IE, Tomcat) runs the ServletFilter and the chained target
Servlet in the same thread for the same request.

It's a pretty safe bet that other implementations of the Servlet
specification do the same thing. Even if the spec itself leaves this detail
underspecified.

-- Adam Maass

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      03-17-2007
Adam Maass wrote:
> I'm not exactly sure what the specification says, but the reference
> implementation (IE, Tomcat) runs the ServletFilter and the chained
> target Servlet in the same thread for the same request.
>
> It's a pretty safe bet that other implementations of the Servlet
> specification do the same thing. Even if the spec itself leaves this
> detail underspecified.


Don't you mean "unspecified"? Meaning you can't count on the behavior?

-- Lew
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
running same script on same data on two different machines -->different result Christopher Brewster Python 5 11-14-2008 08:19 PM
Problem running ASP.NET 1.1 and 2.0 apps on the same server... Kevin S. Goff ASP .Net 2 02-19-2006 09:16 AM
REQ: how to override 2 virtual functions with the same name and same parameter zzppallas@gmail.com C++ 5 02-06-2006 06:54 AM
java input and output stream to the same file at the same time? Krick Java 1 08-15-2003 05:55 PM
RogueWave - running inserter and selector on the same connection nimrod C++ 1 08-04-2003 08:43 AM



Advertisments