You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Felix Knecht <fe...@apache.org> on 2007/11/28 12:14:44 UTC

Get port of ServletEngine

Hi all

I'd like to get the port of the servlet engine (jetty/tomcat/...) where
cocoon-2.2 is running in (.e.g. 8888).
Is this possible and if so how can I get the port?

Thanks
Felix

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


Re: Get port of ServletEngine

Posted by Felix Knecht <fe...@apache.org>.
Hi Grzegorz

> What about using custom system property for passing port number to Cocoon? It still be a
> responsibility of administration to pass right number via property but at least your application can
> be left completely untouched when it's being deployed.

That's what I want to avoid 'responsability of administration' ;-)

Thanks
Felix


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


Re: Get port of ServletEngine

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Felix Knecht pisze:
> Thomas Soddemann schrieb:
>> Hi again,
>>
>> this is more of an issue related to the infrastructural setup rather
>> than a cocoon one.
>> I cannot think of any standard way of retrieving that bit of
>> information other than to have it available as a configuration option
>> (e.g. via JNDI).
>> Since the web application container could be connected to an HTTPD via
>> AJP or URL rewriting may be used before the request is received by the
>> application container, or ... there is now way of getting to know,
>> which url to use as a base for the current servlet.
>> The only thing, you may want to have look at, is the
>> javax.servelt.ServletContext. There is a getRealPath() method which
>> may be what you are looking for in your context.
>>
> Thanks for help. It really seems that I need to find another solution
> for this.

What about using custom system property for passing port number to Cocoon? It still be a
responsibility of administration to pass right number via property but at least your application can
be left completely untouched when it's being deployed.

Thanks to our Configurator stuff obtaining value of property is straightforward.

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

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


Re: Get port of ServletEngine

Posted by Felix Knecht <fe...@apache.org>.
Thomas Soddemann schrieb:
> Hi again,
>
> this is more of an issue related to the infrastructural setup rather
> than a cocoon one.
> I cannot think of any standard way of retrieving that bit of
> information other than to have it available as a configuration option
> (e.g. via JNDI).
> Since the web application container could be connected to an HTTPD via
> AJP or URL rewriting may be used before the request is received by the
> application container, or ... there is now way of getting to know,
> which url to use as a base for the current servlet.
> The only thing, you may want to have look at, is the
> javax.servelt.ServletContext. There is a getRealPath() method which
> may be what you are looking for in your context.
>
Thanks for help. It really seems that I need to find another solution
for this.

Felix

> Cheers,
> Thomas
>
> Felix Knecht wrote:
>>
>> Yes, I need it before a request is made.
>>
>> Use case is:
>> I have a worker zipping files (in a cocoon application A). Another
>> application (B) send a jms message to the worker (A), which files shall
>> put into a zip file. The zip file is stored into filesystem (A) and
>> shall be made available for download via http. Application B receives
>> and acknowledge jms message containing the URI to this zip file. Thus I
>> need to create the URI for app B withing app A. Getting the host name
>> isn't a problem, but as app A can be put anywhere in any servlet engine
>> running on any port I need to figure out this port to be able to create
>> the URI which is sent back to app B.
>>
>> In short:
>> Broadcast a jms message to create a zip file and receive a jms message
>> containing the (http) URI where the zip file is downloadable.
>>
>> Felix
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>   
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


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


Re: Get port of ServletEngine

Posted by Thomas Soddemann <th...@rzg.mpg.de>.
Hi again,

this is more of an issue related to the infrastructural setup rather 
than a cocoon one.
I cannot think of any standard way of retrieving that bit of information 
other than to have it available as a configuration option (e.g. via JNDI).
Since the web application container could be connected to an HTTPD via 
AJP or URL rewriting may be used before the request is received by the 
application container, or ... there is now way of getting to know, which 
url to use as a base for the current servlet.
The only thing, you may want to have look at, is the 
javax.servelt.ServletContext. There is a getRealPath() method which may 
be what you are looking for in your context.

Cheers,
Thomas

Felix Knecht wrote:
>
> Yes, I need it before a request is made.
>
> Use case is:
> I have a worker zipping files (in a cocoon application A). Another
> application (B) send a jms message to the worker (A), which files shall
> put into a zip file. The zip file is stored into filesystem (A) and
> shall be made available for download via http. Application B receives
> and acknowledge jms message containing the URI to this zip file. Thus I
> need to create the URI for app B withing app A. Getting the host name
> isn't a problem, but as app A can be put anywhere in any servlet engine
> running on any port I need to figure out this port to be able to create
> the URI which is sent back to app B.
>
> In short:
> Broadcast a jms message to create a zip file and receive a jms message
> containing the (http) URI where the zip file is downloadable.
>
> Felix
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>   


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


Re: Get port of ServletEngine

Posted by Felix Knecht <fe...@apache.org>.
Thomas Soddemann schrieb:
> Felix Knecht wrote:
>> Hi all
>>
>> I'd like to get the port of the servlet engine (jetty/tomcat/...) where
>> cocoon-2.2 is running in (.e.g. 8888).
>> Is this possible and if so how can I get the port?
>>
>> Thanks
>> Felix
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>   
> Hi Felix,
>
> what about the getServerPort() method from javax.servlet.ServletRequest?
> Or do you need the port before are request was made? In that case I am
> curious, what is the use case?
>
Yes, I need it before a request is made.

Use case is:
I have a worker zipping files (in a cocoon application A). Another
application (B) send a jms message to the worker (A), which files shall
put into a zip file. The zip file is stored into filesystem (A) and
shall be made available for download via http. Application B receives
and acknowledge jms message containing the URI to this zip file. Thus I
need to create the URI for app B withing app A. Getting the host name
isn't a problem, but as app A can be put anywhere in any servlet engine
running on any port I need to figure out this port to be able to create
the URI which is sent back to app B.

In short:
Broadcast a jms message to create a zip file and receive a jms message
containing the (http) URI where the zip file is downloadable.

Felix


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


Re: Get port of ServletEngine

Posted by Thomas Soddemann <th...@rzg.mpg.de>.
Felix Knecht wrote:
> Hi all
>
> I'd like to get the port of the servlet engine (jetty/tomcat/...) where
> cocoon-2.2 is running in (.e.g. 8888).
> Is this possible and if so how can I get the port?
>
> Thanks
> Felix
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>   
Hi Felix,

what about the getServerPort() method from javax.servlet.ServletRequest?
Or do you need the port before are request was made? In that case I am 
curious, what is the use case?

Cheers,
Thomas

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