Class WebDoc

java.lang.Object
ch.software_atelier.simpleflex.docs.WebDoc
Direct Known Subclasses:
BeanShellDoc, ByteDoc, ErrorDoc, FileDoc, InputStreamDoc, JSONDoc, RedirectorDoc, RessourceDoc, StringDoc, TemplateDoc, XMLDoc, ZipDoc

public abstract class WebDoc extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    This static var defines that the data of a WebDoc-Object is a byte[].
    static final String
    This static var returns that the data of a WebDoc-Object is a stream.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract byte[]
    If you want to return the documents data as a byte[], you have to do that here.
    abstract void
    This method is called after the transmission.
    abstract String
    Specifies the Type of served data.
     
     
    abstract String
    This method has to return the MIME-Type of the Document.
    abstract String
    This method has to return the FileName of the Document.
    final void
    setHTTPCode(int code, String message)
    Sets the HTTP Response Code.
    abstract long
    This method has to return the size of the Document in bytes.
    abstract InputStream
    If you want to return the documents data as a Stream, you have to do that here.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DATA_STREAM

      public static final String DATA_STREAM
      This static var returns that the data of a WebDoc-Object is a stream.
      See Also:
    • DATA_BYTE

      public static final String DATA_BYTE
      This static var defines that the data of a WebDoc-Object is a byte[].
      See Also:
  • Constructor Details

    • WebDoc

      public WebDoc()
  • Method Details

    • size

      public abstract long size()
      This method has to return the size of the Document in bytes.
      Returns:
    • mime

      public abstract String mime()
      This method has to return the MIME-Type of the Document. Example: text/plain. You can also use the static Method Utils.getMime(String ext) to get the MIME-Type of a File-Extension.
      Returns:
    • name

      public abstract String name()
      This method has to return the FileName of the Document.
      Returns:
    • byteData

      public abstract byte[] byteData()
      If you want to return the documents data as a byte[], you have to do that here. Be sure, that the method dataType() returns WebDoc.DATA_BYTE! Else just return null or something else. If the method dataType() does not return WebDoc.DATA_BYTE, this method will never be called.
      Returns:
    • streamData

      public abstract InputStream streamData()
      If you want to return the documents data as a Stream, you have to do that here. Be sure, that the method dataType() returns WebDoc.DATA_STREAM! Else just return null or something else. If the method dataType() does not return WebDoc.DATA_STREAM, this method will never be called. The Stream will be closed by the Server-App so you have nothing to do with that.
      Returns:
    • dataType

      public abstract String dataType()
      Specifies the Type of served data. Look at streamData() and/or byteData()
      Returns:
    • close

      public abstract void close()
      This method is called after the transmission. It can be used to cleanup something.
    • setHTTPCode

      public final void setHTTPCode(int code, String message)
      Sets the HTTP Response Code. Default is 200 - OK. HTTPCodes.getMsg() returns the message for all known codes, defined by the RFC.
      Parameters:
      code -
      message -
    • getHttpCode

      public WebDoc.HTTPCode getHttpCode()
    • getHeaders

      public ArrayList<HeaderField> getHeaders()