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
Modifier and TypeClassDescriptionstatic 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
setFileNotFoundExceptionListener
(JmixFileDownloader.FileNotFoundExceptionListener notFoundExceptionListener) void
setOverrideContentType
(boolean overrideContentType) Sets whether the content type of served resources should be overridden toapplication/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
-
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-stream
to 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.
FileResource
andClassResource
) but not other resource types (e.g.ExternalResource
orThemeResource
).- 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 classcom.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 interfacecom.vaadin.server.ClientConnector
- Overrides:
handleConnectorRequest
in classcom.vaadin.server.AbstractClientConnector
- Throws:
IOException
-
isSafariOrIOS
protected boolean isSafariOrIOS() -
getFileNotFoundExceptionListener
-
setFileNotFoundExceptionListener
public void setFileNotFoundExceptionListener(JmixFileDownloader.FileNotFoundExceptionListener notFoundExceptionListener)
-