Package org.actioncontroller.content
Class ContentSource
- java.lang.Object
-
- org.actioncontroller.content.ContentSource
-
public class ContentSource extends Object
Used to serve files from the filesystem or jar-file. In Jetty, this is a replacement for DefaultServlet with the possibility of catch-everything pages, useful for SPA-applications. In addition ContentSource supports serving resource-files from src/main/resources for files loaded from the classpath and supports the webjar-format out of the box.Use
fromClasspath(String),fromURL(URL)orfromWebJar(String)to get started
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedContentSource(URL resourceBase)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ContentSourcefromClasspath(String resourceBase)static ContentSourcefromURL(URL baseResource)static ContentSourcefromWebJar(String webJarName)ContentgetContent(String relativeResource)ContentSourcewithFallbackPath(String fallbackPath)
-
-
-
Constructor Detail
-
ContentSource
protected ContentSource(URL resourceBase)
-
-
Method Detail
-
fromClasspath
public static ContentSource fromClasspath(String resourceBase)
-
fromURL
public static ContentSource fromURL(URL baseResource)
-
fromWebJar
public static ContentSource fromWebJar(String webJarName)
-
getContent
public Content getContent(String relativeResource) throws IOException
- Throws:
IOException
-
withFallbackPath
public ContentSource withFallbackPath(String fallbackPath)
-
-