Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleweb.xml
<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
  version="2.4">

  <display-name>Cookbook</display-name>
  <context-param>
    <param-name>tapestry.app-package</param-name>
    <param-value>com.example.newapp</param-value>
  </context-param>

  <filter>
    <filter-name>app</filter-name>
    <filter-class>org.apache.tapestry5.http.TapestryFilter</filter-class> <!-- org.apache.tapestry5.TapestryFilter if not Tapestry 5.7.0+ -->
    <filter-class>org.apache.tapestry5.http.TapestryFilter</filter-class> 
  </filter>
  <filter-mapping>
    <filter-name>app</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>
  </filter-mapping>

  <error-page>
    <error-code>404</error-code>
    <location>/error404</location>
  </error-page>

</web-app>

...

Code Block
languagejava
titleError404.java
package com.example.newapp.pages;

import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.services.http.Request; // org.apache.tapestry5.services.Request if not Tapestry 5.7.0+
import org.apache.tapestry5.services.http.Request; 

public class Error404
{
    @Property
    @Inject
    private Request request;

    @Property
    @Inject
    @Symbol(SymbolConstants.PRODUCTION_MODE)
    private boolean productionMode;
}


...