CHAPTER 5 (Free web servers) PERMUTATIONS PATTERN 123 An Example
CHAPTER 5 PERMUTATIONS PATTERN 123 An Example Book Application Assuming that you do not need to implement the Permutations pattern, there are some rules of thumb with respect to URL design. When a URL is a resource, it references a piece of data and you need to design a URL. For URL design purposes, let s go through a library example. In terms of functionality, books can be added, manipulated, and deleted. An individual can add books to a list and have comments associated with them. Additionally, a user can create a wish list that contains the books that he would like to have in his library. Defining the URLs When defining URLs, the idea is not to define everything but to define the operations that the web application exposes. The URL is defined in the same way that a JavaScript function is defined, in that specifics are bound when used. The following URLs would be used to realize this application: http://mydomain.com/books/[ISBN]: Associates the URL with a book that has the indicated ISBN number. http://mydomain.com/books/[ISBN]/comments: Associates the URL with the comments of a book identified by the ISBN number. http://mydomain.com/books/[ISBN]/comments/[username]: Associates the URL with a user s comments about a book identified by the ISBN number. The user is identified by username. E B V N http://mydomain.com/users/[username]: Associates the URL with a user identified by username. http://mydomain.com/users/[username]/books: Associates the URL with the books owned by the user identified by username. http://mydomain.com/users/[username]/comments: Associates the URL with the comments made by the user identified by username. http://mydomain.com/users/[username]/wishlist: Associates the URL with the wish list of books wanted by the user identified by username. http://mydomain.com/search/books: Associates the URL with a search for a specific book. http://mydomain.com/search/users: Associates the URL with a search for a specific user. Looking at the different URLs, you can see that what is being illustrated is the logical orga nization of data associated with a URL. The first URL returns a representation of the book that may include comments about the book. Yet the comments associated with a book have their own URLs. A bit of thought about the implementation of the book URL would have the returned content include the comments of the book. What happens is not the inclusion of the comments in the book, but the inclusion of links to the comments of the book. When multiple items are being requested, do not create a URL that represents a list of resources. As in the example, asso ciate the list of resources with a root-like URL (for example, /[ISBN]/comments). The included comments links would be associated with a description.
We recommend high quality webhost to host and run your jsp application: christian web host services.