public class AssetsBundle extends Object implements ConfiguredBundle<Configuration>
Constructor and Description |
---|
AssetsBundle()
Creates a new AssetsBundle which serves up static assets from
src/main/resources/assets/* as /assets/* . |
AssetsBundle(String path)
Creates a new AssetsBundle which will configure the application to serve the static files
located in
src/main/resources/${path} as /${path} . |
AssetsBundle(String resourcePath,
String uriPath)
Creates a new AssetsBundle which will configure the application to serve the static files
located in
src/main/resources/${resourcePath} as /${uriPath} . |
AssetsBundle(String resourcePath,
String uriPath,
String indexFile)
Creates a new AssetsBundle which will configure the application to serve the static files
located in
src/main/resources/${resourcePath} as /${uriPath} . |
AssetsBundle(String resourcePath,
String uriPath,
String indexFile,
String assetsName)
Creates a new AssetsBundle which will configure the application to serve the static files
located in
src/main/resources/${resourcePath} as /${uriPath} . |
Modifier and Type | Method and Description |
---|---|
protected AssetServlet |
createServlet() |
String |
getIndexFile() |
String |
getResourcePath() |
String |
getUriPath() |
void |
run(Configuration configuration,
Environment environment)
Initializes the environment.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialize
public AssetsBundle()
src/main/resources/assets/*
as /assets/*
.AssetsBundle(String, String, String)
public AssetsBundle(String path)
src/main/resources/${path}
as /${path}
. For example, given a
path
of "/assets"
, src/main/resources/assets/example.js
would be
served up from /assets/example.js
.path
- the classpath and URI root of the static asset filesAssetsBundle(String, String, String)
public AssetsBundle(String resourcePath, String uriPath)
src/main/resources/${resourcePath}
as /${uriPath}
. For example, given a
resourcePath
of "/assets"
and a uriPath of "/js"
,
src/main/resources/assets/example.js
would be served up from /js/example.js
.resourcePath
- the resource path (in the classpath) of the static asset filesuriPath
- the uri path for the static asset filesAssetsBundle(String, String, String)
public AssetsBundle(String resourcePath, String uriPath, String indexFile)
src/main/resources/${resourcePath}
as /${uriPath}
. If no file name is
in ${uriPath}, ${indexFile} is appended before serving. For example, given a
resourcePath
of "/assets"
and a uriPath of "/js"
,
src/main/resources/assets/example.js
would be served up from /js/example.js
.resourcePath
- the resource path (in the classpath) of the static asset filesuriPath
- the uri path for the static asset filesindexFile
- the name of the index file to usepublic AssetsBundle(String resourcePath, String uriPath, String indexFile, String assetsName)
src/main/resources/${resourcePath}
as /${uriPath}
. If no file name is
in ${uriPath}, ${indexFile} is appended before serving. For example, given a
resourcePath
of "/assets"
and a uriPath of "/js"
,
src/main/resources/assets/example.js
would be served up from /js/example.js
.resourcePath
- the resource path (in the classpath) of the static asset filesuriPath
- the uri path for the static asset filesindexFile
- the name of the index file to useassetsName
- the name of servlet mapping used for this assets bundlepublic void run(Configuration configuration, Environment environment)
ConfiguredBundle
run
in interface ConfiguredBundle<Configuration>
configuration
- the configuration objectenvironment
- the application's Environment
public String getResourcePath()
public String getUriPath()
public String getIndexFile()
protected AssetServlet createServlet()
Copyright © 2020. All rights reserved.