Re: AjaxSubmitButton with directActionRequestHandler results in cryptical class reference
Re: AjaxSubmitButton with directActionRequestHandler results in cryptical class reference
- Subject: Re: AjaxSubmitButton with directActionRequestHandler results in cryptical class reference
- From: Pascal Robert <email@hidden>
- Date: Wed, 18 Sep 2013 03:36:19 -0400
Le 2013-09-18 à 03:28, "Dipl.-Ing. Jens Lünstedt" <email@hidden> a écrit :
> Hi Bogdan,
> I know that but on the other environment instead of Macintosh HD 2 it is only Macintosh HD. There is also a space and there is no problem.
> But I'll check that in a minute.
If Macintosh HD is the boot volume, it won't be a problem since the path will be /something/something. Avoid spaces at all costs in the path, I don't have enough fingers and toes to count the number of times this problem happened to people.
> Jens
>
>
> Am 18.09.2013 um 09:23 schrieb Bogdan Zlatanov <email@hidden>:
>
>> Looking at this path: /Volumes/Macintosh HD 2/Benutzer, I wonder if you have spaces in your paths.
>>
>> From the wocommunity wiki here -> http://wiki.wocommunity.org/display/WOL/Install+WOLips+with+Eclipse+Update+Manager
>>
>> Eclipse Paths
>> To avoid weird and inconsistent behavior by WOLips the complete paths to the Eclipse executable, to your Eclipse Workspace and to any external WOFrameworks must NOT have spaces nor dashes in them!
>>
>> May be check that just to be on the safe side.
>>
>> Regards,
>> Bogdan Zlatanov
>>
>> On 18 Sep 2013, at 09:11, Dipl.-Ing. Jens Lünstedt wrote:
>>
>>> Hi together.
>>> I was on a false track.
>>> I have a problem with my development environment which I ignored in the last weeks.
>>> In the past I had only the problem that the ant install scripts end with an error. Now this problem is also the cause for the Ajax problem.
>>> I have two environments my normal and one on a virtual machine, where all things are doing well.
>>>
>>> So the problem seems to be a path problem.
>>> When I run Ant install I get
>>> BUILD FAILD
>>> /Volumes/Macintosh HD 2/Benutzer/.../build.xml:206: The framework name 'ERExtensions' does not exist.
>>>
>>> The problem is that I can't find any difference between my home environment and the virtual one. Only the sources are on another harddrive.
>>> Does anyone has an idea where I should search?
>>> The paths of the frameworks are the same.
>>> The wolips.properties are equal (without the username of course).
>>>
>>> Jens
>>>
>>>
>>> Am 18.09.2013 um 02:50 schrieb Chuck Hill <email@hidden>:
>>>
>>>> On 13-09-17 11:15 AM, "Dipl.-Ing. Jens Lünstedt" wrote:
>>>>
>>>> What is about this?
>>>> This is also working for me.
>>>>
>>>> WORequestHandler directActionRequestHandler = this.requestHandlerForKey("wo");
>>>> this.setDefaultRequestHandler(directActionRequestHandler);
>>>>
>>>> You just broke WebObjects. :-) The ONLY time you should use code other than
>>>>
>>>> String directActionRequestHandlerKey = this.directActionRequestHandlerKey();
>>>> WORequestHandler directActionRequestHandler = this.requestHandlerForKey(directActionRequestHandlerKey);
>>>> this.setDefaultRequestHandler(directActionRequestHandler);
>>>>
>>>> Is IF you have written your own request handler. And that is a uncommon activity. You can't just blindly mix and match them.
>>>>
>>>>
>>>> Chuck
>>>>
>>>>
>>>> Am 17.09.2013 um 19:53 schrieb Chuck Hill <email@hidden>:
>>>>
>>>>> On 13-09-17 10:43 AM, "Dipl.-Ing. Jens Lünstedt" wrote:
>>>>>
>>>>> Hi Chuck,
>>>>> thanks for your help.
>>>>> I don't registered any Ajax Handler but I think that
>>>>>
>>>>> String directActionRequestHandlerKey = this.directActionRequestHandlerKey();
>>>>> WORequestHandler directActionRequestHandler = this.requestHandlerForKey(directActionRequestHandlerKey);
>>>>> this.setDefaultRequestHandler(directActionRequestHandler);
>>>>>
>>>>> redirects ALL requests to the directActionClass.
>>>>>
>>>>> Print out
>>>>>
>>>>> No, not all.
>>>>> public WORequestHandler defaultRequestHandler()
>>>>> Returns the request handler to be used when no request handler key is found in the URL or WORequest. By default, returns the WOComponent request handler. When an application is contacted for the first time it is usually via a URL like the following:
>>>>>
>>>>> http://somehost/cgi-bin/WebObjects/AppName.woa
>>>>>
>>>>>
>>>>>
>>>>> The way that URLs of this type are handled is determined by the default request handler.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> I understand that this is not what we want. So the question is which is the correct setting?
>>>>>
>>>>> You only need that code IF you have a defaultAction() in your DirectAction class that you want run as the first page in an application. This can be useful to prevent the creation of unneeded sessions, but this is not required.
>>>>>
>>>>>
>>>>> I just found out this:
>>>>> this.setWebServiceRequestHandlerKey(this.directActionRequestHandlerKey());
>>>>>
>>>>> With this it seems to be all is working in the direction I want it. Is this the correct way?
>>>>>
>>>>> No, that is just breaking web services. :-)
>>>>>
>>>>> Chuck
>>>>>
>>>>>
>>>>> It is interesting that this method is deprecated while in Wonder 6.0 it is not.
>>>>>
>>>>> So it looks like all is working how I need it.
>>>>>
>>>>> Thanks to all for your help.
>>>>>
>>>>> Jens
>>>>>
>>>>>
>>>>>
>>>>> Am 17.09.2013 um 19:30 schrieb Chuck Hill <email@hidden>:
>>>>>
>>>>>> On 13-09-16 10:19 PM, "Dipl.-Ing. Jens Lünstedt" wrote:
>>>>>>
>>>>>> Hello Chuck, hello Theodore,
>>>>>> I created a simple test component.
>>>>>> <wo:WOForm>
>>>>>> <wo:AjaxSubmitButtonaction="$print"value="Test"/>
>>>>>> </wo:WOForm>
>>>>>>
>>>>>> and
>>>>>> publicclassAjaxTestComponent extends ERXComponent {
>>>>>> public AjaxTestComponent(WOContext context) {
>>>>>> super(context);
>>>>>> }
>>>>>>
>>>>>> public WOActionResults print() {
>>>>>> System.out.println("TEST");
>>>>>> returnnull;
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> 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'.
>>>>>>
>>>>>> Ajax is a stateful technology in WO. The /ajax/ requests must NOT go to the direct action request handler. Have you registered ajax as the direct action request handler key?
>>>>>>
>>>>>>
>>>>>> 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.
>>>>>>
>>>>>> You can't use Ajax with the direct action request handler. You can use both in the same application, but you can't handle Ajax requests with the direct action request handler.
>>>>>>
>>>>>>
>>>>>>
>>>>>> 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:
>>>>>> publicclass Application extends ERXApplication {
>>>>>> publicstaticvoid main(String[] argv) {
>>>>>> ERXApplication.main(argv, Application.class);
>>>>>> }
>>>>>>
>>>>>> public Application() {
>>>>>>
>>>>>> super();
>>>>>>
>>>>>>
>>>>>> Chuck
>>>>>>
>>>>>> 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)
>>>>>> {
>>>>>> WOComponentcomponent = this.pageWithName( name, c );
>>>>>> WOResponseresponse = 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) {
>>>>>> WOResponseresponse = 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:
>>>>>> publicclass DirectAction extends ERXDirectAction {
>>>>>> private String destinationUrl = "destinationUrl";
>>>>>>
>>>>>>
>>>>>> public String destinationUrl() {
>>>>>> returndestinationUrl;
>>>>>> }
>>>>>>
>>>>>> /**
>>>>>> * Sets the URL to redirect to when login succeeds.
>>>>>> *
>>>>>> * @param newDestinationUrl the URL to redirect to when login succeeds
>>>>>> */
>>>>>> publicvoid 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
>>>>>> returnsuper.performActionNamed("default");
>>>>>> }
>>>>>> returnsuper.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
>>
>
> _______________________________________________
> 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
_______________________________________________
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