Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Direct Action is not getting called



Hi,
I am having trouble in getting my direct action to be called. Below is  
the class for where it is declared. In the browser I have the  
following:

var img = new Image();
img.src =  
"http://localhost//cgi-bin/WebObjects/LightBox.woa/wa/DirectAction/ 
consumerSetAnnotationForImage?image=7563a13f-7a82-4249-b134 
-1dacc079470e/f21538a6-9455-4d38-92a6- 
bcf14afd9589.jpg&title=My%20New%20Title";

The src is autogenerated via javascript so that it can be used for all  
the images on the page. I assign the src to the img so that it updates  
the WO app. The img is just a temp variable so that the user doesn't  
know that there was a trip to the server and makes the app look more  
responsive.

I have tried adding /consumerSetAnnotationForImageAction? as well, but  
it doesn't seem to be getting called either. I have tried removing  
DirectAction in the url as well, but still no success.


Any ideas?

Greg



public class DirectAction extends WODirectAction {

     public DirectAction(WORequest aRequest) {
         super(aRequest);
     }

     public WOActionResults defaultAction() {
         return pageWithName("Main");
     }

	public WOComponent consumerSetAnnotationForImageAction() {
		String image = context().request().stringFormValueForKey("image");
		String annotation =  
context().request().stringFormValueForKey("title");
		EOEditingContext ec = new EOEditingContext();
		EOQualifier qualifier =  
EOQualifier.qualifierWithQualifierFormat("thumbnail = %@", new  
NSArray(image));
		EOFetchSpecification fetchSpec = new  
EOFetchSpecification("ClientImage", qualifier, null);
		
		ec.lock();
		NSArray results = ec.objectsWithFetchSpecification(fetchSpec);
		
		if (results.count() > 0)
		{
			ClientImage img = (ClientImage)results.objectAtIndex(0);
			img.setAnnotation(annotation);
			ec.saveChanges();
		}
		ec.unlock();
		
		ConsumerImageAnnotation next =  
(ConsumerImageAnnotation)pageWithName("ConsumerImageAnnotation");
		next.setTitle(annotation);
		return next;
	}
}
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.