You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov> on 2010/12/01 15:34:52 UTC

Filter questions

Servlet Spec 2.5
SRV.6.2.1

"The container provides the filter config as
declared in the filter's deployment descriptor, the reference to the ServletContext
for the Web application, and the set of initialization parameters.'

1.      How does Tomcat get a reference to a ServletContext before any servlet is created?
2.      If a filter can be mapped to a static resource, what is the servlet context?

Leo Donahue


Re: Filter questions

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 12/1/2010 12:53 PM, Caldarale, Charles R wrote:
>> From: Leo Donahue - PLANDEVX [mailto:LeoDonahue@mail.maricopa.gov] 
>> Subject: RE: Filter questions
> 
>> In the meantime I was trying to understand how/when "servletness" occurs.
> 
> Within Tomcat, always.
> 
>> http://localhost:8080  will load index.html, because of the welcome 
>> file, in ROOT but that's not a servlet.  
> 
> Yes it is - look at the mapping for DefaultServlet in conf/web.xml.

+1

There is no magic, here: everything is explicitly mapped, even if it's
in the "default" configuration in conf/web.xml (which gets inherited by
all webapps). Things like mapping *.jsp to the JSP compiler/runner are
in there, too.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkz2lmIACgkQ9CaO5/Lv0PAmwgCghsbBtg/hHBkaiiMibK/QOSJ6
8acAnjDSFLIXvCNsPOoFPn00wUfOPy98
=IqUO
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Filter questions

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leo Donahue - PLANDEVX [mailto:LeoDonahue@mail.maricopa.gov] 
> Subject: RE: Filter questions

> In the meantime I was trying to understand how/when "servletness" occurs.

Within Tomcat, always.

> http://localhost:8080  will load index.html, because of the welcome 
> file, in ROOT but that's not a servlet.  

Yes it is - look at the mapping for DefaultServlet in conf/web.xml.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


Re: Filter questions

Posted by Pid * <pi...@pidster.com>.
On 1 Dec 2010, at 17:28, Leo Donahue - PLANDEVX
<Le...@mail.maricopa.gov> wrote:

>> -----Original Message-----
>> From: Pid * [mailto:pid@pidster.com]
>> Subject: Re: Filter questions
>>
>> On 1 Dec 2010, at 14:35, Leo Donahue - PLANDEVX
>> <Le...@mail.maricopa.gov> wrote:
>>
>>> Servlet Spec 2.5
>>> SRV.6.2.1
>>>
>>> "The container provides the filter config as
>>> declared in the filter's deployment descriptor, the reference to the
>> ServletContext
>>> for the Web application, and the set of initialization parameters.'
>>>
>>> 1.      How does Tomcat get a reference to a ServletContext before any
>> servlet is created?
>>
>> Servlets exist inside the context, not the other way round.
>>
>>> 2.      If a filter can be mapped to a static resource, what is the
>> servlet context?
>>
>> The app is the context.
>>
>>
>> p
>>
>
> Thanks, I realized the context part about 20 seconds after I posted and totally forgot about the default servlet.
>
> I'll read the spec front to back, as suggested.
>
> In the meantime I was trying to understand how/when "servletness" occurs.
>
> http://localhost:8080  will load index.html, because of the welcome file, in ROOT but that's not a servlet.
> Are you saying that the servletcontext here is the Default Servlet mapped to / ?

The name might be misleading you, have a look in the source to see
what implements ServletContext, and what else it does.

Something like org.apache.catalina.core.ApplicationContextFacade.


p

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Filter questions

Posted by Pid * <pi...@pidster.com>.
On 1 Dec 2010, at 17:28, Leo Donahue - PLANDEVX
<Le...@mail.maricopa.gov> wrote:

