Class AbstractStaticAssetsController
java.lang.Object
dev.voidframework.web.http.controller.AbstractStaticAssetsController
Abstraction to facilitate the use of static and webjar assets.
- Since:
- 1.0.0
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractStaticAssetsController(com.typesafe.config.Config configuration) Build a new instance; -
Method Summary
Modifier and TypeMethodDescriptionstaticAsset(Context context) Retrieves a static asset.staticAsset(String fileName) Retrieves a static asset.webjarAsset(String fileName) Retrieves a webjar asset.
-
Constructor Details
-
AbstractStaticAssetsController
@Inject protected AbstractStaticAssetsController(com.typesafe.config.Config configuration) Build a new instance;- Parameters:
configuration- The application configuration- Since:
- 1.0.0
-
-
Method Details
-
webjarAsset
@NoCSRF @RequestRoute(method=GET, route="/webjars/(?<fileName>.*)", name="static_webjar") public Result webjarAsset(@RequestPath("fileName") String fileName) Retrieves a webjar asset.- Parameters:
fileName- Requested webjar asset file name- Returns:
- A result containing the requested webjar asset
- Throws:
HttpException.NotFound- If requested asset does not exist- Since:
- 1.0.0
-
staticAsset
@NoCSRF @RequestRoute(method=GET, route="/(favicon.ico|robots.txt)") public Result staticAsset(Context context) Retrieves a static asset.- Parameters:
context- The current context- Returns:
- A result containing the requested static asset
- Throws:
HttpException.NotFound- If requested asset does not exist- Since:
- 1.0.0
-
staticAsset
@NoCSRF @RequestRoute(method=GET, route="/static/(?<fileName>.*)", name="static_file") public Result staticAsset(@RequestPath("fileName") String fileName) Retrieves a static asset.- Parameters:
fileName- Requested static asset file name- Returns:
- A result containing the requested static asset
- Throws:
HttpException.NotFound- If requested asset does not exist- Since:
- 1.0.0
-