You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Kennard <pe...@livingwork.com> on 2007/03/13 02:57:16 UTC

Can one map a servlet to a specific connctor?

On a stand alone tomcat with more than one connector (port)
Is it possible to map a servlet to only one or a subset of connectors?

Thanks PK


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


RE: Can one map a servlet to a specific connctor?

Posted by Peter Kennard <pe...@livingwork.com>.
Thanks - I assume "any way you want" would include the port?
I'll have to dive more into Filters.

At 01:15 3/13/2007, you wrote:
> > From: Peter Kennard [mailto:peterk@livingwork.com]
> > Subject: Can one map a servlet to a specific connctor?
> >
> > On a stand alone tomcat with more than one connector (port)
> > Is it possible to map a servlet to only one or a subset of connectors?
>
>No, but you can use a filter or valve to restrict access any way you
>want.
>
>  - Chuck



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


RE: Can one map a servlet to a specific connctor?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Peter Kennard [mailto:peterk@livingwork.com] 
> Subject: Can one map a servlet to a specific connctor?
> 
> On a stand alone tomcat with more than one connector (port)
> Is it possible to map a servlet to only one or a subset of connectors?

No, but you can use a filter or valve to restrict access any way you
want.

 - 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.

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


RE: Can one map a servlet to a specific connctor?

Posted by Peter Kennard <pe...@livingwork.com>.
>Try ServletRequest.getLocalPort() rather than getServerPort().

Yes exactly, thanks - that is an addition to the api after the book I read :)
eclipse auto-complete and the sun website is your friend :)

*****

Part of all these questions is I am looking to implement a servlet 
subclass which will "auto register" itself with an upstream front end 
(maybe AJP does this?) so ideally I would want to be able to query 
what URI "host,port,path" would access the proper connector and 
servlet when it's "init()" is called so I can pass it to upstream to 
the front-end router.  Of course at this time no request has been 
recieved.  I guess I could do it by parsing the server.xml or putting 
in rendundant per servlet initParameters but that makes me queasy, I 
like the thing itself to propagate it's own state changes :)

PK

At 11:58 3/13/2007, you wrote:
> > From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> > Subject: RE: Can one map a servlet to a specific connctor?
>
>Try ServletRequest.getLocalPort() rather than getServerPort().



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


RE: Can one map a servlet to a specific connctor?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
> Subject: RE: Can one map a servlet to a specific connctor?

Try ServletRequest.getLocalPort() rather than getServerPort().

 - 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.

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


RE: Can one map a servlet to a specific connctor?

Posted by Peter Kennard <pe...@livingwork.com>.
This could be the ticket!

At 11:53 3/13/2007, you wrote:
>You could configure proxyPort in your <Connector> to some value that you
>could use as a flag for your particular environment.  This will override
>the header value returned by getServerPort().  Don't know if there would
>be any undesirable side effects.
>
>  - Chuck



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


RE: Can one map a servlet to a specific connctor?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Peter Kennard [mailto:peterk@livingwork.com] 
> Subject: RE: Can one map a servlet to a specific connctor?
> 
> I Verified this returns the port indicated by the client in 
> the header.

You could configure proxyPort in your <Connector> to some value that you
could use as a flag for your particular environment.  This will override
the header value returned by getServerPort().  Don't know if there would
be any undesirable side effects.

 - 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.

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


RE: Can one map a servlet to a specific connctor?

Posted by Peter Kennard <pe...@livingwork.com>.
I Verified this returns the port indicated by the client in the header.

Not the port the request was recieved by at the tomcat instance.
Appropriate for a client to send and passed through by proxys, 
remappers, front ends etc. but not to determine where it ends up.
PK

At 07:23 3/13/2007, you wrote:
>Damn! I missed that :)  Thanks.
>
>I assume this is taking it from where the hit arrives in at the 
>server and not the HTTP headers passed in (which could be anything)
>
>At 01:32 3/13/2007, you wrote:
>> > From: Peter Kennard [mailto:peterk@livingwork.com]
>> > Subject: Re: Can one map a servlet to a specific connctor?
>> >
>> > Can I determine the connector port connected to for a request from
>> > service() I don't see it in the servlet API but am willing to access
>> > somthing tomcat specific.
>>
>>ServletRequest.getServerPort() is inherited by HTTPServletRequest.
>>
>>  - Chuck



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


RE: Can one map a servlet to a specific connctor?

Posted by Peter Kennard <pe...@livingwork.com>.
Damn! I missed that :)  Thanks.

I assume this is taking it from where the hit arrives in at the 
server and not the HTTP headers passed in (which could be anything)

At 01:32 3/13/2007, you wrote:
> > From: Peter Kennard [mailto:peterk@livingwork.com]
> > Subject: Re: Can one map a servlet to a specific connctor?
> >
> > Can I determine the connector port connected to for a request from
> > service() I don't see it in the servlet API but am willing to access
> > somthing tomcat specific.
>
>ServletRequest.getServerPort() is inherited by HTTPServletRequest.
>
>  - 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.
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org



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


RE: Can one map a servlet to a specific connctor?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Peter Kennard [mailto:peterk@livingwork.com] 
> Subject: Re: Can one map a servlet to a specific connctor?
> 
> Can I determine the connector port connected to for a request from 
> service() I don't see it in the servlet API but am willing to access 
> somthing tomcat specific.

ServletRequest.getServerPort() is inherited by HTTPServletRequest.

 - 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.

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


Re: Can one map a servlet to a specific connctor?

Posted by Peter Kennard <pe...@livingwork.com>.
I guess a corrollary question to this would be.
Can I determine the connector port connected to for a request from 
service() I don't see it in the servlet API but am willing to access 
somthing tomcat specific.
PK

At 21:57 3/12/2007, you wrote:

>On a stand alone tomcat with more than one connector (port)
>Is it possible to map a servlet to only one or a subset of connectors?
>
>Thanks PK
>
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org



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