public abstract class WebApplication extends Object
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_BEAN_NAME |
protected TextResolver[] |
textResolvers |
Modifier | Constructor and Description |
---|---|
protected |
WebApplication() |
Modifier and Type | Method and Description |
---|---|
void |
addJavascriptCall(javax.faces.context.FacesContext fc,
String function)
adds a Javascript call to the request
|
void |
destroy() |
static javax.faces.component.UIComponent |
findChildComponent(javax.faces.component.UIComponent parent,
String componentId)
finds a child component with the given id that is located below the given parent component
|
javax.faces.component.UIComponent |
findComponent(javax.faces.context.FacesContext fc,
String componentId,
javax.faces.component.UIComponent nearComponent)
finds the component with the given id that is located in the same NamingContainer as a given component
|
protected abstract DataSource |
getAppDataSource(DBDatabase db) |
protected Connection |
getConnection(DBDatabase db)
Obtains a JDBC-Connection from the connection pool
|
Connection |
getConnectionForRequest(javax.faces.context.FacesContext fc,
DBDatabase db,
boolean create)
Obtains a JDBC-Connection for the current request
|
Locale |
getContextLocale(javax.faces.context.FacesContext ctx)
returns the active locale for a given FacesContext
|
String |
getDefaultControlType(DataType dataType)
returns the default input control type for a given data Type
|
FacesImplementation |
getFacesImplementation()
return the interface for Implementation specific features
that are specific for Mojarra or MyFaces
|
static <T extends WebApplication> |
getInstance()
Returns the one and only instance of the WebApplication (Singleton)
|
String |
getPartialSubmitComponentId(javax.faces.context.FacesContext fc)
returns the componentId for which a partial submit has been performed.
|
DBRollbackManager |
getRollbackManagerForRequest(javax.faces.context.FacesContext fc,
boolean create)
Obtains a DBRollbackManager for the current request
|
TextResolver |
getTextResolver(javax.faces.context.FacesContext ctx) |
TextResolver |
getTextResolver(Locale locale) |
String |
getWebRoot()
returns the web context path as returned from ServletContext.getContextPath()
|
boolean |
hasError(javax.faces.context.FacesContext fc)
checks if the current context contains an error
|
void |
init(FacesImplementation facesImpl,
javax.faces.context.FacesContext startupContext)
Init the Application
|
protected abstract void |
init(javax.servlet.ServletContext servletContext) |
protected void |
initTextResolvers(javax.faces.application.Application app) |
boolean |
isPartialSubmit(javax.faces.context.FacesContext fc)
returns true if a form input element has been partially submitted
|
void |
onChangeView(javax.faces.context.FacesContext fc,
String viewId)
handle view change
|
void |
onRequestComplete(javax.faces.context.FacesContext ctx)
handle request cleanup
|
void |
onViewNotFound(javax.faces.context.FacesContext fc,
javax.servlet.http.HttpServletRequest req)
handle view not found
|
void |
releaseAllConnections(javax.faces.context.FacesContext fc)
Releases all connections attached to the current request
If an error is detected in the faces message list, a rollback will automatically be performed insteamd of a commmit
|
void |
releaseAllConnections(javax.faces.context.FacesContext fc,
boolean commit)
Releases all connections attached to the current request
|
protected void |
releaseConnection(Connection conn,
boolean commit,
DBRollbackManager dbrm)
Releases a JDBC-Connection from the connection pool
|
void |
releaseConnection(javax.faces.context.FacesContext fc,
DBDatabase db)
Releases the connection associated with a database from the request
If an error is detected in the faces message list, a rollback will automatically be performed insteamd of a commmit
|
void |
releaseConnection(javax.faces.context.FacesContext fc,
DBDatabase db,
boolean commit)
Releases the connection associated with a database from the request
|
public static String APPLICATION_BEAN_NAME
protected TextResolver[] textResolvers
public static <T extends WebApplication> T getInstance()
T
- the application typeprotected abstract void init(javax.servlet.ServletContext servletContext)
protected abstract DataSource getAppDataSource(DBDatabase db)
public final void init(FacesImplementation facesImpl, javax.faces.context.FacesContext startupContext)
facesImpl
- the faces implementationstartupContext
- the startup contextpublic void destroy()
public void onRequestComplete(javax.faces.context.FacesContext ctx)
ctx
- the faces contextpublic void onViewNotFound(javax.faces.context.FacesContext fc, javax.servlet.http.HttpServletRequest req)
fc
- the faces contextreq
- the requestpublic void onChangeView(javax.faces.context.FacesContext fc, String viewId)
fc
- the faces contextviewId
- the view idpublic void addJavascriptCall(javax.faces.context.FacesContext fc, String function)
fc
- the faces contextfunction
- the javascript commandpublic FacesImplementation getFacesImplementation()
public String getWebRoot()
public Locale getContextLocale(javax.faces.context.FacesContext ctx)
ctx
- the faces contextpublic TextResolver getTextResolver(Locale locale)
public TextResolver getTextResolver(javax.faces.context.FacesContext ctx)
public boolean hasError(javax.faces.context.FacesContext fc)
fc
- the FacesContextpublic boolean isPartialSubmit(javax.faces.context.FacesContext fc)
fc
- the Faces Contextpublic String getPartialSubmitComponentId(javax.faces.context.FacesContext fc)
fc
- the Faces Contextpublic javax.faces.component.UIComponent findComponent(javax.faces.context.FacesContext fc, String componentId, javax.faces.component.UIComponent nearComponent)
fc
- the FacesContextcomponentId
- the component idnearComponent
- a component within the same naming container from which to start the search (optional)public static javax.faces.component.UIComponent findChildComponent(javax.faces.component.UIComponent parent, String componentId)
parent
- the parentcomponentId
- the component idpublic String getDefaultControlType(DataType dataType)
dataType
- InputControlManager
protected void initTextResolvers(javax.faces.application.Application app)
protected Connection getConnection(DBDatabase db)
db
- the database for which to obtain a connectionprotected void releaseConnection(Connection conn, boolean commit, DBRollbackManager dbrm)
conn
- the connection to releasecommit
- flag whether to commit changesdbrm
- the rollback managerpublic DBRollbackManager getRollbackManagerForRequest(javax.faces.context.FacesContext fc, boolean create)
fc
- the FacesContextcreate
- if true a DBRollbackManager will be created if not already presentpublic Connection getConnectionForRequest(javax.faces.context.FacesContext fc, DBDatabase db, boolean create)
fc
- the FacesContextdb
- the DBDatabase for which to obtain a connectioncreate
- if true a Connection will be created if not already presentpublic void releaseAllConnections(javax.faces.context.FacesContext fc, boolean commit)
fc
- the FacesContextcommit
- when true changes are committed otherwise they are rolled backpublic void releaseAllConnections(javax.faces.context.FacesContext fc)
fc
- the FacesContextpublic void releaseConnection(javax.faces.context.FacesContext fc, DBDatabase db, boolean commit)
fc
- the FacesContextdb
- the DBDatabase for which to release the connectioncommit
- when true changes are committed otherwise they are rolled backpublic void releaseConnection(javax.faces.context.FacesContext fc, DBDatabase db)
fc
- the FacesContextdb
- the DBDatabase for which to release the connectionCopyright © 2008–2023 Apache Software Foundation. All rights reserved.