0

I'm trying to debug an issue with a Tomcat 6 web server on Linux (Amazon AMI) that I did not setup. Specifically, I'm trying to trace the execution of a GET request sent to the web server with the following URL:

./x.html?a=param1&b=param2

...but I don't understand where tomcat is handling the request. I've checked /var/www/WEB-INF/web.xml and there are no servlets handling the request, and the web.xml at /etc/tomcat6 looks untouched.

The file is at /var/www/x.html so it's a static file being served by default presumably, but where are the query string parameters being handled. There must be some servlet handling the request somewhere.

RTF
  • 6,214
  • 12
  • 64
  • 132

2 Answers2

1

There always is a default servlet to handle static resources, defined in Tomcat_dir/conf/web.xml, where is says:

The default servlet for all web applications, that serves static resources. It processes all requests that are not mapped to other servlets with servlet mappings (defined either here or in your own web.xml file). ...

Stefan
  • 12,108
  • 5
  • 47
  • 66
  • But how are query string parameters handled in these cases – RTF Aug 26 '14 at 12:30
  • They are passed into the ServletRequest object, in the default servlet and then passed to the html page. There you can handle them like in every html page. What are you trying to achieve? – Stefan Aug 26 '14 at 12:50
  • I'm trying to figure out how the contents of x.html is generated. The raw file is small, but there's a large number of scripts so when the file makes it's way back to the client (the response to the GET request) the scripts end up generating a lot more HTML. But the two params passed in the GET request are responsible for how x.html ultimately looks to the client. I just don't understand how they are processed when the serving of this file is delegated to the default servlet. – RTF Aug 26 '14 at 13:10
  • So the the pages are generated by Javascript? Thats handled on client side. Could you pls post some of the contents? – Stefan Aug 26 '14 at 13:21
  • I can't unfortunately, but I don't think it matters. I'm really just interested in how the server handles those 2 GET query string params. They must have some bearing on what gets returned to the client in response to the GET request, but where is that decision making, or how do the params affect/interact with the html file? – RTF Aug 26 '14 at 13:32
  • I know I'm making things difficult not being able to post the code, but I'm just asking in a general sense, how does the default handler deal with request parameters. You mentioned earlier that they're passed to the html page and you can handle them however you like. How does that work exactly? – RTF Aug 26 '14 at 13:35
  • 1
    For example to handle them in Javascript look [here](http://stackoverflow.com/questions/831030/how-to-get-get-request-parameters-in-javascript). – Stefan Aug 26 '14 at 13:52
  • Sorry, I didn't realize that the scripts were just pulling the params out of the source url. I was fixated on finding out where the web server was processing the params, like for a POST. Thanks. – RTF Aug 26 '14 at 14:21
0

./x.html?a=param1&b=param2 means a page called x.html in the same folder the request is sent from

Pradeep Kumar
  • 6,836
  • 4
  • 21
  • 47
Yazan
  • 6,074
  • 1
  • 19
  • 33
  • I know where x.html is, it's the request handling I don't understand, specifically the handling of the query string parameters. – RTF Aug 26 '14 at 12:36