122 CHAPTER 5 PERMUTATIONS PATTERN the request is maryjane and therefore allows access to the URL. Like the login, the resource /bankaccount/maryjane has an associated representation, /servlet/bankaccount/maryjane. Comparing Figure 5-9 to Figure 5-8, you can see that the authorization, resource, and representation have been separated from each other. The solution in Figure 5-9 is better because it allows a developer or administrator to update one component (for example, authorization) without having to update the other components (for example, resource and representation). There are multiple ways to authorize a user, and they are defined as follows: Cookies: Cookies are identifiers sent in the HTTP header between the client and the server. The server is responsible for generating a cookie, and the client is responsible for sending the cookie to the server for a given URL and its descendents. URL rewriting: To identify the client, the URL is rewritten, and the client uses the new URL for all requests. For example, instead of requesting the URL /bank/account, the URL is rewritten to /session12345/bank/account. The URL is rewritten dynamically, and a router component will capture the rewritten URL to identify the user. HTTP authentication: By using HTTP authentication, it is possible to authenticate a user. Then, whenever the user requests content for a given URL realm, the authorization information is sent by the client. HTTP authentication is similar to a cookie, except that users must authenticate themselves. HTML form addition: Another variation of URL rewriting is not to rewrite the URL but to rewrite the HTML forms that send content. Hidden fields are added to identify who is sending the content. Using Cookies HTTP cookies1 have a bad reputation, partially undeserved, and therefore many will argue that you should not use cookies. The problem with cookies is not their theory, but their implementation and their ramifications. To compare the use of cookies to real life, consider entering a shopping mall. At the entrance somebody gives you a token, which you can refuse. After you refuse the token, all of a sudden all the store doors close. You can wander the mall, but can only look at the merchandise through the windows. You can still view the content and everything that the store offers, but it is behind glass. Now imagine that you accept the token. The store doors remain open, and you can browse all the products. To be helpful, the store clerks offer recommendations and best offers in the mall. Yet there is a dark underside: the shopping mall is watching every step you make, and everything you look at is being tracked. Of course, the shopping mall assures you that the information will not be used for other purposes, but the question is, where did those recommendations come from? Or how about the best offers? The tokens or in the real world, cookies are being used to track people. I am split regarding the use of cookies. I find nothing extremely disturbing about them, nor am I enthused about them. HTTP cookies are a means to an end. 1. http://en.wikipedia.org/wiki/HTTP_cookie
You want to have a cheap webhost for your apache application, then check apache web hosting services.