读书人

flex+java开发客户端怎么获取sessio

发布时间: 2012-11-09 10:18:48 作者: rapoo

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();

读书人网 >flex

热点推荐