>> -----Original Message-----
>> From: Pid * [mailto:pid@pidster.com]
>> Subject: Re: Filter questions
>>
>> On 1 Dec 2010, at 14:35, Leo Donahue - PLANDEVX
>> <Le...@mail.maricopa.gov> wrote:
>>
>>> Servlet Spec 2.5
>>> SRV.6.2.1
>>>
>>> "The container provides the filter config as
>>> declared in the filter's deployment descriptor, the reference to the
>> ServletContext
>>> for the Web application, and the set of initialization parameters.'
>>>
>>> 1.      How does Tomcat get a reference to a ServletContext before any
>> servlet is created?
>>
>> Servlets exist inside the context, not the other way round.
>>
>>> 2.      If a filter can be mapped to a static resource, what is the
>> servlet context?
>>
>> The app is the context.
>>
>>
>> p
>>
>
> Thanks, I realized the context part about 20 seconds after I posted and totally forgot about the default servlet.
>
> I'll read the spec front to back, as suggested.
>
> In the meantime I was trying to understand how/when "servletness" occurs.
>
> http://localhost:8080  will load index.html, because of the welcome file, in ROOT but that's not a servlet.
> Are you saying that the servletcontext here is the Default Servlet mapped to / ?

More direct answer:

ROOT is the ServletContext, the file is served by the default servlet.


p

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Filter questions

Posted by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov>.
>-----Original Message-----
>From: Pid * [mailto:pid@pidster.com]
>Subject: Re: Filter questions
>
>On 1 Dec 2010, at 14:35, Leo Donahue - PLANDEVX
><Le...@mail.maricopa.gov> wrote:
>
>> Servlet Spec 2.5
>> SRV.6.2.1
>>
>> "The container provides the filter config as
>> declared in the filter's deployment descriptor, the reference to the
>ServletContext
>> for the Web application, and the set of initialization parameters.'
>>
>> 1.      How does Tomcat get a reference to a ServletContext before any
>servlet is created?
>
>Servlets exist inside the context, not the other way round.
>
>> 2.      If a filter can be mapped to a static resource, what is the
>servlet context?
>
>The app is the context.
>
>
>p
>

Thanks, I realized the context part about 20 seconds after I posted and totally forgot about the default servlet.

I'll read the spec front to back, as suggested.

In the meantime I was trying to understand how/when "servletness" occurs.

http://localhost:8080  will load index.html, because of the welcome file, in ROOT but that's not a servlet.  
Are you saying that the servletcontext here is the Default Servlet mapped to / ?

Re: Filter questions

Posted by Pid * <pi...@pidster.com>.
On 1 Dec 2010, at 14:35, Leo Donahue - PLANDEVX
<Le...@mail.maricopa.gov> wrote:

> Servlet Spec 2.5
> SRV.6.2.1
>
> "The container provides the filter config as
> declared in the filter's deployment descriptor, the reference to the ServletContext
> for the Web application, and the set of initialization parameters.'
>
> 1.      How does Tomcat get a reference to a ServletContext before any servlet is created?

Servlets exist inside the context, not the other way round.

> 2.      If a filter can be mapped to a static resource, what is the servlet context?

The app is the context.


p

>
> Leo Donahue
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Filter questions

Posted by Martin Kuen <ma...@gmail.com>.
Hi Leo,

you can use the terms "servletcontext" and "webapplication" interchangeably.

http://tomcat.apache.org/tomcat-6.0-doc/introduction.html
See Terminology


Best Regards,

Martin

On Wed, Dec 1, 2010 at 3:34 PM, Leo Donahue - PLANDEVX <
LeoDonahue@mail.maricopa.gov> wrote:

> Servlet Spec 2.5
> SRV.6.2.1
>
> "The container provides the filter config as
> declared in the filter's deployment descriptor, the reference to the
> ServletContext
> for the Web application, and the set of initialization parameters.'
>
> 1.      How does Tomcat get a reference to a ServletContext before any
> servlet is created?
>
2.      If a filter can be mapped to a static resource, what is the servlet
> context?
>
> Leo Donahue
>
>

Re: Filter questions

Posted by Mark Thomas <ma...@apache.org>.
On 01/12/2010 14:34, Leo Donahue - PLANDEVX wrote:
> Servlet Spec 2.5
> SRV.6.2.1
> 
> "The container provides the filter config as
> declared in the filter's deployment descriptor, the reference to the ServletContext
> for the Web application, and the set of initialization parameters.'
> 
> 1.      How does Tomcat get a reference to a ServletContext before any servlet is created?
> 2.      If a filter can be mapped to a static resource, what is the servlet context?

Try reading the spec and/or the ServletContext Javadoc and all should be
clear.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org