ERXApplication.log.info("Welcome to " + name() +
" !");
/* ** put your initialization code in here ** */
setAllowsConcurrentRequestHandling(true);
String directActionRequestHandlerKey =
this.directActionRequestHandlerKey();
WORequestHandler directActionRequestHandler =
this.requestHandlerForKey(directActionRequestHandlerKey);
this.setDefaultRequestHandler(directActionRequestHandler);
this.useComponentActionRedirection =
false;
this.setSessionTimeOut(1200);
}
public WOComponent pageWithName(String name, ERXWOContext c) {
ERXApplication.log.info("Application.pageWithName\n" + name
+ "\n" + c.toString());
if (c.senderID() ==
null && componentRequestHandlerKey().equals(c.request().requestHandlerKey() ) ) {
name =
"Main";
}
return (WOComponent)super.pageWithName(name, c);
}
private WOResponse responseForPageWithName(String name, ERXWOContext c)
{
WOComponent
component = this.pageWithName( name, c );
WOResponse
response = component.generateResponse();
return response;
}
/**
@Method handleException
*
@return WOResponse
* We catch Exceptions from the server to show our own Exception view
*/
public WOResponse handleException(Exception e, ERXWOContext c)
{
WOResponse response;
response =
this.responseForPageWithName
(MyExceptionPage.class.getName(), c );
// We show our own Exception View
e.printStackTrace();
return response;
}
/**
@Method handleSessionRestorationErrorInContext
*
@return WOResponse
* We catch the Session timeout exception from the server to show our own Session Ended view
*/
public WOResponse handleSessionRestorationErrorInContext(ERXWOContext c) {
WOResponse
response = this.responseForPageWithName
(SessionEnded.class.getName(), c );
return response;
}
/**
@Method dispatchRequest
*
@return WOResponse
* Capture and report the amount of time it takes to handle an action; perhaps for TEST only
*/
public WOResponse dispatchRequest(WORequest request) {
System.out.println("Request: " + request);
long startTime = System.currentTimeMillis();
WOResponse response =
super.dispatchRequest(request);
String uri = request.uri();
if (uri.startsWith("/cgi-bin")) {
long elapsedTime = System.currentTimeMillis() - startTime;
NSLog.out.appendln("**************************************");
NSLog.out.appendln("uri: " + request.uri());
NSLog.out.appendln("took: " + elapsedTime +
" milliseconds");
NSLog.out.appendln("");
}
return response;
}
And my DirectAction has this but in this class nothing is called when the test button is pressed:
public
class DirectAction
extends ERXDirectAction {
private String
destinationUrl =
"destinationUrl";
public String destinationUrl() {
return
destinationUrl;
}
/**
* Sets the URL to redirect to when login succeeds.
*
*
@param newDestinationUrl the URL to redirect to when login succeeds
*/
public
void setDestinationUrl(String newDestinationUrl)
{
destinationUrl = newDestinationUrl;
}
public DirectAction(WORequest request) {
super(request);
}
@Override
public WOActionResults defaultAction() {
return pageWithName(Main.class.getName());
}
/**
*
Methode performActionNamed
* This method can be used to run special actions
*
@return actionResults
*/
public WOActionResults performActionNamed(String actionName) {
if (actionName.startsWith("appLogin")) {
// Tue
hier
irgend etwas
tolles
return
super.performActionNamed("default");
}
return
super.performActionNamed(actionName);
}
......