On 07/17/2015 10:48 AM, Mitch Claborn wrote:
On 07/16/2015 02:19 PM, chris derham wrote:
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
Mitch,

Ok I see now what you mean. Sorry your original email was quite clear.

Hmm interesting challenge. Big picture terms, I guess the two obvious
choices seem to be to not use google for searching, or parse the
google results, and determine the url validity as you are doing.
Depending on the urls you use, that could be horrible. Guess that's
where you are. Is not using google an option?

Please let us know how you resolve it.

Chris

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


Doing without google is not an option. We are quite happy with them except for this one, admittedly minor, glitch.

I spent some time yesterday digging through code without much luck. Today I'm going to experiment with this: getting a Request Dispatcher for the URL from the ServletContext, creating a dummy ServerRequest and ServerResponse object and invoking include(request, response) or forward() on that dispatcher. With luck, I'll be able to get what would be the response from a HEAD or a GET request in some sort of output stream in the response object, then examine that output stream for the result.


I guess I'm giving up on this. I tried the approach described above, but can't seem to make it work. Trying the case of a known-good URL as a baseline. When I invoke displatcher,forward(request,response) my dummy response objects gets called with a sendError(404, "/url.html"), but I can also see evidence that the code that should run for that URL (a struts action) is running and is returning a good Struts response. When I enable low level logging, it appears to me that the JSP that renders the output is being called, but the output is not making it back to my dummy response object.

That sendError() is coming from the DefaultServlet, which is odd because I would think that should not be called as Struts is (should be) intercepting all of the requests.

I must be setting something up wrong somewhere. The only next step I can think of is to compile Tomcat for myself so I can debug the execution path from the forward() to figure out what's going on. I can't justify that much time and effort on this.

I'm guessing the RequestDispatcher only works down below the filters, which is where Struts is invoked.

I welcome any further ideas.


--

Mitch


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

Reply via email to