6-Nov-04 (Created: 6-Nov-04) | More in 'Howto-Advanced'

Some notes on updateservlet

Changes to the web.config

In your web.config file search for RequestExecutorServlet and make sure it is set to RequestExecutorServletT2. Some of the following facilities may be available from build 20 onwards.

Required properties file entry

Make sure you have the following three lines in your aspire.properties. Also make sure those lines are there only once.


#**************************************************************************
#********** UpdateServlet redirection support
#**************************************************************************
request.aspire.defaultObjects.servletRequestUpdateFailure.className=\
com.ai.servlets.DUpdateServletRequestFailureResponse1

request.aspire.servletsupport.serverSideRedirector.classname=\
com.ai.servlets.AspireServersideRedirector

request.aspire.servletSupport.pageRedirector.className=\
com.ai.servlets.ClientSideRedirector

Example redirections

See how every redirection is qualified with a "redirectType". If not specified it will pick up the global redirect which may be clent side redirect or server side redirect. Be aware though that one should specify this serve side redirect line very occasionally. You should leave this line unspecified most of the time. This support is added when you have large amounts of data that requires to be repainted. So this is useful in form field validations that carry a lot of data.


request.LoginRequest.classname=com.ai.parts.AspireLoginPart

request.LoginRequest.redirectURL=/{aspireContext}/display?url=welcomePageURL&username={username}
request.LoginRequest.redirectURL.redirectType=serverside

request.LoginRequest.failureRedirectURL.INVALID_PASSWORD=\
/{aspireContext}/display?url=LoginPageURL&pageStatus=invalid-login&vs={viewState}
request.LoginRequest.failureRedirectURL.INVALID_PASSWORD.redirectType=serverside

The order of search for redirection

1. Use the root cause code to locate the redirect url

2. Use a matching pattern in the exception message to identify the redirect url

3. Use the failure redirect url off of the request name irrespective of the exception

4. Use the global failure response page if this is not available

Identifying a redirect url using root cause code


request.requestname.failureRedirectURL.rootcausecode=(your redirection)

Identifying a redirect url using matching pattern


request.requestname.failureRedirectURL.matchStrings=string1|string2|string3
request.requestname.failureRedirectURL.string1=(your redirect url)
request.requestname.failureRedirectURL.string2=(your redirect url)

Using the failure redirect url


request.requestname.failureRedirectURL=(your redirect url)

What is a root cause code

When an exception is thrown, this string indicates the url to which the request should be redirected to. If the root cause message is as follows:


"DUPLICATE_EMPLOYEE_NAME:Hey this is not allowed my good fried"

Then the root casue code is


DUPLICATE_EMPLOYEE_NAME

You can use this for redirection as follows


request.requestName.failureRedirectURL.DUPLICATE_EMPLOYEE_NAME=(your redirect url)

This facility is quite handy when you are using stored procedures to alter the redirection path.

Available parameters when something goes wrong

1. aspire.return_code always indicates "failure"

2. aspire.request_name points to the name of the request that came in

3. aspire.error_message points to the message in the exception

4. aspire.root_cause points to the root cause string of the exception

5. aspire.root_cause_code points to the root cause code if available

Now you can specify redirectType

Starting build 19.x you can do this


request.requestName.failureRedirectURL=(your redirect url)
request.requestName.failureRedirectURL.redirectType=(default|serverside:default)
This is quite handy for field validations. When the redirect type is serverside, the entire input value set is preserved.

Reserved words in this context


failureRedirectURL
redirectType
redirectURL
matchStrings

Related File/class References


com.ai.servlets.RequestExecutorServletT2
com.ai.servlets.RequestExecutorServletT1
com.ai.servlets.IUpdateServletRequestFailureResponse
com.ai.servlets.DUpdateServletRequestFailureResponse
com.ai.servlets.DUpdateServletRequestFailureResponse1
com.ai.common.IExceptionAnalyzer
com.ai.common.DExceptionAnalyzer

Compatibility information


com.ai.servlets.RequestExecutorServletT2
com.ai.servlets.DUpdateServletRequestFailureResponse1