tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cassian Raja Thomas <rajacass...@gmail.com>
Subject Re: How to get the configured HTTP and HTTPS port numbers in server.xml from Java code at runtime
Date Tue, 19 Aug 2014 16:54:14 GMT
Yeah.. Now I got it. Thanks for the information




On Tue, Aug 19, 2014 at 5:59 PM, David kerber <dckerber@verizon.net> wrote:

> On 8/19/2014 4:36 AM, Cassian Raja Thomas wrote:
>
>> I can retrieve the information prior to getting the connection refused
>> message and then compare the port numbers with the one sent in the request
>> parameters. Thereby, I can handle the exception and throw it with nice
>> error code and message
>>
>
> Not from the server side, you can't.  Connection refusal is done at the
> operating system and tcp/ip stack level.  If the OS refuses the connection,
> it will never get to your tomcat server or any other service you have
> running on it.  You might be able to do this on the client side with
> javascript, though.
>
>
>
>
>>
>> On Tue, Aug 19, 2014 at 12:19 PM, André Warnier <aw@ice-sa.com> wrote:
>>
>>  Cassian Raja Thomas wrote:
>>>
>>>  In our project, we have implemented SOAP webservices using Apache CXF
>>>> framework. Clients used to request the server for some command
>>>> execution.
>>>> The request consists of host, port and the protocol used for connection.
>>>> If
>>>> the client uses a HTTPS configured port number and specify the protocol
>>>> as
>>>> HTTP, then we get a connection refused - socket exception as expected.
>>>> But,
>>>> I need to throw a proper error message like "Unable to connect to host
>>>> "XYZ" with port "ABC" using http protocol". For this, I need to get the
>>>> configured http and https port numbers from tomcat server.xml file at
>>>> runtime and then compare it with my request parameters.
>>>>
>>>> Anyone, please help me out on how to do that?
>>>>
>>>>
>>>>  I think that you are chasing windmills (attemting something
>>> impossible),
>>> because if the connection is refused, the Tomcat code itself probably
>>> never
>>> even sees this.
>>> The "connection refused" message is coming from your own client's TCP/IP
>>> stack.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message