Package ninja
Class AssetsController
- java.lang.Object
-
- ninja.AssetsController
-
public class AssetsController extends Object
This controller serves public resources under /assets. It is capable of serving static files, webjars or files from a completely different directory on the server.
-
-
Field Summary
Fields Modifier and Type Field Description static StringASSETS_DIRstatic StringFILENAME_PATH_PARAM
-
Constructor Summary
Constructors Constructor Description AssetsController(AssetsControllerHelper assetsControllerHelper, HttpCacheToolkit httpCacheToolkit, MimeTypes mimeTypes, NinjaProperties ninjaProperties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResultserveStatic()Serves resources from the assets directory of your application.ResultserveWebJars()Serves resources from the assets directory of your application.
-
-
-
Field Detail
-
ASSETS_DIR
public static final String ASSETS_DIR
- See Also:
- Constant Field Values
-
FILENAME_PATH_PARAM
public static final String FILENAME_PATH_PARAM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AssetsController
@Inject public AssetsController(AssetsControllerHelper assetsControllerHelper, HttpCacheToolkit httpCacheToolkit, MimeTypes mimeTypes, NinjaProperties ninjaProperties)
-
-
Method Detail
-
serveStatic
public Result serveStatic()
Serves resources from the assets directory of your application. For instance: route: /robots.txt A request to /robots.txt will be served from /assets/robots.txt. You can also use a path like the following to serve files: route: /assets/{fileName: .*} matches /assets/app/app.css and will return /assets/app/app.css (from your jar).
-
serveWebJars
public Result serveWebJars()
Serves resources from the assets directory of your application. For instance: A request to /robots.txt will be served from /assets/robots.txt. Request to /public/css/app.css will be served from /assets/css/app.css.
-
-