Package org.javalite.activeweb
Class Configuration
java.lang.Object
org.javalite.activeweb.Configuration
- Author:
- Igor Polevoy
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static void
static String
static Class<? extends AppEndpoint>
getAppEndpointClass(String path)
static String
static CloseableList<io.github.classgraph.ClassInfo>
getControllerClassInfos(ClassLoader classLoader)
Returns a list of controllers that are reachable and not abstract.static String
static String
static String
protected static List<HttpSupportFilter>
static AbstractFreeMarkerConfig
static int
static String
static String
static String
static TemplateManager
static File
protected static void
static boolean
This method is used internally by ActiveWeb tests.static void
logHeaders(String... headerNames)
Provide names of headers to log to the log system with each request.static boolean
static boolean
rollback()
protected static void
setFilters(List<HttpSupportFilter> allFilters)
protected static void
setTesting(boolean testing)
static void
setUseDefaultLayoutForErrors(boolean useDefaultLayoutForErrors)
Set to true if you want ActiveWeb to wrap the errors, such as 404, and 500 in a default layout.protected static boolean
True to use default layout for error pages, false not to.
-
Constructor Details
-
Configuration
public Configuration()
-
-
Method Details
-
setUseDefaultLayoutForErrors
public static void setUseDefaultLayoutForErrors(boolean useDefaultLayoutForErrors)Set to true if you want ActiveWeb to wrap the errors, such as 404, and 500 in a default layout. False will ensure that these pages will render without default layout.System errors
The following system errors are affected by this setting:- CompilationException - when there are compilation errors in controller
- ClassLoadException - failure to load a controller class for any reason
- ActionNotFoundException - action method is not found in controller class
- ViewMissingException - corresponding view is missing
- ViewException - FreeMarker barfed on the view
Application level
This method does not affect application errors (exceptions thrown by your code). However, it is typical for an ActiveWeb project to define a top controller filter called CatchAllFilter and process application level exceptions in that filter:package app.controllers; import org.javalite.activeweb.controller_filters.HttpSupportFilter; import static org.javalite.common.Collections.map; public class CatchAllFilter extends HttpSupportFilter { public void onException(Exception e) { render("/system/error", map("message", e.getMessage())).layout("error_layout"); } }
This way you have a complete control over how your error messages are displayed.- Parameters:
useDefaultLayoutForErrors
- true to use default layout, false no not to use it.
-
useDefaultLayoutForErrors
protected static boolean useDefaultLayoutForErrors()True to use default layout for error pages, false not to.- Returns:
- true to use default layout for error pages, false not to.
-
logRequestParams
public static boolean logRequestParams() -
isTesting
public static boolean isTesting()This method is used internally by ActiveWeb tests. Do not use in your projects. If you need this feature, use: AppConfig#isInTestMode- Returns:
- true if running in tests.
-
setTesting
protected static void setTesting(boolean testing) -
getFreeMarkerConfig
-
getTemplateManager
-
get
-
getDefaultLayout
-
getBootstrapClassName
-
getControllerConfigClassName
-
getDbConfigClassName
-
getRouteConfigClassName
-
getTargetDir
-
getRootPackage
-
rollback
public static boolean rollback() -
activeReload
public static boolean activeReload() -
getMaxUploadSize
public static int getMaxUploadSize() -
getTmpDir
-
setFilters
-
getFilters
-
injectFilters
protected static void injectFilters() -
logHeaders
Provide names of headers to log to the log system with each request. This configuration is dynamic and can be changed during runtime.- Parameters:
headerNames
- list of headers to log. If the first argument is '*', all headers will be logged.
-
getLogHeaders
-
getControllerClassInfos
public static CloseableList<io.github.classgraph.ClassInfo> getControllerClassInfos(ClassLoader classLoader)Returns a list of controllers that are reachable and not abstract.- Parameters:
classLoader
- - a classloader to use when looking for controllers.- Returns:
- list of
ControllerInfo
.
-
addEndpointMapping
-
getAppEndpointClass
-