Class DefaultBufferedStreamContent

java.lang.Object
org.eclnt.jsfserver.bufferedcontent.DefaultBufferedStreamContent
All Implemented Interfaces:
Serializable, IBufferedStreamContent, ICCServerConstants

public abstract class DefaultBufferedStreamContent extends Object implements IBufferedStreamContent, ICCServerConstants
Default implementation of IBufferedContent interface. Should be used for all implementations. This class will be updated in case the interface is extended.
See Also:
  • Constructor Details

    • DefaultBufferedStreamContent

      public DefaultBufferedStreamContent()
  • Method Details

    • getContentLength

      public long getContentLength()
      Description copied from interface: IBufferedStreamContent
      Optional: return length of content in number of bytes. If you do not know the length of the content then just return -1.
      Specified by:
      getContentLength in interface IBufferedStreamContent
    • setExtension

      public void setExtension(String value)
      You may pass an optional extension (e.g. "xls", "txt", "pdf", "html", ...). This extension is appended to the URL. If the URL is sent to the browser then the extension helps the browser to start the right application that is associated with the content.

      PLEASE CHECK: when using the extension then the servlet mapping of the BufferedContentServlet needs to be up to date - please check your web.xml file against the template (web.xml_template).
    • getExtension

      public String getExtension()
    • getId

      public String getId()
      Specified by:
      getId in interface IBufferedStreamContent
    • setFileName

      public void setFileName(String value)
      You may pass an optional file name (e.g. "harry.xls", "jo.txt", ...). The URL that is internally built up will end with this file name, so that it gets automatically proposed when doing direct downloads via a web browser.

      The purpose for adding a file name is to pass a file name into the URL so that browsers propose the file name when e.g. downloading data from this URL.

      If setting an explicit file name, then this definition will override the extension-definition that you may do with setExtension(String).

      PLEASE CHECK: when using the extension then the servlet mapping of the BufferedContentServlet needs to be up to date - please check your web.xml file against the template (web.xml_template).
    • getFileName

      public String getFileName()
    • getURL

      public String getURL()
      The URL that can be passed back to client side for accessing the buffered content. The URL contains the session id. The URL is a relative URL that can be passed to all Swing-based components (e.g. FILEDOWNLOADLINK) in any scenario.

      When using CaptainCasa in embedded usage mode (UI is running with stand alone Tomcat within one virutal machine) and passing the URL to the BROWSER component then there will be problems. Use the function getURLForBrowserUsage() instead.
      Specified by:
      getURL in interface IBufferedStreamContent
    • getURLForBROWSERUsage

      @Deprecated public String getURLForBROWSERUsage()
      Deprecated.
      Depreacted - usr getURL(). The embedded mode ist not supported with the RISC client.

      Passes back a "normal URL" when running in "normal scenarios". When using CaptainCasa Enterprise Client in embedded usage mode (Tomcat running directly inside client) then the URL passed back is a file:///-URL. In this case the content is directly resolved within this method and written into a temporary location (work directory).
      Specified by:
      getURLForBROWSERUsage in interface IBufferedStreamContent
    • passClientFileName

      public void passClientFileName(String clientFileName)
      Internal usage.
      Specified by:
      passClientFileName in interface IBufferedStreamContent
    • passCurrentRequestQueryString

      public void passCurrentRequestQueryString(String queryString)
      Internal usage. - The request query string of the current request, accessing the buffered content is passed.
      Specified by:
      passCurrentRequestQueryString in interface IBufferedStreamContent
    • getCurrentRequestQueryString

      public String getCurrentRequestQueryString()
      When the buffered content is accessed then you may be interested in the URL by which the buffered content is called. - This parameter is only valid when the buffered content is actually requested from the client side.
    • passCurrentRequestURL

      public void passCurrentRequestURL(String url)
      Internal usage. - The request URL of the current request, accessing the buffered content is passed.
      Specified by:
      passCurrentRequestURL in interface IBufferedStreamContent
    • getCurrentClientFileName

      public String getCurrentClientFileName()
      If the access to the buffered content is associated with a client file download, then the name of the client file may be available via this method. ("may be"...: with the Swing and FX client components the file name is passed, with the HTML upload components the file name is NOT passed.
    • getCurrentRequestURL

      public String getCurrentRequestURL()
      When the buffered content is accessed then you may be interested in the URL by which the buffered content is called. - This parameter is only valid when the buffered content is actually requested from the client side.
    • beginGetting

      public void beginGetting()
      When overriding this method always call super() in your implementation!
      Specified by:
      beginGetting in interface IBufferedStreamContent
    • endGetting

      public void endGetting()
      When overriding this method always call super() in your implementation!
      Specified by:
      endGetting in interface IBufferedStreamContent
    • preProcessResponse

      public void preProcessResponse(javax.servlet.http.HttpServletResponse response)
      This method is called before building the content: you still may e.g. set special http header parameters for the response
      Specified by:
      preProcessResponse in interface IBufferedStreamContent