|
PVF Server | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--pvf.site.PVFSite
This class should be extended by every class that must run on
PVFServer. You should override the init method to ensure
initialization of custom variables. You should not modify the
constructor of this class. If you must override it you should
call super() or write custom code to initialize the streams.
WARNING: You should not make any assumptions regarding the
way that the streams are handled by the server. You must note
that these streams are not connected directly to a socket (this
mean that what you send on them will not be imediately send to
the client). Usually, a message on the error stream will cause
the server to ignore the data on the output stream and send
a custom error message to the client (if you want to send
your own error message, you should not use the error stream!).
| Field Summary | |
java.lang.String[] |
env
The environment |
java.io.PrintWriter |
err
The PrintWriter used to send errors back to the client |
java.io.OutputStream |
errStream
The stream used to send errors back to the client |
PVFInputStream |
in
The stream used to get post data (the same with inStream). |
PVFInputStream |
inStream
The stream used to read post data |
java.io.PrintWriter |
out
The PrintWriter used to send data back to the client |
java.io.OutputStream |
outStream
The stream used to send data back to the client |
java.net.Socket |
sock
The socket for this connection. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
PVFSite()
If you override the constructor please place a call to super(). |
|
PVFSite(java.io.OutputStream outStream)
If you override the constructor please place a call to super(). |
|
| Method Summary | |
boolean |
ASPHandler(java.lang.String fname,
java.lang.String var)
This method is called by sendASPFile for every variable. |
void |
ASPNotFound(java.lang.String fname)
This method is called by sendASPFile if the requested file can not be read. |
boolean |
defaultASPHandler(java.lang.String fname,
java.lang.String cmd)
|
void |
finish()
This method is called when the script is finished. |
java.lang.String |
getAbsPath(java.lang.String rel)
Return the absolute path of a file (relative to the site root). |
java.lang.String |
getAbsPath(java.lang.String base,
java.lang.String rel)
Return the absolute path of a file. |
java.lang.String |
getCookie()
Return the current cookie value. |
java.lang.String |
getCookieValue(java.lang.String var)
Return a value from the cookie. |
java.lang.String |
getCookieWebified()
Return the current cookie value ready for web. |
java.lang.String |
getEnv(java.lang.String var)
Return the specified environment variable. |
java.io.OutputStream |
getErrorStream()
Used by the server to get the associated error stream |
java.io.InputStream |
getFormFileInputStream(java.lang.String fname)
This method will return a FileInputStream for the specified form file. |
java.lang.String |
getFormValue(java.lang.String name)
Return a value from the form data. |
PVFInputStream |
getInputStream()
Used by the server to get the associated input stream |
java.io.OutputStream |
getOutputStream()
Used by the server to get the associated output stream |
java.lang.String |
getQuery(java.lang.String var)
Return the value of a variable in the query string |
java.lang.String |
getScriptRoot()
Return the path of this script. |
void |
init()
Allow you to initialize custom fields. |
static void |
main(java.lang.String[] args)
Display a message if the user trys to directly execute this class. |
void |
onExit()
This method is called when the script is finished. |
void |
run()
This method will call the script method. |
void |
script()
The method that define the function of this class. |
void |
sendASPFile(java.lang.String fname)
Send an ASP file. |
void |
sendASPFileAbsolutePath(java.lang.String fname)
|
void |
sendASPFileAbsolutePath(java.lang.String s,
java.lang.String relativeFname)
Send an ASP file if you know its absolute path. |
void |
sendDataFile(java.lang.String s)
Send a data file |
void |
sendDataFileAbsolutePath(java.lang.String fname)
Send a data file |
void |
setASPErrors(boolean ASPErrors)
|
void |
setCookie(java.lang.String cookie)
Replace the current cookie with a new one. |
void |
setCookieValue(java.lang.String var,
int val)
Set a value in the cookie. |
void |
setCookieValue(java.lang.String var,
java.lang.String val)
Set a value in the cookie. |
void |
setEnv(java.lang.String[] env)
Used by the server to set the environment for this class. |
void |
setErrorStream(java.io.OutputStream errStream)
Set the error stream used by this script. |
Objects |
setFormData()
Set the form data from the query string or from the POST data. |
void |
setInputStream(java.io.InputStream ins)
Set the input stream used by this script. |
void |
setOutputStream(java.io.OutputStream outStream)
Set the output stream used by this script. |
void |
setScriptRoot(java.lang.String path)
Set the scriptRoot for this object (the path of this class). |
static java.lang.String |
unWebify(java.lang.String s)
"unWebify" a string by replacing %code and '+' with the corresponding characters. |
boolean |
useDirectClientConnection()
This method should return true if the script has its own error checking methods (or if it can not generate errors). |
static java.lang.String |
webify(java.lang.String str)
Encode a string for transmission. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public PVFInputStream inStream
public java.io.OutputStream outStream
public java.io.OutputStream errStream
public PVFInputStream in
public java.io.PrintWriter out
public java.io.PrintWriter err
public java.net.Socket sock
public java.lang.String[] env
| Constructor Detail |
public PVFSite()
public PVFSite(java.io.OutputStream outStream)
| Method Detail |
public void setOutputStream(java.io.OutputStream outStream)
public void setInputStream(java.io.InputStream ins)
public void setErrorStream(java.io.OutputStream errStream)
public PVFInputStream getInputStream()
public java.io.OutputStream getOutputStream()
public java.io.OutputStream getErrorStream()
public void setEnv(java.lang.String[] env)
env - the environmentpublic static void main(java.lang.String[] args)
args - the command line argumentspublic void init()
public void script()
throws java.lang.Exception
java.lang.Exceptionpublic void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic java.lang.String getEnv(java.lang.String var)
var - the requested variable
public void sendDataFile(java.lang.String s)
s - the file name relative to the classpublic void sendDataFileAbsolutePath(java.lang.String fname)
public java.lang.String getQuery(java.lang.String var)
var - the variable name
public Objects setFormData()
public java.lang.String getFormValue(java.lang.String name)
name - the variable name
public static final java.lang.String unWebify(java.lang.String s)
s - the string to unwebify
public static final java.lang.String webify(java.lang.String str)
str - the decoded string
public void setScriptRoot(java.lang.String path)
public java.lang.String getScriptRoot()
public void sendASPFile(java.lang.String fname)
public void sendASPFileAbsolutePath(java.lang.String fname)
public void sendASPFileAbsolutePath(java.lang.String s,
java.lang.String relativeFname)
public void setASPErrors(boolean ASPErrors)
public void ASPNotFound(java.lang.String fname)
public boolean ASPHandler(java.lang.String fname,
java.lang.String var)
public final void finish()
public void onExit()
public java.io.InputStream getFormFileInputStream(java.lang.String fname)
public java.lang.String getAbsPath(java.lang.String base,
java.lang.String rel)
base - the base path (can be "")rel - the relative pathpublic java.lang.String getAbsPath(java.lang.String rel)
public java.lang.String getCookie()
public java.lang.String getCookieWebified()
public java.lang.String getCookieValue(java.lang.String var)
var - the requested variable from the cookie
public void setCookieValue(java.lang.String var,
java.lang.String val)
var - the variable nameval - the value of that variable
public void setCookieValue(java.lang.String var,
int val)
var - the variable nameval - the value of that variablepublic void setCookie(java.lang.String cookie)
cookie - the new cookiepublic boolean useDirectClientConnection()
public boolean defaultASPHandler(java.lang.String fname,
java.lang.String cmd)
|
PVF Server | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||