public class StaticRoute extends Route
// First route (REST services)
RestRoute restServices = new RestRoute();
restServices.addAlias("/rest1", "service.action1");
restServices.addAlias("GET", "/rest2/:a/:b", "service.action2");
restServices.use(new CorsHeaders());
apiGateway.addRoute(restServices);
// Last route (HTML pages, CSS and images)
StaticRoute webContent = new StaticRoute("/htdocs");
webContent.setReloadable(true);
apiGateway.addRoute(webContent);
| Modifier and Type | Field and Description |
|---|---|
protected Favicon |
favicon
Second middleware is the "favicon" handler.
|
protected NotFound |
notFound
Last middleware produces "Error 404" responses
|
protected Redirector |
redirector
First middleware redirects "/" to "/index.html"
|
protected ServeStatic |
serveStatic
Third middleware is static file handler.
|
afterCall, aliases, beforeCall, broker, logger, mappingPolicy, opts, path, routeMiddlewares, templateEngine, whiteList| Constructor and Description |
|---|
StaticRoute() |
StaticRoute(java.lang.String wwwRootDirectory) |
| Modifier and Type | Method and Description |
|---|---|
Favicon |
getFavicon() |
java.lang.String |
getFaviconPath() |
java.lang.String |
getIndexPage() |
NotFound |
getNotFound() |
java.lang.String |
getNotFoundTemplatePath() |
Redirector |
getRedirector() |
ServeStatic |
getServeStatic() |
java.lang.String |
getWebPageDirectory() |
boolean |
isEnableReloading() |
void |
setEnableReloading(boolean enableReloading) |
void |
setFaviconPath(java.lang.String iconPath) |
void |
setIndexPage(java.lang.String location) |
void |
setNotFoundTemplatePath(java.lang.String htmlTemplatePath) |
void |
setWebPageDirectory(java.lang.String wwwRootDirectory) |
addAlias, addAlias, addAlias, addToWhiteList, findMapping, getAfterCall, getAliases, getBeforeCall, getBroker, getMappingPolicy, getMiddlewares, getOpts, getPath, getTemplateEngine, getWhiteList, setAfterCall, setAliases, setBeforeCall, setMappingPolicy, setOpts, setPath, setTemplateEngine, setWhiteList, started, stopped, toTree, use, useprotected Redirector redirector
protected Favicon favicon
protected ServeStatic serveStatic
protected NotFound notFound
public StaticRoute()
public StaticRoute(java.lang.String wwwRootDirectory)
public java.lang.String getIndexPage()
public void setIndexPage(java.lang.String location)
public java.lang.String getFaviconPath()
public void setFaviconPath(java.lang.String iconPath)
public java.lang.String getWebPageDirectory()
public void setWebPageDirectory(java.lang.String wwwRootDirectory)
public boolean isEnableReloading()
public void setEnableReloading(boolean enableReloading)
public java.lang.String getNotFoundTemplatePath()
public void setNotFoundTemplatePath(java.lang.String htmlTemplatePath)
public Redirector getRedirector()
public Favicon getFavicon()
public ServeStatic getServeStatic()
public NotFound getNotFound()