Top Description Constructors Methods
org.python.util

public Class PyServletInitializer

extends Object
implements ServletContextListener
Class Inheritance
All Implemented Interfaces
javax.servlet.ServletContextListener, java.util.EventListener
Imports
java.util.Properties, javax.servlet.ServletContextEvent, .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

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
contextDestroyed(ServletContextEvent
the ServletContextEvent containing the ServletContext that is being destroyed
evt
)

Overrides default javax.servlet.ServletContextListener.contextDestroyed.

Receives notification that the ServletContext is about to be shut down.

public void
contextInitialized(ServletContextEvent
the ServletContextEvent containing the ServletContext that is being initialized
evt
)

Overrides default javax.servlet.ServletContextListener.contextInitialized.

Receives notification that the web application initialization process is starting.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PyServletInitializerback to summary
public PyServletInitializer()

Method Detail

contextDestroyedback to summary
public void contextDestroyed(ServletContextEvent evt)

Overrides default javax.servlet.ServletContextListener.contextDestroyed.

Doc from javax.servlet.ServletContextListener.contextDestroyed.

Receives notification that the ServletContext is about to be shut down.

All servlets and filters will have been destroyed before any ServletContextListeners are notified of context destruction.

Parameters
evt:ServletContextEvent

the ServletContextEvent containing the ServletContext that is being destroyed

contextInitializedback to summary
public void contextInitialized(ServletContextEvent evt)

Overrides default javax.servlet.ServletContextListener.contextInitialized.

Doc from javax.servlet.ServletContextListener.contextInitialized.

Receives notification that the web application initialization process is starting.

All ServletContextListeners are notified of context initialization before any filters or servlets in the web application are initialized.

Parameters
evt:ServletContextEvent

the ServletContextEvent containing the ServletContext that is being initialized