![]() |
.. (לתיקייה המכילה) | |
Should we use Tomcat?
| No Tomcat in this assignment! (will be used in assignment 5) |
How can we set the status code of the response from a servlet?
| To do this properly, we have added a new function in HttpSimpleServletResponse called setStatus(). See updated PDF file, and Bitbucket repository. |
When should we check if a session is expired?
1. Before we try to use that session when responding to the client that is associated with it.
2. Every once in a while, by a separate thread.
| Using the first option is sufficient, while using only the second option might cause problems. |
How should we handle the case where there is a URL pattern in web.xml that is mapped to two different servlets?
| Even though the server can detect these cases at startup, in this assignment the desired behavior is to send a 500 response for a request with a URL that matches such pattern. |
Why the URL "/setCity?city=Q60" should match the pattern "/setCity" ? Shouldn't the right pattern be "/setCity*" ?
| The '?' character plays a special role in URLs (it separates between the URL path from the query string). In particular, it should not affect the pattern matching algorithm of the SimpleServlet mechanism. |
What should be the content of the cookie that is created by our server?
| It's up to you. Typically this would be an identifier that is used to associate future requests to a single client. |
Who is responsible for sending the "set-cookie" header? The SimpleServlet mechanism, or the servlet itself from inside the doGet() method?
| The SimpleServlet mechanism. Users (i.e., programmers who write and add servlets) should be oblivious to any aspect of session management. |
How should we handle long request-handing times? In particular, what should we do if calculating similar items takes more than 8 seconds?
|
We recommend to use the Thread#interrupt method. Note that this approach requires you to adjust the code that does the calculation. Another approach is to use deprecated methods, such as Thread#stop. Although these methods are considered to be unsafe, they meet the requirements of this assignment (i.e., you can ignore problems that might arise due to the use of these methods). |
What should happen if a careless programmer adds a servlet which has a doGet method that never ends? For instance, there is an infinite loop in doGet.
| We would expect from the server to handle such cases, but in this assignment you can ignore them. |
Should we hard-code the registration of our Recommender and "SetCity" servlets?
| No, instead you should use the web.xml file as described, and add it (the modified web.xml file) to your submission. |

