On 07/16/2015 01:04 PM, chris derham wrote:
Short question: How can I, from within code running under Tomcat, determine
if a given URL request to that tomcat instance would result in a 404 or not,
without calling back to the Tomcat using an HTTP HEAD or GET?

Background: We use google custom search by calling the google server and
then formatting the results on our search page.  Our range of products is
fairly fluid, and there is occasionally a gap between when a product goes
away and the google search index is updated, which would result in a 404 if
user clicked that link in the search results.  (I know that I can ask google
to re-index, but I still need to solve this problem.)

Rather than write a ton of code for the various types of pages that we have
(product, category, etc) I'd like to just be able to call some Tomcat method
to determine if the URL that I get back from google would result in a 404 or
not.  I'm currently calling back to the Tomcat instance using an HTTP HEAD
call, but that is a waste of resources and during periods of high volume
uses up processing threads that I want to reserve for actual customers.

We are using Tomcat 7 with Struts.
Mitch,

What will you do when you detect a 404? Couldn't you just implement a
custom 404 error page, that does what ever it is?

Chris

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



I already have a custom error page. When I detect that a URL returned by google would return a 404, I exclude it from the search results so that the user never sees it.

Mitch



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

Reply via email to