Package org.javalite.activeweb
Class Configuration
java.lang.Object
org.javalite.activeweb.Configuration
- Author:
- Igor Polevoy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic voidstatic Stringstatic Class<? extends AppEndpoint>getAppEndpointClass(String path)static Stringstatic CloseableList<io.github.classgraph.ClassInfo>getControllerClassInfos(ClassLoader classLoader)Returns a list of controllers that are reachable and not abstract.static Stringstatic Stringstatic Stringprotected static List<HttpSupportFilter>static AbstractFreeMarkerConfigstatic intstatic Stringstatic Stringstatic Stringstatic TemplateManagerstatic Fileprotected static voidstatic booleanThis method is used internally by ActiveWeb tests.static voidlogHeaders(String... headerNames)Provide names of headers to log to the log system with each request.static booleanstatic booleanrollback()protected static voidsetFilters(List<HttpSupportFilter> allFilters)protected static voidsetTesting(boolean testing)static voidsetUseDefaultLayoutForErrors(boolean useDefaultLayoutForErrors)Set to true if you want ActiveWeb to wrap the errors, such as 404, and 500 in a default layout.protected static booleanTrue 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
-