public class StaticResourceBuilder<R extends IRequestContext<?>,W extends IWebsocketContext<?>> extends Object implements IStaticResourceBuilder<R>
| Constructor and Description |
|---|
StaticResourceBuilder(boolean isDir,
IStaticResourceFactory<R> staticResourceFactory,
IStaticResourceCorsConfigFactory staticResourceCorsConfigFactory) |
StaticResourceBuilder(IRouter<R,W> router,
boolean isDir,
IStaticResourceFactory<R> staticResourceFactory,
IStaticResourceCorsConfigFactory staticResourceCorsConfigFactory) |
| Modifier and Type | Method and Description |
|---|---|
IStaticResourceBuilder<R> |
classpath(String path)
The path to the resource, on the classpath.
|
IStaticResourceBuilder<R> |
cors()
Enables Cross-Origin Resource Sharing (Cors)
|
IStaticResourceBuilder<R> |
cors(Set<String> allowedOrigins)
Enables Cross-Origin Resource Sharing (Cors)
|
IStaticResourceBuilder<R> |
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead)
Enables Cross-Origin Resource Sharing (Cors)
|
IStaticResourceBuilder<R> |
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)
Enables Cross-Origin Resource Sharing (Cors)
|
IStaticResourceBuilder<R> |
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)
Enables Cross-Origin Resource Sharing (Cors)
|
IStaticResourceBuilder<R> |
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
int maxAgeInSeconds)
Enables Cross-Origin Resource Sharing (Cors)
|
IStaticResource<R> |
create()
Creates and returns the static resource without adding it to
the router.
|
IStaticResourceBuilder<R> |
fileSystem(String path)
The path to the resource, on the file system.
|
IStaticResourceCorsConfig |
getCorsConfig() |
protected Set<String> |
getCorsDefaultAllowedOrigins()
The origins allowed, by default.
|
protected Set<String> |
getCorsDefaultExtraHeadersAllowedToBeRead()
The extra headers allowed to be read, by default,
|
protected Set<String> |
getCorsDefaultExtraHeadersAllowedToBeSent()
The extra headers allowed to be sent, by default,
|
protected boolean |
getCorsDefaultIsCookiesAllowed()
Are cookies allowed by default?
|
protected int |
getCorsDefaultMaxAgeInSeconds()
If <= 0, the "Access-Control-Max-Age" header
won't be sent.
|
IHandler<R> |
getGenerator() |
String |
getPath() |
protected IRouter<R,W> |
getRouter() |
protected IStaticResourceCorsConfigFactory |
getStaticResourceCorsConfigFactory() |
protected IStaticResourceFactory<R> |
getStaticResourceFactory() |
String |
getUrl() |
boolean |
isClasspath() |
protected boolean |
isDir() |
void |
save()
Saves the static resource route to the router.
|
void |
save(IHandler<R> generator)
Saves the static resource route.
|
IStaticResourceBuilder<R> |
url(String url)
The URL pointing to the resource.
|
public StaticResourceBuilder(boolean isDir,
IStaticResourceFactory<R> staticResourceFactory,
IStaticResourceCorsConfigFactory staticResourceCorsConfigFactory)
public StaticResourceBuilder(IRouter<R,W> router, boolean isDir, IStaticResourceFactory<R> staticResourceFactory, IStaticResourceCorsConfigFactory staticResourceCorsConfigFactory)
protected boolean isDir()
protected IStaticResourceFactory<R> getStaticResourceFactory()
protected IStaticResourceCorsConfigFactory getStaticResourceCorsConfigFactory()
public String getUrl()
public String getPath()
public boolean isClasspath()
public IStaticResourceCorsConfig getCorsConfig()
public IStaticResourceBuilder<R> url(String url)
IStaticResourceBuilderurl in interface IStaticResourceBuilder<R extends IRequestContext<?>>public IStaticResourceBuilder<R> classpath(String path)
IStaticResourceBuilderclasspath in interface IStaticResourceBuilder<R extends IRequestContext<?>>public IStaticResourceBuilder<R> fileSystem(String path)
IStaticResourceBuilderfileSystem in interface IStaticResourceBuilder<R extends IRequestContext<?>>public IStaticResourceBuilder<R> cors()
IStaticResourceBuildercors in interface IStaticResourceBuilder<R extends IRequestContext<?>>ISpincastFilters#cors(R context)public IStaticResourceBuilder<R> cors(Set<String> allowedOrigins)
IStaticResourceBuildercors in interface IStaticResourceBuilder<R extends IRequestContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins)public IStaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead)
IStaticResourceBuildercors in interface IStaticResourceBuilder<R extends IRequestContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead)public IStaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent)
IStaticResourceBuildercors in interface IStaticResourceBuilder<R extends IRequestContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)public IStaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies)
IStaticResourceBuildercors in interface IStaticResourceBuilder<R extends IRequestContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)public IStaticResourceBuilder<R> cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies, int maxAgeInSeconds)
IStaticResourceBuildercors in interface IStaticResourceBuilder<R extends IRequestContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
int maxAgeInSeconds
)public void save()
IStaticResourceBuilderIRouter object, an exception will be
thrown.save in interface IStaticResourceBuilder<R extends IRequestContext<?>>public void save(IHandler<R> generator)
IStaticResourceBuilderIRouter object, an exception will be
thrown.save in interface IStaticResourceBuilder<R extends IRequestContext<?>>generator - If the resource is not found, the specified
generator will be used to generate it and
the result will be saved.public IStaticResource<R> create()
IStaticResourceBuildersave(...) instead to save the static resource
to the router at the end of the build process!create in interface IStaticResourceBuilder<R extends IRequestContext<?>>protected int getCorsDefaultMaxAgeInSeconds()
protected Set<String> getCorsDefaultAllowedOrigins()
protected Set<String> getCorsDefaultExtraHeadersAllowedToBeRead()
protected Set<String> getCorsDefaultExtraHeadersAllowedToBeSent()
protected boolean getCorsDefaultIsCookiesAllowed()
Copyright © 2016. All rights reserved.