|
07-03-09 / 01:54 : CP2ObjC :Cappuccino/ObjC bridge client part (cjed) | Following Cappuccino/J2EE CP2JavaWS bridge, the client part of a Cappuccino/Objective-C bridge is available here. Parameters (call arguments and return) have been encoded/decoded in plist format (using CPKeyedArchiver/Unarchiver). For the server part (Objective-C), we could simply define a custom WORequestHandler for example (if using WebObjects) : in the handleRequest method we just have to extract call parameters from the WORequest, decode them (using NSKeyedUnarchiver corresponding class), and then invoke the Objective-C service whose name (interface/protocol) has been provided (also method name). We could also encode the whole CPInvocation object (see OBJRPCClient/Server from Tom Robinson - the server part however is made in Objective-J, and is accessed through Jack), but we still have to check if _CPKeyedArchiverEncodeObject function in CPKeyedArchiver is compatible with NSKeyedUnarchive, as it wraps javascript primitive values into _CPKeyedArchiverValue. | | Comments | An updated CP2ObjC.zip archive is available (replaces the previous one). It now works correctly, except for CPDate arguments.
I found that in CPObject, hash method returns __address field. But there isn't such field in CPDate. And in CPKeyedArchiver code, CPDate are considered as objects (they own an isa field), but then there is an error when the _CPKeyedArchiverEncodeObject function tries to call var hash = objj_msgSend(anObject, "hash"),
--> jumps (don''t follow remaining breakpoints) and displays "ReferenceError: Can't find variable: __address"
I took me time to found that :-) (submitted at 03-07-09, 18:57 by cjed) | Write a comment | |
|