|
http://www.eteks.com | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--com.eteks.awt.servlet.PJAServlet
This is a model of super class which tries its best to get an AWT toolkit default instance (either default system one or PJA). You must override these methods :
public void initPJA (ServletConfig config)
public void initPJA () throws ServletException
public String getServletInfoPJA ()
public void destroyPJA ()
public void servicePJA (ServletRequest req, ServletResponse resp)
protected void doGetPJA (HttpServletRequest req, HttpServletResponse resp)
protected void doPostPJA (HttpServletRequest req, HttpServletResponse resp)
protected void doPutPJA (HttpServletRequest req, HttpServletResponse resp)
protected void doDeletePJA (HttpServletRequest req, HttpServletResponse resp)
protected void doOptionsPJA (HttpServletRequest req, HttpServletResponse resp)
protected void doTracePJA (HttpServletRequest req, HttpServletResponse resp)
protected void servicePJA (HttpServletRequest req, HttpServletResponse resp)
PJA
extension.
All these standard methods are overriden in this class as final
methods to ensure
they won't be overriden again in PJAServlet
.super.
(like super.init (config)
) must use also their PJA postfixed counterpart
methods (resulting to super.initPJA (config)
). If not this will cause a stack overflow.com.eteks.awt.PJAToolkit
can't be loaded.
You can call createImage (width, height)
to instantiate an image, or do it yourself
with standard AWT code.PJAServlet
may need to reload and instantiate
classes with a special class loader to ensure that the classes java.awt.Toolkit
,
com.eteks.awt.PJAToolkit
, com.eteks.awt.servlet.PJAServlet
and the class
extending PJAServlet
shares the same classpath.
This implies that for example, JDBC connections should be initialized in initPJA ()
rather than in a constructor or in an initializer.
PJAToolkit
,
PJAServlet(boolean)
,
createImage(int,int)
, Serialized FormConstructor Summary | |
PJAServlet()
Creates a default PJAServlet instance that tries
its best to instantiate a default toolkit. |
|
PJAServlet(boolean forcePJA)
Creates a PJAServlet instance that tries to instantiate a default toolkit.If forcePJA is set to false , this constructor tries to instantiate
a default toolkit with Toolkit.getDefaultToolkit () with different procedures
in the following order :
Toolkit.getDefaultToolkit () with the current state of the JVM. |
Method Summary | |
java.awt.Image |
createImage(int width,
int height)
Returns an image of width x height pixels using default toolkit.
|
void |
destroy()
Override destroyPJA () instead of this final method.
|
void |
destroyPJA()
Override this method instead of the final method destroy () .
|
protected void |
doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override doDeletePJA () instead of this final method.
|
void |
doDeletePJA(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override this method instead of the final method doDelete () .
|
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override doGetPJA () instead of this final method.
|
void |
doGetPJA(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override this method instead of the final method doGet () .
|
protected void |
doOptions(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override doOptionsPJA () instead of this final method.
|
void |
doOptionsPJA(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override this method instead of the final method doOptions () .
|
protected void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override doPostPJA () instead of this final method.
|
void |
doPostPJA(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override this method instead of the final method doPost () .
|
protected void |
doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override doPutPJA () instead of this final method.
|
void |
doPutPJA(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override this method instead of the final method doPut () .
|
protected void |
doTrace(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override doTracePJA () instead of this final method.
|
void |
doTracePJA(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override this method instead of the final method doTrace () .
|
java.lang.String |
getFontsPath()
Override this method to return the fonts path where .pjaf files (JDK 1.1) or True Type files (JDK >= 1.2) can be found. |
java.lang.String |
getServletInfo()
Override getServletInfoPJA () instead of this final method.
|
java.lang.String |
getServletInfoPJA()
Override this method instead of the final method getServletInfo () .
|
java.lang.String |
getSystemProperty(java.lang.String property,
java.lang.String defaultValue)
Same as System.getProperty (String prop, String default) but
System.getProperty () is called in a try catch block
to catch SecurityException exceptions.
|
java.lang.String |
getUserHomeDir()
Override this method to return the user home directory where the file lib/font.properties can be found.
|
void |
init()
Override initPJA () instead of this final method.
|
void |
init(javax.servlet.ServletConfig config)
Override initPJA (ServletConfig config) instead of this final method.
|
void |
initPJA()
Override this method instead of the final method init () .
|
void |
initPJA(javax.servlet.ServletConfig config)
Override this method instead of the final method init (ServletConfig config) .
|
boolean |
isDefaultToolkitAvailable()
This is a convenience method to know if default toolkit is available or not. |
protected void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override servicePJA (HttpServletRequest req, HttpServletResponse resp) instead of this final method.
|
void |
service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse resp)
Override servicePJA (ServletRequest req, ServletResponse resp) instead of this final method.
|
void |
servicePJA(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Override this method instead of the final method service (HttpServletRequest req, HttpServletResponse resp) .
|
void |
servicePJA(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse resp)
Override this method instead of the final method service (ServletRequest req, ServletResponse resp) .
|
protected boolean |
testDefaultToolkit()
|
Methods inherited from class javax.servlet.http.HttpServlet |
getLastModified |
Methods inherited from class javax.servlet.GenericServlet |
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PJAServlet()
PJAServlet
instance that tries
its best to instantiate a default toolkit.PJAServlet(boolean)
public PJAServlet(boolean forcePJA)
PJAServlet
instance that tries to instantiate a default toolkit.forcePJA
is set to false
, this constructor tries to instantiate
a default toolkit with Toolkit.getDefaultToolkit ()
with different procedures
in the following order :
Toolkit.getDefaultToolkit ()
with the current state of the JVM. If
no Display is available on a UNIX machine and PJAToolkit
not passed at JVM
startup as default toolkit class, this won't work because the default Toolkit
class of the JVM requires a valid Display.Toolkit.getDefaultToolkit ()
setting all system properties required
to instantiate a PJAToolkit
class. This won't work for servlet servers using a
different class loader (and classpath) for system and each servlet user,
if pja.jar is not added to system classpath.Toolkit.getDefaultToolkit ()
setting all system properties required
to instantiate a PJAToolkit
class and loading java.awt.Toolkit
and java.awt.GraphicsEnvironment
classes with a special class loader that uses
servlet classpath. The servlet extending this class is instantiated a second time with
this special loader, allowing java.awt.Toolkit
and the second servlet instance
to share the same class loader and classpath.Toolkit.getDefaultToolkit ()
will be able to find PJAToolkit
in
its classpath to load and instantiate this class.forcePJA
is set to true
, PJAToolkit
and
PJAImage
will always be used. This disables all Java2D features but ensures the
same results on all platforms where subclasses of PJAServlet
are used.Method Detail |
protected boolean testDefaultToolkit()
public java.lang.String getFontsPath()
File.pathSeparator
.PJAServlet
constructor.PJAServlet
implementation returns "."
+ File.pathSeparator + getSystemProperty ("user.dir")
+ File.pathSeparator + getSystemProperty ("java.home")
public java.lang.String getUserHomeDir()
lib/font.properties
can be found.
This is usefull for JDK 1.2.PJAServlet
constructor.PJAServlet
implementation returns getSystemProperty ("user.home")
public java.lang.String getSystemProperty(java.lang.String property, java.lang.String defaultValue)
System.getProperty (String prop, String default)
but
System.getProperty ()
is called in a try catch
block
to catch SecurityException
exceptions.
If a SecurityException
exception is catched, a log is done and
defaultValue
is returned.public boolean isDefaultToolkitAvailable()
Toolkit.getDefaultToolkit ()
and catch all the exeptions that may be thrown.
java.awt.Font
class can't be instantiated if this method
returns false
.PJAImage
public java.awt.Image createImage(int width, int height)
width x height
pixels using default toolkit.
If isDefaultToolkitAvailable ()
returns false
,
an instance of com.eteks.awt.PJAImage
is returned.public final java.lang.String getServletInfo()
getServletInfoPJA ()
instead of this final
method.
Don't call super.getServletInfo ()
from getServletInfoPJA ()
.getServletInfo
in class javax.servlet.GenericServlet
public java.lang.String getServletInfoPJA()
getServletInfo ()
.
PJAServlet
implementation calls super.getServletInfo ()
.public final void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
initPJA (ServletConfig config)
instead of this final
method.
Don't call super.init (config)
from initPJA (ServletConfig config)
.init
in class javax.servlet.GenericServlet
public void initPJA(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init (ServletConfig config)
.
PJAServlet
implementation calls super.init (config)
.public final void init() throws javax.servlet.ServletException
initPJA ()
instead of this final
method.
Don't call super.init ()
from initPJA ()
.init
in class javax.servlet.GenericServlet
public void initPJA() throws javax.servlet.ServletException
init ()
.
PJAServlet
implementation calls super.init ()
.public final void destroy()
destroyPJA ()
instead of this final
method.
Don't call super.destroy ()
from destroyPJA ()
.destroy
in class javax.servlet.GenericServlet
public void destroyPJA()
destroy ()
.
PJAServlet
implementation calls super.destroy ()
.public final void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
servicePJA (ServletRequest req, ServletResponse resp)
instead of this final
method.
Don't call super.service (req, resp)
from servicePJA (ServletRequest req, ServletResponse resp)
.service
in class javax.servlet.http.HttpServlet
public void servicePJA(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
service (ServletRequest req, ServletResponse resp)
.
PJAServlet
implementation calls super.service (req, resp)
.protected final void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doGetPJA ()
instead of this final
method.
Don't call super.doGet (req, resp)
from doGetPJA (HttpServletRequest req, HttpServletResponse resp)
.doGet
in class javax.servlet.http.HttpServlet
public void doGetPJA(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doGet ()
.
PJAServlet
implementation calls super.doGet ()
.protected final void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doPostPJA ()
instead of this final
method.
Don't call super.doPost (req, resp)
from doPostPJA (HttpServletRequest req, HttpServletResponse resp)
.doPost
in class javax.servlet.http.HttpServlet
public void doPostPJA(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doPost ()
.
PJAServlet
implementation calls super.doPost ()
.protected final void doPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doPutPJA ()
instead of this final
method.
Don't call super.doPut (req, resp)
from doPutPJA (HttpServletRequest req, HttpServletResponse resp)
.doPut
in class javax.servlet.http.HttpServlet
public void doPutPJA(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doPut ()
.
PJAServlet
implementation calls super.doPut ()
.protected final void doDelete(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doDeletePJA ()
instead of this final
method.
Don't call super.doDelete (req, resp)
from doDeletePJA (HttpServletRequest req, HttpServletResponse resp)
.doDelete
in class javax.servlet.http.HttpServlet
public void doDeletePJA(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doDelete ()
.
PJAServlet
implementation calls super.doDelete ()
.protected final void doOptions(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doOptionsPJA ()
instead of this final
method.
Don't call super.doOptions (req, resp)
from doOptionsPJA (HttpServletRequest req, HttpServletResponse resp)
.doOptions
in class javax.servlet.http.HttpServlet
public void doOptionsPJA(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doOptions ()
.
PJAServlet
implementation calls super.doOptions ()
.protected final void doTrace(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doTracePJA ()
instead of this final
method.
Don't call super.doTrace (req, resp)
from doTracetPJA (HttpServletRequest req, HttpServletResponse resp)
.doTrace
in class javax.servlet.http.HttpServlet
public void doTracePJA(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doTrace ()
.
PJAServlet
implementation calls super.doTrace ()
.protected final void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
servicePJA (HttpServletRequest req, HttpServletResponse resp)
instead of this final
method.
Don't call super.service (req, resp)
from servicePJA (HttpServletRequest req, HttpServletResponse resp)
.service
in class javax.servlet.http.HttpServlet
public void servicePJA(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
service (HttpServletRequest req, HttpServletResponse resp)
.
PJAServlet
implementation calls super.service (req, resp)
.
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |