Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Start by creating a FileDownload support on the servlet file - web.xml file with the following markup:

    Code Block
    languagexml
    titleweb.xml
      <servlet>
        <servlet-name>download</servlet-name>
        <servlet-class>morphis.foundations.core.appsupportlib.runtime.web.FileDownloadServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>download</servlet-name>
        <url-pattern>/download/*</url-pattern>
      </servlet-mapping>
    Info
    titleNote:

    It's possible to use a custom download handler (instead of the one present on the Foundations Framework), by creating a class that implements the HttpServlet Class and replace the class attribute value on the file above with the created class full name.

  2. On the function that will send the file for the client, make a call to this method, that should be placed somewhere on the form or common location within the application:

    Code Block
    languagec#
    titleDownloadFile method
    public void DownloadFile(File file)
    {
    	FileUtils.addDownloadFileCommand(file)
    }
    Info
    titleNote:

    It is important to note that the FileUtils Class has different overloads and methods to support file handling

Lets move now to the steps that have to be done on the client side:

  1. On the server side you don't need to do anything because the Frames Framework already has support for the download command

...