PyServletInitializer (Jython API documentation)
Date: 2012-08-13

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.python.util
Class PyServletInitializer

    java.lang.Object
      org.python.util.PyServletInitializer

All Implemented Interfaces:
  EventListener, javax.servlet.ServletContextListener

    public class PyServletInitializer

extends Object
implements javax.servlet.ServletContextListener

Initializes the jython runtime inside a servlet engine. Should be used with `PyFilter` to initialize the system before the filter starts. Add the following to web.xml to run the initializer:

       <listener>
           <listener-class>org.python.util.PyServletInitializer</listener-class>
           <load-on-startup>1</load-on-startup>
       </listener>

To use modules from Python's standard library in servlets and filters initialized by this listener, either add the standard library to the lib directory in WEB-INF, or add python.home as a context-param. The latter can be done by adding the following to web.xml:

     <context-param>
         <param-name>python.home</param-name>
         <param-value>/usr/local/jython-2.5</param-value>
     </context-param>

Constructor Summary
`PyServletInitializer()`

Method Summary
`void` | `contextDestroyed(javax.servlet.ServletContextEvent evt)`
`void` | `contextInitialized(javax.servlet.ServletContextEvent evt)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PyServletInitializer

    public PyServletInitializer()

Method Detail

### contextInitialized

    public void contextInitialized(javax.servlet.ServletContextEvent evt)

  Specified by:
    `contextInitialized` in interface `javax.servlet.ServletContextListener`

### contextDestroyed

    public void contextDestroyed(javax.servlet.ServletContextEvent evt)

  Specified by:
    `contextDestroyed` in interface `javax.servlet.ServletContextListener`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Jython homepage