BlazeDSのリモーティングで、セッションスコープを利用する場合に、remoting-config.xmlに以下のように記述すると思います。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<service id="remoting-service"
class="flex.messaging.services.RemotingService">
<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
<destination id="TwitProxy">
<properties>
<source>radiko.twit.blazeds.remoting.TwitProxy</source>
<scope>session</scope>
</properties>
</destination>
</service>
|
こんな感じで、scopeタグを入れて中をsessionと指定するんですが、GAE/Jではうまく動かないみたいです。
ちゃんと理解できてはいなのですが、ここをみていると、どうやらセッションスコープを使用する際は自分で、setAttributeとかしないといけないみたいです。
いちいちめんどくさかったりしますね・・・。
まあサンプルを乗せておきます。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import javax.servlet.http.HttpSession;
public class HogeDs{
Session session;
public HogeDs(){
session = FlexContext.getHttpRequest().getSession();
}
//文字列をセッションに保存
public boolean save(String data) {
try {
session.setAttribute("data",data);
return true;
}catch(Exception e) {
return false;
}
}
//セッションに入っている文字列を取得
public String get(Object data) {
try {
String data = (String) session.getAttribute("data");
return data
}catch(Exception e) {
return null;
}
}
}
|