public class OpenTransactionInViewRequestCycle
extends org.apache.wicket.protocol.http.WebRequestCycle
This class provides an Open Transaction in View implementation for
wicket. It provides a custom request cycle that uses the
UserTransaction
to make sure that all work is done within a single
transaction. In Hibernate context, this is referred to as open session in
view.
The method used by this class is more correctly called Open Transaction in View and has a similar effect to open session in view. It is however more general because it supports any (JTA) transactional resource. Also it is more efficient/scalable than most open session in view implementations because a database connection is only obtained from the connection pool when it is needed.
To use this request cycle, add it in your wicket Application
subclass
by overriding
Application.newRequestCycle(org.apache.wicket.Request, Response)
. For
example:
@Override public RequestCycle newRequestCycle(Request aRequest, Response aResponse) { return new OpenTransactionInViewRequestCycle(this, (WebRequest) aRequest, aResponse); }
Constructor and Description |
---|
OpenTransactionInViewRequestCycle(org.apache.wicket.protocol.http.WebApplication aApplication,
org.apache.wicket.protocol.http.WebRequest aRequest,
org.apache.wicket.Response aResponse)
Constructs the request cycle.
|
Modifier and Type | Method and Description |
---|---|
protected void |
onBeginRequest() |
protected void |
onEndRequest() |
org.apache.wicket.Page |
onRuntimeException(org.apache.wicket.Page aPage,
RuntimeException aE) |
getProcessor, getWebRequest, getWebResponse, getWebSession, isRedirect, newBrowserInfoPage, newClientInfo, redirectTo
detach, get, getApplication, getClientInfo, getMetaData, getOriginalResponse, getPageParameters, getRedirect, getRequest, getRequestTarget, getResponse, getResponsePage, getResponsePageClass, getSession, getStartTime, isUrlForNewWindowEncoding, logRuntimeException, onAfterTargetsDetached, onRequestTargetSet, request, request, request, set, setAutomaticallyClearFeedbackMessages, setMetaData, setRedirect, setRequest, setRequestTarget, setResponse, setResponsePage, setResponsePage, setResponsePage, setResponsePage, setUrlForNewWindowEncoding, toString, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, wasHandled
public OpenTransactionInViewRequestCycle(org.apache.wicket.protocol.http.WebApplication aApplication, org.apache.wicket.protocol.http.WebRequest aRequest, org.apache.wicket.Response aResponse)
aApplication
- Application to use.aRequest
- RequestaResponse
- Response.protected void onBeginRequest()
onBeginRequest
in class org.apache.wicket.RequestCycle
protected void onEndRequest()
onEndRequest
in class org.apache.wicket.RequestCycle
public org.apache.wicket.Page onRuntimeException(org.apache.wicket.Page aPage, RuntimeException aE)
onRuntimeException
in class org.apache.wicket.RequestCycle
Copyright © 2022. All rights reserved.