Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Configuration > server

server

Server is the top-level structure in the configuration. It has all the properties of domain and zone. Server always serves the request if no other domain or zone accepts the request for handling.

Server has no specific attributes. See domain and zone for available attributes.

Note: value of the path attribute of server is always /

Simplified request-handling process:

  • The HTTP/1.1 Host request header is used to determine the domain for request. If there are no domains, or none of the domains match the header, the server is chosen as the domain.
  • The request pathinfo (see session) is used to determine the zone. This is an iterative process: for each zone on the current level, a candidate zone's path is checked to see if it matches the current position in the request pathinfo. With each iteration, the position moves forward to cover previously matched parts of the path.

    (Because of differences in servlet environments, the Request adapter is used to split the URI into the servlet path, the session id, and the pathinfo.)

    Example:
    server:
      zone:
        path = shop
        zone:
          path = admin
          zone:
            path = images
          end
        end:
        zone:
          path = images
        end
      end
    end
    

    /index.nvl match with server.
    /images/logo.gif match with server/zone:images.
    /shop/products.nvl match with server/zone:shop.
    /shop/admin/index.nvl match with server/zone:shop/zone:admin.
    /shop/admin/images/remove.gif match with server/zone:shop/zone:admin/zone:images.

  • The serving zone is now resolved. The zone's preferences and attributes (inherited or declared) will now determine how the request is handled.
  • If session is required but doesn't exist in a cookie or in the path, a new session will be created, and a session id is placed in the URL or cookie.
  • Authorization is now checked: if it is required, an authorization challenge is presented. (The authorization provider may require session to be present.) After authorization passes, the request will proceed. Note that if a URL redirect took place at a previous stage, the request cycle started over from the beginning.
  • There is an exception for session and authorization handling: if the request points to a static-type of resource, such as a image, the session might not be required. This might involve bind and handlers preferences.
  • Next, the content type and content handler is determined, using bind and handlers preferences.
  • Content handler is used to produce the output (for example, to execute a script).

The following are additional issues, once the domain and zone have been resolved.

  • Requests referring to directories must have '/' at the end of the pathinfo. An HTTP redirect is generated to accomplish this.
  • A directory index is silently added to the path; then the directory is accessed and the index is set.
  • Zones marked as hidden will produce "403 Hidden" messages.
  • If a dispatcher is used, then the request is passed to the dispatcher instead of the resource pointed to by the request. anvil.net.Context.getResource() is used to return the original pathinfo, with the path of the dispatcher's zone excluded.
  • In zones, if the pattern attribute is used instead of the path, then the regular expression supplied will be used to determine the zone. When the zone is matched by pattern, the scanning position in the pathinfo is not moved forward.

See also  | Configuration  | domain  | Installation
Contributes notes:
Add a note
What's new | Anvil