You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Len Popp <le...@gmail.com> on 2010/03/16 01:50:10 UTC

Re: How to surpress The requested resource XYZ is not available - response

I don't think you can do that. After Tomcat accepts the HTTP
connection and decides whether to respond, it's too late to pretend
there's no server there. The user's web browser displays a different
error message for no server (something like "can't establish a
connection") vs. server timeout (something like "the server took too
long to respond") or dropping the connection ("the connection was
reset").

So you might as well just customize the 404 error page to say "There's
no server here" - it'd fool people just as well. :-)  Or just return
an empty error page.
-- 
Len



On Mon, Mar 15, 2010 at 19:26, Song Thuy Nguyen <pr...@biaqua.de> wrote:
> Hello,
>
>
>
> usually you will get a "The requested resource /XYZ is not available" response when you call an
> unavailable web service on Apache Tomcat. However, for a special use case I don't want Tomcat to
> answer to  requests for a unknown/unavailable web service. I just want Tomcat to ignore it and "keep
> quiet", resulting that the caller will get a timeout and therefore knows that there is no service behind
> this URL. How can I achieve such behaviour?
>
>
>
> Best Regards,
>
>
>
>
>
> Song Thuy Nguyen
>
>

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


Re: How to surpress The requested resource XYZ is not available - response

Posted by Pid <pi...@pidster.com>.
On 16/03/2010 02:01, Song Thuy Nguyen wrote:
> The thing is, I'm using the failover behaviour in Apache Synapse (Enterprise Service Bus). I can give Synapse a list of web service endpoints that have the same interface. One is the primary service endpoint and the others are the backups in case the primary endpoint become unavailable for some reason. Actually there are only 2 general reasons: the (application) server that provides the services is not running, so the port (lets say port 80) is closed. Or the second case: the application server is still running, but the service is made inactive. That means the application server still listens at port 80 but can't serve request to the mentioned service and answers with the "404 The requested resource XYZ is not available" response.
> Now the problem: Synapse gets this http-404 response, eventhough it can't find the SOAP envelop it expects it doesn't see the endpoint as faulty and forwards the 404 message to the caller (web service consumer). The fail-over mechanism doesn't kick in.... :( But actually it should because the service is not available anymore, so the request should be send to the backup endpoints.
> Ofcourse I tried to make Synapse understand that a 404-response should be treated the same as a failure. But it can't easily be done. So I thought I could make Tomcat to receive calls to inactive services, but just drop them without answering. After some time... synapse will trigger timeout and tries to call the backup endpoints.
> It doesn't matter if the http/tcp connection has been established or not.

So why try to fake a timeout?  Presumably there is an error code that 
Synapse will recognise as meaning that the service is unavailable, find 
out what that is and send that instead.  E.g. 503.

You could employ a custom ErrorValve, if you are able to check/intercept 
the 404 status that would be returned in the normal case and override it.


p

>> -----Original Message-----
>> From: Len Popp [mailto:len.popp@gmail.com]
>> Sent: Tuesday, March 16, 2010 1:50 AM
>> To: Tomcat Users List
>> Subject: Re: How to surpress The requested resource XYZ is not
>> available - response
>>
>> I don't think you can do that. After Tomcat accepts the HTTP
>> connection and decides whether to respond, it's too late to pretend
>> there's no server there. The user's web browser displays a different
>> error message for no server (something like "can't establish a
>> connection") vs. server timeout (something like "the server took too
>> long to respond") or dropping the connection ("the connection was
>> reset").
>>
>> So you might as well just customize the 404 error page to say "There's
>> no server here" - it'd fool people just as well. :-)  Or just return
>> an empty error page.
>> --
>> Len
>>
>>
>>
>> On Mon, Mar 15, 2010 at 19:26, Song Thuy Nguyen<pr...@biaqua.de>
>> wrote:
>>> Hello,
>>>
>>>
>>>
>>> usually you will get a "The requested resource /XYZ is not available"
>> response when you call an
>>> unavailable web service on Apache Tomcat. However, for a special use
>> case I don't want Tomcat to
>>> answer to  requests for a unknown/unavailable web service. I just
>> want Tomcat to ignore it and "keep
>>> quiet", resulting that the caller will get a timeout and therefore
>> knows that there is no service behind
>>> this URL. How can I achieve such behaviour?
>>>
>>>
>>>
>>> Best Regards,
>>>
>>>
>>>
>>>
>>>
>>> Song Thuy Nguyen
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


RE: How to surpress The requested resource XYZ is not available - response

Posted by Song Thuy Nguyen <pr...@biaqua.de>.
The thing is, I'm using the failover behaviour in Apache Synapse (Enterprise Service Bus). I can give Synapse a list of web service endpoints that have the same interface. One is the primary service endpoint and the others are the backups in case the primary endpoint become unavailable for some reason. Actually there are only 2 general reasons: the (application) server that provides the services is not running, so the port (lets say port 80) is closed. Or the second case: the application server is still running, but the service is made inactive. That means the application server still listens at port 80 but can't serve request to the mentioned service and answers with the "404 The requested resource XYZ is not available" response.
Now the problem: Synapse gets this http-404 response, eventhough it can't find the SOAP envelop it expects it doesn't see the endpoint as faulty and forwards the 404 message to the caller (web service consumer). The fail-over mechanism doesn't kick in.... :( But actually it should because the service is not available anymore, so the request should be send to the backup endpoints.
Ofcourse I tried to make Synapse understand that a 404-response should be treated the same as a failure. But it can't easily be done. So I thought I could make Tomcat to receive calls to inactive services, but just drop them without answering. After some time... synapse will trigger timeout and tries to call the backup endpoints.
It doesn't matter if the http/tcp connection has been established or not.



> -----Original Message-----
> From: Len Popp [mailto:len.popp@gmail.com]
> Sent: Tuesday, March 16, 2010 1:50 AM
> To: Tomcat Users List
> Subject: Re: How to surpress The requested resource XYZ is not
> available - response
> 
> I don't think you can do that. After Tomcat accepts the HTTP
> connection and decides whether to respond, it's too late to pretend
> there's no server there. The user's web browser displays a different
> error message for no server (something like "can't establish a
> connection") vs. server timeout (something like "the server took too
> long to respond") or dropping the connection ("the connection was
> reset").
> 
> So you might as well just customize the 404 error page to say "There's
> no server here" - it'd fool people just as well. :-)  Or just return
> an empty error page.
> --
> Len
> 
> 
> 
> On Mon, Mar 15, 2010 at 19:26, Song Thuy Nguyen <pr...@biaqua.de>
> wrote:
> > Hello,
> >
> >
> >
> > usually you will get a "The requested resource /XYZ is not available"
> response when you call an
> > unavailable web service on Apache Tomcat. However, for a special use
> case I don't want Tomcat to
> > answer to  requests for a unknown/unavailable web service. I just
> want Tomcat to ignore it and "keep
> > quiet", resulting that the caller will get a timeout and therefore
> knows that there is no service behind
> > this URL. How can I achieve such behaviour?
> >
> >
> >
> > Best Regards,
> >
> >
> >
> >
> >
> > Song Thuy Nguyen
> >
> >
> 
> ---------------------------------------------------------------------
> 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


Re: How to surpress The requested resource XYZ is not available - response

Posted by David Kerber <dc...@verizon.net>.
Len Popp wrote:
> I don't think you can do that. After Tomcat accepts the HTTP
> connection and decides whether to respond, it's too late to pretend
> there's no server there. The user's web browser displays a different
> error message for no server (something like "can't establish a
> connection") vs. server timeout (something like "the server took too
> long to respond") or dropping the connection ("the connection was
> reset").
>
> So you might as well just customize the 404 error page to say "There's
> no server here" - it'd fool people just as well. :-)  Or just return
> an empty error page.
>   
Yeah, I've done that; it works great for most users, including 
experienced IT people if they don't stop to look too close.

D



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