eWON JTK

com.ewon.ewonitf
Class WebProducer

java.lang.Object
  extended by java.io.OutputStream
      extended by com.ewon.ewonitf.WebProducer
Direct Known Subclasses:
EvtWebAstListener, EvtWebFormListener

public class WebProducer
extends OutputStream


Constructor Summary
WebProducer()
          Creates a new instance of WebProducer
 
Method Summary
static String escapePath(String path)
          This function returns a copy of a path string with anything other than "unreserved" and the forward-slash character percent-encoded according to the URI encoding rules.
 String getWebVar(String varName, String defaultValue)
           
 void produceAstPage(String astPageURL)
          Send the content of the given web page URL (relative or absolute URL example: /usr/mytemplate.shtm), to to web client connected.
 void setEventHandler(int webEventHandler)
           
 void setWebHeader(String mimeType)
           
 void setWebVar(String varName, String varValue)
           
static String unescapePath(String path)
          This function returns a copy of a path that was encoded with the forward-slash character percent-encoded according to the URI encoding rules in an UNENCODED form.
 void write(byte[] b, int off, int len)
          overrides the OutputStream function in order to go faster
 void write(int data)
          Writes the specified byte to this output stream.
 
Methods inherited from class java.io.OutputStream
close, flush, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebProducer

public WebProducer()
Creates a new instance of WebProducer

Method Detail

setEventHandler

public void setEventHandler(int webEventHandler)

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
overrides the OutputStream function in order to go faster

Overrides:
write in class OutputStream
Parameters:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.
Throws:
IOException - if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.

write

public void write(int data)
           throws IOException
Description copied from class: OutputStream
Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Subclasses of OutputStream must provide an implementation for this method.

Specified by:
write in class OutputStream
Parameters:
data - the byte.
Throws:
IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.

setWebHeader

public void setWebHeader(String mimeType)

setWebVar

public void setWebVar(String varName,
                      String varValue)

getWebVar

public String getWebVar(String varName,
                        String defaultValue)

escapePath

public static String escapePath(String path)
This function returns a copy of a path string with anything other than "unreserved" and the forward-slash character percent-encoded according to the URI encoding rules.

Parameters:
path - The path to encode.
Returns:
the encoded path.

unescapePath

public static String unescapePath(String path)
This function returns a copy of a path that was encoded with the forward-slash character percent-encoded according to the URI encoding rules in an UNENCODED form.

Parameters:
path - The path to decode.
Returns:
the decoded (unencoded) path.
Throws:
OutOfMemory - if unable to decode the path or memory problem.

produceAstPage

public void produceAstPage(String astPageURL)
Send the content of the given web page URL (relative or absolute URL example: /usr/mytemplate.shtm), to to web client connected. During its production to the client, the template is parsed and any SSI tag is replaced by a valid content.
Important: Because the AST page is parsed, if this page contains Java AST, then the event handler must handle web forms in threads, otherwise the AST request will block the JVM (DefaultEventHandler.setAstFormListenerThreadMode(true)).

Parameters:
astPageURL - this is the URL to the page that must be output.

eWON JTK

www.eWON.biz: Your Eyes Watching Over Net