Wednesday, March 21, 2007

getting the request object parameters in java flash remoting thru openamf



when you use openamf, your java client talks directly to your java classes. that is, you will not use a servlet or jsp to recieve a request or respond.



what will you do if want to recieve any information from the request object?



openamf talks to your server (say tomcat) thru the servlet org.openamf.DefaultGateway (inside openamf.jar - the primary jar file that you need to work with openamf).



openamf is opensource. take the class org.openamf.DefaultGateway.java. here you will get the request object in the service method. You can insert your code here to pass the request object as a parameter to your class' method. compile and recreate openamf.jar. replace with your new openamf.jar. you got your request object. sail happily.



to recieve the request object in my code i do the following



public class RequestObjectGetter

{

private static HttpServletRequest request;



public static void setRequestObject(HttpServletRequest req)

{

request = req;

}



public static HttpServletRequest getRequestObject()

{

return req;

}

}



add code to suit your needs. happy remoting!





powered by performancing firefox

1 comment:

Giuseppe Morreale said...

If you want I write some article about ActionScript3 communications with java.

I analize also openAMF and write a tutorial about this.
OpenAMF problem is that supports only the AMF0 version.

http://programmaremobile.blogspot.com/2009/10/java-flash-actionscript-and-amf.html

see also other article about as3 (flex)and webservice call.