Class JmixFileDownloader

java.lang.Object
com.vaadin.server.AbstractClientConnector
com.vaadin.server.AbstractExtension
io.jmix.ui.widget.JmixFileDownloader
All Implemented Interfaces:
com.vaadin.event.MethodEventSource, com.vaadin.server.ClientConnector, com.vaadin.server.Extension, com.vaadin.shared.Connector, Serializable

public class JmixFileDownloader extends com.vaadin.server.AbstractExtension
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     

    Nested classes/interfaces inherited from class com.vaadin.server.AbstractClientConnector

    com.vaadin.server.AbstractClientConnector.IncorrectConcurrentAccessHandler

    Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector

    com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
     
    protected boolean
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    downloadFile(com.vaadin.server.Resource resource)
     
    void
    extend(com.vaadin.server.AbstractClientConnector target)
     
     
    boolean
    handleConnectorRequest(com.vaadin.server.VaadinRequest request, com.vaadin.server.VaadinResponse response, String path)
     
    boolean
    Checks whether the content type should be overridden.
    protected boolean
     
    void
     
    void
    setOverrideContentType(boolean overrideContentType)
    Sets whether the content type of served resources should be overridden to application/octet-stream to reduce the risk of a browser plugin choosing to display the resource instead of downloading it.
    void
    viewDocument(com.vaadin.server.Resource resource)
     

    Methods inherited from class com.vaadin.server.AbstractExtension

    getParent, getSupportedParentType, remove, setParent

    Methods inherited from class com.vaadin.server.AbstractClientConnector

    addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, attach, beforeClientResponse, createState, detach, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getIncorrectConcurrentAccessHandler, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getState, getState, getStateType, getUI, hashCode, hasListeners, isAttached, isConnectorEnabled, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setConnectorResource, setErrorHandler, setIncorrectConcurrentAccessHandler, setResource, updateDiffstate

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.server.ClientConnector

    addAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler

    Methods inherited from interface com.vaadin.shared.Connector

    getConnectorId
  • Field Details

  • Constructor Details

    • JmixFileDownloader

      public JmixFileDownloader()
  • Method Details

    • downloadFile

      public void downloadFile(com.vaadin.server.Resource resource)
    • viewDocument

      public void viewDocument(com.vaadin.server.Resource resource)
    • setOverrideContentType

      public void setOverrideContentType(boolean overrideContentType)
      Sets whether the content type of served resources should be overridden to application/octet-stream to reduce the risk of a browser plugin choosing to display the resource instead of downloading it. This is by default set to true.

      Please note that this only affects Connector resources (e.g. FileResource and ClassResource) but not other resource types (e.g. ExternalResource or ThemeResource).

      Parameters:
      overrideContentType - true to override the content type if possible; false to use the original content type.
    • isOverrideContentType

      public boolean isOverrideContentType()
      Checks whether the content type should be overridden.
      Returns:
      true if the content type will be overridden when possible; false if the original content type will be used.
      See Also:
    • extend

      public void extend(com.vaadin.server.AbstractClientConnector target)
      Overrides:
      extend in class com.vaadin.server.AbstractExtension
    • handleConnectorRequest

      public boolean handleConnectorRequest(com.vaadin.server.VaadinRequest request, com.vaadin.server.VaadinResponse response, String path) throws IOException
      Specified by:
      handleConnectorRequest in interface com.vaadin.server.ClientConnector
      Overrides:
      handleConnectorRequest in class com.vaadin.server.AbstractClientConnector
      Throws:
      IOException
    • isSafariOrIOS

      protected boolean isSafariOrIOS()
    • getFileNotFoundExceptionListener

      public JmixFileDownloader.FileNotFoundExceptionListener getFileNotFoundExceptionListener()
    • setFileNotFoundExceptionListener

      public void setFileNotFoundExceptionListener(JmixFileDownloader.FileNotFoundExceptionListener notFoundExceptionListener)