flex+java开发,客户端如何获取session数据????
[java]
import flex.messaging.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class SessionRO {
?
? public HttpServletRequest request;
? public FlexSession session;
? public UsefulRemoteObject() {
? ? ? request = FlexContext.getHttpRequest(); ? ? ? ? ? ?
? ? ? session = FlexContext.getFlexSession(); ? ?
? }
?
? public String getSessionId() throws Exception {
? ? ? String s = new String();
? ? ? s = (String) session.getId(); ? ? ? ? ? ?
? ? ? return s;
? }
? public String getHeader(String h) throws Exception {
? ? ? String s = new String();
? ? ? s = (String) request.getHeader(h); ? ? ? ? ? ?
? ? ? return h + "=" + s;
? }
}
[destination defination]
<destination id="myRODestination">
? <properties>
? ? ? <source>myROPackage.SessionRO</source>
? </properties>
</destination>
[actionscript]
ro = new RemoteObject();
ro.destination = "myRODestination";
ro.getSessionId.addEventListener("result", getSessionIdResultHandler);
ro.getSessionId();