• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AjaxSubmitButton with directActionRequestHandler results in cryptical class reference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AjaxSubmitButton with directActionRequestHandler results in cryptical class reference


  • Subject: Re: AjaxSubmitButton with directActionRequestHandler results in cryptical class reference
  • From: Samuel Pelletier <email@hidden>
  • Date: Tue, 17 Sep 2013 10:24:33 -0400

Jens,

I suspect that you are trying to use Ajax stuff in a stateless context.

Ajax stuff require a statefull context. Try to call session() during your test page creation, either in the direct action or inside the page.

Samuel


Le 2013-09-17 à 01:19, Dipl.-Ing. Jens Lünstedt <email@hidden> a écrit :

Hello Chuck, hello Theodore,
I created a simple test component.
<wo:WOForm>
          <wo:AjaxSubmitButton action="$print" value="Test"/>
        </wo:WOForm>

and
public class AjaxTestComponent extends ERXComponent {
    public AjaxTestComponent(WOContext context) {
        super(context);
    }

public WOActionResults print() {
System.out.println("TEST");
return null;
}
}

This is the result:
Request: <er.extensions.appserver.ERXRequest (<er.extensions.appserver.ERXRequest httpVersion=HTTP/1.1 headers={accept=[text/_javascript_, text/html, application/xml, text/xml, */*], accept-encoding=[gzip, deflate], accept-language=[de-de], connection=[keep-alive], content-length=[65], content-type=[application/x-www-form-urlencoded; charset=UTF-8], dnt=[1], host=[127.0.0.1:53876], origin=[http://127.0.0.1:53876], referer=[http://127.0.0.1:53876/cgi-bin/WebObjects/LTPDevBase.woa/wo/ICLTPm2D2qPW7jR89Hpw50/4.1.0.0.33.7.7.3], user-agent=[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1], x-prototype-version=[1.7], x-requested-with=[XMLHttpRequest]} content-length=65 cookies=null userInfo={} storePageInBacktrackCache=true >) method=POST uri=/cgi-bin/WebObjects/LTPDevBase.woa/ajax/ICLTPm2D2qPW7jR89Hpw50/6.1?1379393722978 defaultFormValueEncoding=UTF-8 formValueEncodingDetectionEnabled=NO formValueEncoding=UTF-8 formValues={WOIsmapCoords = ("1379393722978"); 1.1 = ("Test"); wosid = ("ICLTPm2D2qPW7jR89Hpw50"); AJAX_SUBMIT_BUTTON_NAME = ("1.1"); } >
Sep 17 06:55:23 LTPDevBase[53876] ERROR er.extensions.appserver.ERXApplication  - Exception caught: <er.extensions.appserver.ERXDirectActionRequestHandler> Couldn't locate action class named 'ICLTPm2D2qPW7jR89Hpw50'.
Extra info: {
"Bundles" = {
"Ajax" = "";
"ERExtensions" = "";
"JavaMemoryAdaptor" = "";
"JavaWebObjects" = "";
"JavaXML" = "";
"JavaJDBCAdaptor" = "";
"LTPDevBase" = "";
"ERPrototypes" = "";
"JavaWOExtensions" = "";
"JavaEOAccess" = "";
"JavaEOControl" = "";
"MySQLPlugIn" = "";
"WOOgnl" = "";
"ERPDFGeneration" = "";
"JavaFoundation" = "";
};
"Headers" = {
"user-agent" = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1";
"origin" = "http://127.0.0.1:53876";
"accept" = "text/_javascript_, text/html, application/xml, text/xml, */*";
"dnt" = "1";
"referer" = "http://127.0.0.1:53876/cgi-bin/WebObjects/LTPDevBase.woa/wo/ICLTPm2D2qPW7jR89Hpw50/4.1.0.0.33.7.7.3";
"content-type" = "application/x-www-form-urlencoded; charset=UTF-8";
"x-requested-with" = "XMLHttpRequest";
"accept-encoding" = "gzip, deflate";
"x-prototype-version" = "1.7";
"content-length" = "65";
"host" = "127.0.0.1:53876";
"accept-language" = "de-de";
"connection" = "keep-alive";
};
"URL" = "/cgi-bin/WebObjects/LTPDevBase.woa/ajax/ICLTPm2D2qPW7jR89Hpw50/6.1?1379393722978";
}

IllegalStateException: <er.extensions.appserver.ERXDirectActionRequestHandler> Couldn't locate action class named 'ICLTPm2D2qPW7jR89Hpw50'.
  at com.webobjects.appserver._private.WOActionRequestHandler._handleRequest(WOActionRequestHandler.java:286)
     ... skipped 5 stack elements
  at rsc.ltp.Application.dispatchRequest(Application.java:119)
  ... skipped 3 stack elements
_ignoredPackages:: ("com.webobjects", "java.applet", "java.awt", "java.awt.datatransfer", "java.awt.event", "java.awt.image", "java.beans", "java.io", "java.lang", "java.lang.reflect", "java.math", "java.net", "java.rmi", "java.rmi.dgc", "java.rmi.registry", "java.rmi.server", "java.security", "java.security.acl", "java.security.interfaces", "java.sql", "java.text", "java.util", "java.util.zip")
Sep 17 06:55:23 LTPDevBase[53876] INFO  er.extensions.appserver.ERXApplication  - Session.Session: $SESSION CREATED pGox8DmtqDW6WcH1diziu0
Sep 17 06:55:23 LTPDevBase[53876] INFO  NSLog  - **************************************
Sep 17 06:55:23 LTPDevBase[53876] INFO  NSLog  - uri:  /cgi-bin/WebObjects/LTPDevBase.woa/ajax/ICLTPm2D2qPW7jR89Hpw50/6.1?1379393722978


So I don't think that the problem is there. I also created a test application. This works with Ajax while I don't use the directActionRequestHandler. I mark them with bigger letters.
Yesterday I also found out that the same problem is with the AjaxObserveField. As I can see in the error message it has something to do with the request handler.
My Application class is this:
public class Application extends ERXApplication {
public static void main(String[] argv) {
ERXApplication.main(argv, Application.class);
}

public Application() {
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);
}

......

Thanks
Jens

Am 16.09.2013 um 19:45 schrieb Chuck Hill <email@hidden>:

I don't think your problem is in the Application constructor.  What are the bindings on your AjaxSubmitButton?

Chuck


On 13-09-16 7:56 AM, ""Dipl.-Ing. Jens Lünstedt"" wrote:

Hello All,
I'm not very familiar with Ajax and webobjects so I didn't understand what is wrong. I hope one can help me. I only found one comparing question in the internet but without an answer.
Here is my problem:

I have a webobjects application where in a modal window I like to search for something.
So there are some textfields and lists where the user can enter some search criteria. After that he should press a button to search. (This is the step before I will use live search).
When I use the normal Submitbutton it does a refresh of the whole page and the modal window disappears of course. So I like to use the AjaxSubmitButton in the hope that the values of the textfields are send to the server before the button action is run.
But when I use the AjaxSubmitButton I get an error that the class for example: Couldn't locate action class named 'jgtWMWA0AcZ4DtLCSIuQ20' is not found. On the other side the compiler found the correct method.
I found out that this has something to do with using the directAction class.

So as described in the Wonder documentation I use this code in the Application constructor
String directActionRequestHandlerKey = this.directActionRequestHandlerKey();
WORequestHandler directActionRequestHandler = this.requestHandlerForKey(directActionRequestHandlerKey);
this.setDefaultRequestHandler(directActionRequestHandler);

When I don't use this, the AjaxSubmitButton is working properly but the rest of my application doesn't work anymore.
I tried to use the AjaxRequestHandler for ComponentRequests but than the other Ajax functions are not working anymore.

So the question is:
How do I have the Application constructor to change so that both are working, the directActions and the AjaxSubmitButton?

Thank you very much

Jens


-- 
Chuck Hill             
Executive Managing Partner, VP Development and Technical Services

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/gvc/practical_webobjects

Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C! 

Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: AjaxSubmitButton with directActionRequestHandler results in cryptical class reference (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Can someone please point me to sample ERQuartzScheduler code
  • Next by Date: Re: AjaxSubmitButton with directActionRequestHandler results in cryptical class reference
  • Previous by thread: Re: AjaxSubmitButton with directActionRequestHandler results in cryptical class reference
  • Next by thread: Re: AjaxSubmitButton with directActionRequestHandler results in cryptical class reference
  • Index(es):
    • Date
    • Thread