Request path mappings

Your application’s deployment descriptor must specify the request path mappings for the application’s servlets and JSPs. You can map full paths, partial paths, or file extensions to servlets. Path mappings are specified relative to the application’s root request path.

To map request paths to a JSP, the JSP must be defined in EAServer Manager as a Web component. See Chapter 24, “Creating JavaServer Pages,” for more information.

EAServer uses the precedence rules defined in the Servlet 2.3 specification to evaluate each URL:

  1. EAServer checks whether a mapping uses the exact path.

  2. EAServer checks whether a directory in the path is mapped to a servlet, starting at the most deeply nested directory in the path, and working back using the forward-slash character (/) as a separator. For example, if the application’s root request path is MyApp and the URL path is MyApp/Accounts/Manage/add.jsp, EAServer checks for servlets mapped to /Accounts/Manage, then /Accounts.

  3. If the last node in the path contains an extension, EAServer checks for a servlet mapped to that file extension. A file extension is defined as the part of the URL that follows a ‘.’ occurring after the last ‘/’ in the URL. For example, in the path MyApp/Accounts/Manage/add.calc, the extension is calc.

  4. If neither of the previous two rules results in a match, EAServer invokes the application’s default servlet if defined. The default servlet is mapped to the path /. If no default servlet is defined, EAServer looks for a static file matching the path.

NoteImplicit JSP mapping The jsp extension is implicitly mapped to invoke EAServer’s JSP engine. You can override this mapping in the explicit mappings for your Web application by mapping *.jsp to a servlet or JSP. However, if you do so, there is no way to invoke the EAServer JSP engine to compile and run arbitrary JSP files. Explicit *.jsp mappings are not recommended.

StepsAdding a request path mapping

  1. Display the Servlet Mapping tab in the Web Application Properties dialog box.

  2. Click Add. A new mapping appears with default settings. Edit the settings as described below.

StepsEditing a request path mapping

  1. If necessary, display the Servlet Name tab in the Web Application Properties dialog box. A list of mappings appears, formatted as a table. You can edit any mapping by editing the text directly within the table cells.

  2. Edit the servlet name and mapped path, using the following rules to format the path specification:

    • All mappings are relative to the Web application’s root request directory.

    • To map a directory, enter a path that ends in a ‘*’, for example /foo/* or /foo/stuff/*.

    • To map an extension, enter *.ext, where ext is the extension.

    • To specify a default servlet for the application, enter the path as a single forward slash (/).

    • To specify an exact match, enter the full path relative to the Web application’s root request directory.