Class URLContentExportBean

java.lang.Object
com.webmethods.caf.faces.bean.URLContentExportBean
All Implemented Interfaces:
IFileExportBean, IFileExportBeanEx
Direct Known Subclasses:
FileContentExportBean

public class URLContentExportBean extends Object implements IFileExportBeanEx
Export the Contents of a URL
  • Field Details

    • connection

      protected URLConnection connection
      URLConnection to the URL resource to be exported
    • forceDownload

      protected boolean forceDownload
      boolean for force download, see #setDownloadForced(boolean).
    • charactersEncoding

      protected String charactersEncoding
      Character encoding for export of file content.

      Default: UTF-8

  • Constructor Details

    • URLContentExportBean

      public URLContentExportBean(URL url, boolean forceDownload) throws IOException
      Constructor.
      Parameters:
      url - URL to the resource to be exported
      forceDownload - force download, see isDownloadForced()
      Throws:
      IOException - when exceptions in opening a connection to the passed URL
  • Method Details

    • getExportContentLength

      public int getExportContentLength()
      Description copied from interface: IFileExportBean
      Return the length of the content that is to be exported.
      Specified by:
      getExportContentLength in interface IFileExportBean
      Returns:
      the length of the content or return IFileExportBean.UNKNOWN_CONTENT_LENGTH if it is not known
    • getExportContentType

      public String getExportContentType()
      Description copied from interface: IFileExportBean
      Gets the content type of the response being sent to the client. The content type may include the type of character encoding used, for example, text/html; charset=ISO-8859-4.
      Specified by:
      getExportContentType in interface IFileExportBean
      Returns:
      content type of the exported content
    • getExportFileName

      public String getExportFileName()
      Description copied from interface: IFileExportBean
      Return the file name for the exported data
      Specified by:
      getExportFileName in interface IFileExportBean
      Returns:
      file name for the exported file
    • isDownloadForced

      public boolean isDownloadForced()
      Description copied from interface: IFileExportBean
      Return true to send the response headers that will force the user to choose what to do with the file (Open vs. Save).
      Specified by:
      isDownloadForced in interface IFileExportBean
      Returns:
      true to force a download
    • isExportBinary

      public boolean isExportBinary()
      Description copied from interface: IFileExportBean
      Return true if the export will be sending binary data to the response, false if the export will be sending text.
      Specified by:
      isExportBinary in interface IFileExportBean
      Returns:
      true for binary export, false for text
    • writeExportBytes

      public void writeExportBytes(OutputStream outStream) throws IOException
      Description copied from interface: IFileExportBean
      Invoked to allow the bean to write binary data to the output stream.
      Specified by:
      writeExportBytes in interface IFileExportBean
      Parameters:
      outStream - the output stream
      Throws:
      IOException - thrown if there is an I/O exception during the export
    • writeExportText

      public void writeExportText(PrintWriter arg0)
      Description copied from interface: IFileExportBean
      Invoked to allow the bean to write the export text to the output writer.
      Specified by:
      writeExportText in interface IFileExportBean
      Parameters:
      arg0 - the output writer
    • getExportCharacterEncoding

      public String getExportCharacterEncoding()
      Description copied from interface: IFileExportBeanEx
      Returns character encoding for this export file content (valid only when isExportBinary() == false)
      Specified by:
      getExportCharacterEncoding in interface IFileExportBeanEx
      Returns:
      java character encoding name
    • setExportCharacterEncoding

      public void setExportCharacterEncoding(String charactersEncoding)
      Sets character encoding for this export file content (valid only when isExportBinary() == false)
      Parameters:
      charactersEncoding - Java character encoding name