|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jsxp.framework.Application
public class Application
The Class Application. Default implementation of an application. It is recommend
to create a subclass for your webapps.
The application is automatically instantiated by the jsxp framework. You can access it with
getApplication()
. Do not create an instance yourself.
Field Summary | |
---|---|
protected static java.lang.String |
DIRECT_DELIVERY_ALLOWED_FILE_REGULAR_EXPRESSIONS
|
protected static java.lang.String |
DIRECT_DELIVERY_DENIED_FILE_REGULAR_EXPRESSIONS
|
protected static java.lang.String |
FILE_UPLOAD_ADAPTER
|
protected static java.lang.String |
PROJECT_STAGE_NAME
|
protected static java.lang.String |
SUPPORTED_LOCALES
|
protected static java.lang.String |
VIEW_CONTROL_BASE_PACKAGE
|
Constructor Summary | |
---|---|
protected |
Application()
Instantiates a new application. |
Method Summary | ||
---|---|---|
protected void |
contextInitialized(Context context)
Called by the jsxp framework if the Context was initialized. |
|
protected Context |
createContext()
Creates the context. |
|
protected ProjectStage |
createProjectStage(java.lang.String name)
Create a project stage for a given project stage name. |
|
protected UserContext |
createUserContext()
Creates the user context. |
|
java.lang.String |
delocalizeUriAndInitContextLocale(java.lang.String uri)
Should set the locale that should be used for this request to the context and return an uri that may be delocalized (e.g. |
|
static
|
getApplication()
Gets the application. |
|
java.util.Locale |
getDefaultApplicationLocale()
Gets the default application locale. |
|
java.lang.String |
getDefaultCharacterEncoding()
Gets default the character encoding. |
|
java.lang.String |
getDefaultContentType()
Gets the default content type of the rendered output. |
|
protected java.util.List<java.lang.String> |
getDirectDeliveryAllowedList()
Gets the direct delivery allowed list. |
|
protected java.util.List<java.lang.String> |
getDirectDeliveryDeniedList()
Gets the direct delivery denied list. |
|
java.lang.String |
getParameter(java.lang.String key,
java.lang.String defaultValue)
Gets the parameter. |
|
ProjectStage |
getProjectStage()
Gets the current project stage. |
|
java.io.InputStream |
getResourceInputStream(java.lang.String uri,
java.lang.Object objectForClassLoader)
Gets the resource input stream. |
|
long |
getResourceModifiedTimeStamp(java.lang.String uri,
java.lang.Object objectForClassLoader)
Gets the resource modified time stamp. |
|
int |
getSessionTimeout()
Override to specify another session timeout duration |
|
protected java.util.List<java.util.Locale> |
getSupportedApplicationLocales()
Gets the supported application locales. |
|
protected ViewController |
getTemplate()
Gets the application template. |
|
ViewAlias |
getViewAliasFor(java.lang.String sourcePath,
java.lang.String targetPath,
java.util.Map<java.lang.String,java.lang.Object[]> parameter)
Gets the ViewAlias alias for the current call. |
|
ViewController |
getViewController(java.lang.String uri)
Gets the view control for an uri. |
|
java.lang.String[] |
getViewControllerBasePackages()
These returns the packages where the framework looks for die ViewController classes. |
|
ViewController |
getViewForbiddenViewController()
Gets the view forbidden view control. |
|
ViewController |
getViewNotFoundViewController()
Gets the view not found view control. |
|
ViewParser |
getViewParser()
Gets the factory for the process of view design files. |
|
void |
handleExecutingException(java.lang.Exception e,
ViewController source)
Throws the given exception encapsulated in a runtime exception per default. |
|
void |
handleInitException(java.lang.Exception e,
ViewController source)
Throws the given exception encapsulated in a runtime exception per default. |
|
void |
handleInputProcessingException(java.lang.Exception e,
ViewController source)
Throws the given exception encapsulated in a runtime exception per default. |
|
void |
handlePreparingException(java.lang.Exception e,
ViewController source)
Throws the given exception encapsulated in a runtime exception per default. |
|
void |
handleRenderingException(java.lang.Exception e,
ViewController source)
Throws the given exception encapsulated in a runtime exception per default. |
|
void |
handleTemplatingException(java.lang.Exception e,
ViewController source)
Throws the given exception encapsulated in a runtime exception per default. |
|
void |
handleValidatingException(java.lang.Exception e,
ViewController source)
Throws the given exception encapsulated in a runtime exception per default. |
|
void |
initialize()
Initializer. |
|
java.util.Map<java.lang.String,java.lang.Object[]> |
initInputParameter()
Process input parameter. |
|
boolean |
isAllowedToViewPage(ViewController view,
java.lang.String uri)
Checks if is allowed to view page. |
|
protected boolean |
isDirectDeliveryAllowed(java.lang.String url)
Checks if direct delivery is allowed. |
|
void |
lifeCycleStartsForViewController(ViewController ViewController)
Called by the jsxp framework each time a view controller is added to the life cycle manager. |
|
protected java.lang.String |
localizeUri(java.lang.String uri)
Override to change translation behaviour. |
|
protected ViewController |
resolveViewController(java.lang.String uri,
boolean translateUri)
resolves a view control. |
|
protected void |
sessionRestored(java.util.Map<java.lang.String,java.lang.Object> sessionScope)
Called by the jsxp framework if a Session was restored. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String DIRECT_DELIVERY_ALLOWED_FILE_REGULAR_EXPRESSIONS
protected static final java.lang.String DIRECT_DELIVERY_DENIED_FILE_REGULAR_EXPRESSIONS
protected static final java.lang.String FILE_UPLOAD_ADAPTER
protected static final java.lang.String PROJECT_STAGE_NAME
protected static final java.lang.String SUPPORTED_LOCALES
protected static final java.lang.String VIEW_CONTROL_BASE_PACKAGE
Constructor Detail |
---|
protected Application()
Method Detail |
---|
public static <T extends Application> T getApplication()
protected void contextInitialized(Context context)
context
- the contextprotected Context createContext()
protected ProjectStage createProjectStage(java.lang.String name)
name
- the name of the project stage.
protected UserContext createUserContext()
public java.lang.String delocalizeUriAndInitContextLocale(java.lang.String uri)
uri
- the incoming uri from the client
public java.util.Locale getDefaultApplicationLocale()
public java.lang.String getDefaultCharacterEncoding()
ViewController.getCharacterEncoding()
to
set it for one view only. This will give your view a special character
encoding. Default is UTF-8.
public java.lang.String getDefaultContentType()
protected java.util.List<java.lang.String> getDirectDeliveryAllowedList()
isDirectDeliveryAllowed(String)
.
isDirectDeliveryAllowed(String)
protected java.util.List<java.lang.String> getDirectDeliveryDeniedList()
isDirectDeliveryAllowed(String)
.
The deny list is a list of regular expression strings that can be matched to urls.
isDirectDeliveryAllowed(String)
public java.lang.String getParameter(java.lang.String key, java.lang.String defaultValue)
key
- the keydefaultValue
- the default value
public ProjectStage getProjectStage()
getParameter(String, String)
with
key PROJECT_STAGE_NAME
and the "development" string as defaultValue
to get the project stage name and will than use the method createProjectStage(String)
to
get the project stage when initialized.
public java.io.InputStream getResourceInputStream(java.lang.String uri, java.lang.Object objectForClassLoader)
ResourceResolver
getResourceInputStream
in interface ResourceResolver
uri
- the uriobjectForClassLoader
- the object for class loader
public long getResourceModifiedTimeStamp(java.lang.String uri, java.lang.Object objectForClassLoader)
ResourceResolver
getResourceModifiedTimeStamp
in interface ResourceResolver
uri
- the uriobjectForClassLoader
- the object for class loader
public int getSessionTimeout()
protected java.util.List<java.util.Locale> getSupportedApplicationLocales()
protected ViewController getTemplate()
ViewController
.
A view controller can have it own template. Templates can be used hierarchical.
ViewController
public ViewAlias getViewAliasFor(java.lang.String sourcePath, java.lang.String targetPath, java.util.Map<java.lang.String,java.lang.Object[]> parameter)
ViewAlias
alias for the current call.
sourcePath
- the source path (origin/referer of the request)targetPath
- the target path (requested target)parameter
- the parameter (request parameter)
public ViewController getViewController(java.lang.String uri)
getViewController(String)
.
As default if no view is matching the uri
it tries to append first "index.xhtml" than "index.html" to the uri to find
a view control for this new uri.
resolveViewController(String, boolean)
internally.
uri
- the uri
public java.lang.String[] getViewControllerBasePackages()
ViewController
classes.
Uses getParameter(String, String)
with
key VIEW_CONTROL_BASE_PACKAGE
and the empty string as defaultValue
to load the view control base packages (as a comma separated string) when initialized.
You can override this method to define more detailed how the
framework should look for
your ViewController
classes.
public ViewController getViewForbiddenViewController()
public ViewController getViewNotFoundViewController()
public ViewParser getViewParser()
public void handleExecutingException(java.lang.Exception e, ViewController source)
handleExecutingException
in interface ViewControllerLifeCycleExceptionHandler
e
- the esource
- the sourceViewControllerLifeCycleExceptionHandler.handleExecutingException(java.lang.Exception, org.jsxp.framework.ViewController)
public void handleInitException(java.lang.Exception e, ViewController source)
handleInitException
in interface ViewControllerLifeCycleExceptionHandler
e
- the esource
- the sourceViewControllerLifeCycleExceptionHandler.handleInitException(java.lang.Exception, org.jsxp.framework.ViewController)
public void handleInputProcessingException(java.lang.Exception e, ViewController source)
handleInputProcessingException
in interface ViewControllerLifeCycleExceptionHandler
e
- the esource
- the sourceViewControllerLifeCycleExceptionHandler.handleInputProcessingException(java.lang.Exception, org.jsxp.framework.ViewController)
public void handlePreparingException(java.lang.Exception e, ViewController source)
handlePreparingException
in interface ViewControllerLifeCycleExceptionHandler
e
- the esource
- the sourceViewControllerLifeCycleExceptionHandler.handlePreparingException(java.lang.Exception, org.jsxp.framework.ViewController)
public void handleRenderingException(java.lang.Exception e, ViewController source)
handleRenderingException
in interface ViewControllerLifeCycleExceptionHandler
e
- the esource
- the sourceViewControllerLifeCycleExceptionHandler.handleRenderingException(java.lang.Exception, org.jsxp.framework.ViewController)
public void handleTemplatingException(java.lang.Exception e, ViewController source)
handleTemplatingException
in interface ViewControllerLifeCycleExceptionHandler
e
- the esource
- the sourceViewControllerLifeCycleExceptionHandler.handleTemplatingException(java.lang.Exception, org.jsxp.framework.ViewController)
public void handleValidatingException(java.lang.Exception e, ViewController source)
handleValidatingException
in interface ViewControllerLifeCycleExceptionHandler
e
- the esource
- the sourceViewControllerLifeCycleExceptionHandler.handleValidatingException(java.lang.Exception, org.jsxp.framework.ViewController)
public void initialize()
public java.util.Map<java.lang.String,java.lang.Object[]> initInputParameter()
public boolean isAllowedToViewPage(ViewController view, java.lang.String uri)
UserContext.isAllowedToViewPage(ViewController, String)
view
- the view (can be null if only a uri is checked)uri
- the uri
protected final boolean isDirectDeliveryAllowed(java.lang.String url)
getDirectDeliveryAllowedList()
and getDirectDeliveryDeniedList()
to match with the url.
The denied rules are stronger than the allowed rules.
url
- the url
public void lifeCycleStartsForViewController(ViewController ViewController)
ViewController
- the view controlprotected java.lang.String localizeUri(java.lang.String uri)
delocalizeUriAndInitContextLocale(String)
method
to implement how uri that are requested from the client should result in uri used on the server.
uri
- the uri that is used after using delocalizeUriAndInitContextLocale(String)
before
protected ViewController resolveViewController(java.lang.String uri, boolean translateUri)
uri
- translateUri
- will use the localizeUri(String)
method to localize the uri if true
getViewForbiddenViewController()
if the found view controller is forbiddenprotected void sessionRestored(java.util.Map<java.lang.String,java.lang.Object> sessionScope)
sessionScope
- the session scope
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |