Package io.jmix.ui.widget
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 ClassesModifier and TypeClassDescriptionstatic interfaceNested classes/interfaces inherited from class com.vaadin.server.AbstractClientConnector
com.vaadin.server.AbstractClientConnector.IncorrectConcurrentAccessHandlerNested 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddownloadFile(com.vaadin.server.Resource resource) voidextend(com.vaadin.server.AbstractClientConnector target) booleanhandleConnectorRequest(com.vaadin.server.VaadinRequest request, com.vaadin.server.VaadinResponse response, String path) booleanChecks whether the content type should be overridden.protected booleanvoidsetFileNotFoundExceptionListener(JmixFileDownloader.FileNotFoundExceptionListener notFoundExceptionListener) voidsetOverrideContentType(boolean overrideContentType) Sets whether the content type of served resources should be overridden toapplication/octet-streamto reduce the risk of a browser plugin choosing to display the resource instead of downloading it.voidviewDocument(com.vaadin.server.Resource resource) Methods inherited from class com.vaadin.server.AbstractExtension
getParent, getSupportedParentType, remove, setParentMethods 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, updateDiffstateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods 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, setErrorHandlerMethods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Field Details
-
DOWNLOAD_RESOURCE_PREFIX
- See Also:
-
VIEW_RESOURCE_PREFIX
- See Also:
-
overrideContentType
protected boolean overrideContentType -
fileNotFoundExceptionListener
-
-
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 toapplication/octet-streamto reduce the risk of a browser plugin choosing to display the resource instead of downloading it. This is by default set totrue.Please note that this only affects Connector resources (e.g.
FileResourceandClassResource) but not other resource types (e.g.ExternalResourceorThemeResource).- Parameters:
overrideContentType-trueto override the content type if possible;falseto use the original content type.
-
isOverrideContentType
public boolean isOverrideContentType()Checks whether the content type should be overridden.- Returns:
trueif the content type will be overridden when possible;falseif the original content type will be used.- See Also:
-
extend
public void extend(com.vaadin.server.AbstractClientConnector target) - Overrides:
extendin classcom.vaadin.server.AbstractExtension
-
handleConnectorRequest
public boolean handleConnectorRequest(com.vaadin.server.VaadinRequest request, com.vaadin.server.VaadinResponse response, String path) throws IOException - Specified by:
handleConnectorRequestin interfacecom.vaadin.server.ClientConnector- Overrides:
handleConnectorRequestin classcom.vaadin.server.AbstractClientConnector- Throws:
IOException
-
isSafariOrIOS
protected boolean isSafariOrIOS() -
getFileNotFoundExceptionListener
-
setFileNotFoundExceptionListener
public void setFileNotFoundExceptionListener(JmixFileDownloader.FileNotFoundExceptionListener notFoundExceptionListener)
-