Home of: [Atelier "FUJIGURUMA"] >> [PageMixer hosted by SourceForge.net]

SEE "For Readers of English Version",
or Japanese version of this page

Deployment

This section shows example of deployment descriptor mapping PageServlet.

Configure LocalePageServlet

Example of LocalePageServlet Servlet definition is shown below. This is from src/demo/servlet/war/WEB-INF/web.xml in src/bin distributions.


<servlet>
  <servlet-name>
    limited.page
  </servlet-name>
  <servlet-class>
    jp.ne.dti.lares.foozy.pagemixer.servlet.LocalePageServlet
  </servlet-class>

  <init-param>
    <param-name>
      servlet.contextFactory
    </param-name>
    <param-value>
      pagemixer.servlet.CustomContextFactory
    </param-value>
  </init-param>
  <init-param>
    <param-name>
      servlet.localeFactory
    </param-name>
    <param-value>
      pagemixer.servlet.CustomLocaleFactory
    </param-value>
  </init-param>

  <init-param>
    <param-name>
      forward.condition.0
    </param-name>
    <param-value>
      pagemixer.servlet.NotLoginCondition
    </param-value>
  </init-param>
  <init-param>
    <param-name>
      filter.factory.0
    </param-name>
    <param-value>
      pagemixer.filter.CommonFilter$Factory
    </param-value>
  </init-param>
  <init-param>
    <param-name>
      filter.factory.1
    </param-name>
    <param-value>
      pagemixer.filter.AuthFilter$Factory
    </param-value>
  </init-param>
  <init-param>
    <param-name>
      page.location
    </param-name>
    <param-value>
      page.demosite.limited
    </param-value>
  </init-param>
</servlet>

Define Servlet of LocalePage

This cofiguration consists of customization strategy substitutions shown below.

name for description
servlet.contextFactory LocalePage use "CustomContextFactory" instead of default one
servlet.localeFactory LocalePage use "CustomLocaleFactory" instead of default one

This configuration causes using default strategy on the other customization points.

The other initialization parameters, which are shown below, are used to configure customization strategies.

name for description
forward.condition.0 ForwardStrategy register "NotLoginCondition" as "ForwardCondition" implementation
filter.factory.0 FilterFactory register "CommonFilter$Factory" as "Filter.Factory" implementation
filter.factory.1 FilterFactory register "AuthFilter$Factory" as "Filter.Factory" implementation
page.location LocalePage use "page.demosite.limited" to look "ResourceBundle" up as base name of it

page.location configuration requires that page/demosite/limited_*.properties files are visible in class loading path, which includes WEB-INF/classes or JAR files in WEB-INF/lib.

For example, limited_ja.properties has contents as shown below.


contentType:text/html; charset=Windows-31J
location:/WEB-INF/page/demosite/limited.ja.html
#"encoding" is omittable
#encoding:Windows-31J

Contents of limited_ja.properties

Then, this Servlet will mapped by configuration shown below.


<servlet-mapping>
  <servlet-name>
    limited.page
  </servlet-name>
  <url-pattern>
    /demosite/limited.page
  </url-pattern>
</servlet-mapping>

Map Servlet of LocalePageServlet

Map I18NDefaultPageServlet

Example of I18NDefaultPageServlet Servlet definition is shown below. This is also from src/demo/servlet/war/WEB-INF/web.xml in src/bin distributions.


<servlet>
  <servlet-name>
    DefaultPage
  </servlet-name>
  <servlet-class>
    jp.ne.dti.lares.foozy.pagemixer.servlet.I18NDefaultPageServlet
  </servlet-class>

  <init-param>
    <param-name>
      servlet.contextFactory
    </param-name>
    <param-value>
      pagemixer.servlet.CustomContextFactory
    </param-value>
  </init-param>
  <init-param>
    <param-name>
      servlet.localeFactory
    </param-name>
    <param-value>
      pagemixer.servlet.CustomLocaleFactory
    </param-value>
  </init-param>

  <init-param>
    <param-name>
      filter.factory.0
    </param-name>
    <param-value>
      pagemixer.filter.CommonFilter$Factory
    </param-value>
  </init-param>
  <init-param>
    <param-name>
      page.contentType
    </param-name>
    <param-value>
      text/html; charset=iso-8859-1
    </param-value>
  </init-param>
  <init-param>
    <param-name>
      page.suffix.0
    </param-name>
    <param-value>
      .ja.html
    </param-value>
  </init-param>
  <init-param>
    <param-name>
      page.contentType.0
    </param-name>
    <param-value>
      text/html; charset=Windows-31J
    </param-value>
  </init-param>
</servlet>

Define Servlet of I18NDefaultPage

This cofiguration consists of customization strategy substitutions as same as ones of LocalePageServlet.

Initialization parameters shown below are used to configure customization strategies.

name for description
filter.factory.0 FilterFactory register "CommonFilter$Factory" as "Filter.Factory" implementation
page.contentType I18NDefaultPage use "text/html; charset=iso-8859-1" as default content type
page.suffix.0 I18NDefaultPage treat URI which ends with ".ja.html" as special case
page.contentType.0 I18NDefaultPage use "text/html; charset=Windows-31J" as content type for requests of URI which ends with ".ja.html" specified by "page.suffix.0"

Then, this Servlet will mapped by configuration shown below.


<servlet-mapping>
  <servlet-name>
    DefaultPage
  </servlet-name>
  <url-pattern>
    *.html
  </url-pattern>
</servlet-mapping>

Map Servlet of I18NDefaultServlet