public interface StaticResourceBuilder<R extends RequestContext<?>>
| Modifier and Type | Method and Description |
|---|---|
StaticResourceBuilder<R> |
cache(int seconds)
Adds public cache headers.
|
StaticResourceBuilder<R> |
cache(int seconds,
boolean isPrivate)
Adds cache headers.
|
StaticResourceBuilder<R> |
cache(int seconds,
boolean isPrivate,
Integer secondsCdn)
Adds cache headers.
|
StaticResourceBuilder<R> |
classpath(String path)
The path to the resource, on the classpath.
|
StaticResourceBuilder<R> |
cors()
Enables Cross-Origin Resource Sharing (Cors)
|
StaticResourceBuilder<R> |
cors(Set<String> allowedOrigins)
Enables Cross-Origin Resource Sharing (Cors)
|
StaticResourceBuilder<R> |
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead)
Enables Cross-Origin Resource Sharing (Cors)
|
StaticResourceBuilder<R> |
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)
Enables Cross-Origin Resource Sharing (Cors)
|
StaticResourceBuilder<R> |
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)
Enables Cross-Origin Resource Sharing (Cors)
|
StaticResourceBuilder<R> |
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
int maxAgeInSeconds)
Enables Cross-Origin Resource Sharing (Cors)
|
StaticResource<R> |
create()
Creates and returns the static resource without adding it to
the router.
|
StaticResourceBuilder<R> |
pathAbsolute(String absolutePath)
The absolute path to the resource, on the file system.
|
StaticResourceBuilder<R> |
pathRelative(String relativePath)
The path to the resource, on the file system, relative to the
temp Spincast directory, as returned by
SpincastConfig::getSpincastTempDir() |
void |
save()
Saves the static resource route to the router.
|
void |
save(Handler<R> generator)
Saves the static resource route.
|
void |
save(Handler<R> generator,
boolean ignoreQueryString)
Saves the static resource route.
|
StaticResourceBuilder<R> |
url(String url)
The URL pointing to the resource.
|
StaticResourceBuilder<R> url(String url)
StaticResourceBuilder<R> classpath(String path)
StaticResourceBuilder<R> pathAbsolute(String absolutePath)
absolutePath - the absolute path to the resource. If this is a file
and not a directory, remember that it will be served as a static resource,
so its extension is important for the
correct Content-Type to be sent!StaticResourceBuilder<R> pathRelative(String relativePath)
SpincastConfig::getSpincastTempDir()relativePath - the relative path to the resource. If this is a file
and not a directory, remember that it will be served as a static resource,
so its extension is important for the
correct Content-Type to be sent!StaticResourceBuilder<R> cors()
SpincastFilters#cors(R context)StaticResourceBuilder<R> cors(Set<String> allowedOrigins)
SpincastFilters#cors(R context,
Set<String> allowedOrigins)StaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead)
SpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead)StaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent)
SpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)StaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies)
SpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)StaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies, int maxAgeInSeconds)
SpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
int maxAgeInSeconds
)StaticResourceBuilder<R> cache(int seconds)
seconds - The number of seconds the resource associated with
this route should be cached.StaticResourceBuilder<R> cache(int seconds, boolean isPrivate)
seconds - The number of seconds the resource associated with
this route should be cached.isPrivate - should the cache be private?
(help)StaticResourceBuilder<R> cache(int seconds, boolean isPrivate, Integer secondsCdn)
seconds - The number of seconds the resource associated with
this route should be cached.isPrivate - should the cache be private?
(help)secondsCdn - The number of seconds the resource associated with
this route should be cached by a CDN/proxy. If null, it
won't be used.void save()
Router object, an exception will be
thrown.void save(Handler<R> generator)
If the creation of the resource was not started using
an Router object, an exception will be
thrown.
generator - If the resource is not found, the specified
generator will be used to generate it and
the result will be saved.void save(Handler<R> generator, boolean ignoreQueryString)
If the creation of the resource was not started using
an Router object, an exception will be
thrown.
generator - If the resource is not found, the specified
generator will be used to generate it and
the result will be saved.ignoreQueryString - If true, only one
instance of the resource will be generated and cached. If
false (the default), the resource will always be
generated if there is a queryString.StaticResource<R> create()
save(...) instead to save the static resource
to the router at the end of the build process!Copyright © 2018. All rights reserved.