public class CubaFileDownloader
extends com.vaadin.server.AbstractExtension
Modifier and Type | Class and Description |
---|---|
static interface |
CubaFileDownloader.FileNotFoundExceptionListener |
com.vaadin.server.AbstractClientConnector.IncorrectConcurrentAccessHandler
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
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DOWNLOAD_RESOURCE_PREFIX |
protected CubaFileDownloader.FileNotFoundExceptionListener |
fileNotFoundExceptionListener |
protected boolean |
overrideContentType |
static java.lang.String |
VIEW_RESOURCE_PREFIX |
Constructor and Description |
---|
CubaFileDownloader() |
Modifier and Type | Method and Description |
---|---|
void |
downloadFile(com.vaadin.server.Resource resource) |
void |
extend(com.vaadin.server.AbstractClientConnector target) |
CubaFileDownloader.FileNotFoundExceptionListener |
getFileNotFoundExceptionListener() |
boolean |
handleConnectorRequest(com.vaadin.server.VaadinRequest request,
com.vaadin.server.VaadinResponse response,
java.lang.String path) |
boolean |
isOverrideContentType()
Checks whether the content type should be overridden.
|
protected boolean |
isSafariOrIOS() |
void |
setFileNotFoundExceptionListener(CubaFileDownloader.FileNotFoundExceptionListener notFoundExceptionListener) |
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) |
getParent, getSupportedParentType, remove, setParent
addAttachListener, addDetachListener, addExtension, 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, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setConnectorResource, setErrorHandler, setIncorrectConcurrentAccessHandler, setResource, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
public static final java.lang.String DOWNLOAD_RESOURCE_PREFIX
public static final java.lang.String VIEW_RESOURCE_PREFIX
protected boolean overrideContentType
protected CubaFileDownloader.FileNotFoundExceptionListener fileNotFoundExceptionListener
public void downloadFile(com.vaadin.server.Resource resource)
public void viewDocument(com.vaadin.server.Resource resource)
public void setOverrideContentType(boolean overrideContentType)
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
).
overrideContentType
- true
to override the content type if possible;
false
to use the original content type.public boolean isOverrideContentType()
true
if the content type will be overridden when
possible; false
if the original content type will be
used.setOverrideContentType(boolean)
public void extend(com.vaadin.server.AbstractClientConnector target)
extend
in class com.vaadin.server.AbstractExtension
public boolean handleConnectorRequest(com.vaadin.server.VaadinRequest request, com.vaadin.server.VaadinResponse response, java.lang.String path) throws java.io.IOException
handleConnectorRequest
in interface com.vaadin.server.ClientConnector
handleConnectorRequest
in class com.vaadin.server.AbstractClientConnector
java.io.IOException
protected boolean isSafariOrIOS()
public CubaFileDownloader.FileNotFoundExceptionListener getFileNotFoundExceptionListener()
public void setFileNotFoundExceptionListener(CubaFileDownloader.FileNotFoundExceptionListener notFoundExceptionListener)