Class ExternalResource
- java.lang.Object
-
- com.vaadin.server.ExternalResource
-
- All Implemented Interfaces:
Resource,Serializable
public class ExternalResource extends Object implements Resource
ExternalResourceimplements source for resources fetched from location specified by URL:s. The resources are fetched directly by the client terminal and are not fetched through the terminal adapter.- Since:
- 3.0
- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ExternalResource(String sourceURL)Creates a new resource instance for processing the resource directly from the given URL.ExternalResource(String sourceURL, boolean allowUnsafe)Creates a new resource instance for processing the resource directly from the given URL.ExternalResource(String sourceURL, String mimeType)Creates a new resource instance for processing the resource directly from the given URL.ExternalResource(String sourceURL, String mimeType, boolean allowUnsafe)Creates a new resource instance for processing the resource directly from the given URL.ExternalResource(URL sourceURL)Creates a new resource instance for processing the resource directly from the given URL.ExternalResource(URL sourceURL, boolean allowUnsafe)Creates a new resource instance for processing the resource directly from the given URL.ExternalResource(URL sourceURL, String mimeType)Creates a new resource instance for processing the resource directly from the given URL.ExternalResource(URL sourceURL, String mimeType, boolean allowUnsafe)Creates a new resource instance for processing the resource directly from the given URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetMIMEType()Gets the MIME type of the resource.StringgetURL()Gets the URL of the external resource.voidsetMIMEType(String mimeType)Sets the MIME type of the resource.
-
-
-
Constructor Detail
-
ExternalResource
public ExternalResource(URL sourceURL)
Creates a new resource instance for processing the resource directly from the given URL.The given source URL will be validated against the "safeUrlSchemes" configuration.
- Parameters:
sourceURL- the source URL- Throws:
IllegalArgumentException- ifsourceURLuses a scheme that is not considered safe
-
ExternalResource
public ExternalResource(URL sourceURL, String mimeType)
Creates a new resource instance for processing the resource directly from the given URL.The given source URL will be validated against the "safeUrlSchemes" configuration.
- Parameters:
sourceURL- the source URLmimeType- the MIME Type- Throws:
IllegalArgumentException- ifsourceURLuses a scheme that is not considered safe
-
ExternalResource
public ExternalResource(String sourceURL)
Creates a new resource instance for processing the resource directly from the given URL.The given source URL will be validated against the "safeUrlSchemes" configuration.
- Parameters:
sourceURL- the source URL- Throws:
IllegalArgumentException- ifsourceURLuses a scheme that is not considered safe
-
ExternalResource
public ExternalResource(String sourceURL, String mimeType)
Creates a new resource instance for processing the resource directly from the given URL.The given source URL will be validated against the "safeUrlSchemes" configuration.
- Parameters:
sourceURL- the source URL.mimeType- the MIME Type- Throws:
IllegalArgumentException- ifsourceURLuses a scheme that is not considered safe
-
ExternalResource
public ExternalResource(URL sourceURL, boolean allowUnsafe)
Creates a new resource instance for processing the resource directly from the given URL.If the given
allowUnsafeparameter isfalse, the given source URL will be validated against the "safeUrlSchemes" configuration. Otherwise all URLs will be considered safe and the given URL won't be validated.- Parameters:
sourceURL- the source URLallowUnsafe-truefor skipping the URL validation,falseotherwise- Throws:
IllegalArgumentException- ifsourceURLuses a scheme that is not considered safe- Since:
-
ExternalResource
public ExternalResource(URL sourceURL, String mimeType, boolean allowUnsafe)
Creates a new resource instance for processing the resource directly from the given URL.If the given
allowUnsafeparameter isfalse, the given source URL will be validated against the "safeUrlSchemes" configuration. Otherwise all URLs will be considered safe and and the given URL won't be validated.- Parameters:
sourceURL- the source URLmimeType- the MIME TypeallowUnsafe-truefor skipping the URL validation,falseotherwise- Throws:
IllegalArgumentException- ifsourceURLuses a scheme that is not considered safe- Since:
-
ExternalResource
public ExternalResource(String sourceURL, boolean allowUnsafe)
Creates a new resource instance for processing the resource directly from the given URL.If the given
allowUnsafeparameter isfalse, the given source URL will be validated against the "safeUrlSchemes" configuration. Otherwise all URLs will be considered safe and and the given URL won't be validated.- Parameters:
sourceURL- the source URLallowUnsafe-truefor skipping the URL validation,falseotherwise- Throws:
IllegalArgumentException- ifsourceURLuses a scheme that is not considered safe- Since:
-
ExternalResource
public ExternalResource(String sourceURL, String mimeType, boolean allowUnsafe)
Creates a new resource instance for processing the resource directly from the given URL.If the given
allowUnsafeparameter isfalse, the given source URL will be validated against the "safeUrlSchemes" configuration. Otherwise all URLs will be considered safe and and the given URL won't be validated.- Parameters:
sourceURL- the source URLmimeType- the MIME TypeallowUnsafe-truefor skipping the URL validation,falseotherwise- Throws:
IllegalArgumentException- ifsourceURLuses a scheme that is not considered safe- Since:
-
-
Method Detail
-
getURL
public String getURL()
Gets the URL of the external resource.- Returns:
- the URL of the external resource.
-
getMIMEType
public String getMIMEType()
Gets the MIME type of the resource.- Specified by:
getMIMETypein interfaceResource- Returns:
- the MIME type of the resource.
- See Also:
Resource.getMIMEType()
-
setMIMEType
public void setMIMEType(String mimeType)
Sets the MIME type of the resource.
-
-