67,513
社区成员
发帖
与我相关
我的任务
分享
<display-name>BlazeDS</display-name>
<description>BlazeDS Application</description>
<servlet>
<servlet-name>MessageBrokerServlet</servlet-name>
<display-name>MessageBrokerServlet</display-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
<init-param>
<param-name>services.configuration.file</param-name>
<param-value>/WEB-INF/flex/services-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
<destination id="ssh_flex">
<adapter ref="java-object" />
<properties>
<source>com.text.SSHFlex</source>
</properties>
</destination>
protected function application1_creationCompleteHandler():void
{
text_flex.sayHello("helloWorld");
}
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<s:RemoteObject id="text_flex" showBusyCursor="true" destination="ssh_flex"
result="text_resultHandler(event)"
fault="text_faultHandler(event)" endpoint="http://127.0.0.1/Test/messagebroker/amf"/>
</fx:Declarations>
public class SSHFlex extends ActionSupport implements ModelDriven<Object>,ServletRequestAware {
。。。
protected void initAction() {
this.response.setCharacterEncoding("utf-8");
this.response.setContentType("text/html,charset=utf-8");
try {
this.request.setCharacterEncoding("utf-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
this.out = this.response.getWriter();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public String sayHello(String name) {
System.out.println("initAction");
initAction();
System.out.println("initAction end")
if(name == null || "".equals(name)) {
return "请告诉我你的名字!";
}
return "hello " + name;
}
}
在执行initAction()之前,理论上先打印出"initAction",但是却没有打印,说明代码没有执行到这信方法内就报错了。
会不会与我这个类实现了ServletRequestAware这个接口有关啊?
晚上回去我重新建一个类来测试一下!