package flex;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import flex.messaging.FactoryInstance;
import flex.messaging.FlexFactory;
import flex.messaging.config.ConfigMap;
import flex.messaging.services.ServiceException;
public class SpringFactory implements FlexFactory {
private static final String SOURCE = "source";
public void initialize(String id, ConfigMap configMap) {
}
public FactoryInstance createFactoryInstance(String id, ConfigMap properties)
{
SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);
instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));
return instance;
}
public Object lookup(FactoryInstance inst) {
SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;
return factoryInstance.lookup();
}
static class SpringFactoryInstance extends FactoryInstance {
SpringFactoryInstance(SpringFactory factory, String id, ConfigMap properties) {
super(factory, id, properties);
}
public String toString() {
return "SpringFactory instance for id=" + getId() + " source="
+ getSource() + " scope=" + getScope();
}
public Object lookup() {
ApplicationContext appContext = WebApplicationContextUtils
.getWebApplicationContext(flex.messaging.FlexContext
.getServletConfig().getServletContext());
String beanName = getSource();
try {
return appContext.getBean(beanName);
} catch (NoSuchBeanDefinitionException nexc) {
ServiceException e = new ServiceException();
String msg = "Spring service named '" + beanName
+ "' does not exist.";
e.setMessage(msg);
e.setRootCause(nexc);
e.setDetails(msg);
e.setCode("Server.Processing");
throw e;
} catch (BeansException bexc) {
ServiceException e = new ServiceException();
String msg = "Unable to create Spring service named '"
+ beanName + "' ";
e.setMessage(msg);
e.setRootCause(bexc);
e.setDetails(msg);
e.setCode("Server.Processing");
throw e;
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Flex_Spring_BlazeDS.rar (51个子文件)
FlexTest
.project 660B
.settings
org.eclipse.core.resources.prefs 88B
libs
.actionScriptProperties 1KB
html-template
AC_OETags.js 8KB
history.js 1KB
index.template.html 4KB
playerProductInstall.swf 657B
history.htm 1KB
history.swf 3KB
src
FlexTest.mxml 707B
.flexProperties 285B
FlexServer
.project 1KB
.settings
.jsdtscope 500B
org.eclipse.jdt.core.prefs 330B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.jsdt.ui.superType.name 6B
.mymetadata 303B
WebRoot
WEB-INF
flex
messaging-config.xml 513B
remoting-config.xml 533B
services-config.xml 4KB
version.properties 73B
proxy-config.xml 826B
web.xml 1KB
src
applicationContext.xml 222B
lib
commons-logging.jar 37KB
cfgatewayadapter.jar 15KB
flex-messaging-proxy.jar 65KB
commons-httpclient-3.0.1.jar 273KB
flex-messaging-remoting.jar 18KB
commons-codec-1.3.jar 46KB
flex-messaging-common.jar 94KB
flex-messaging-core.jar 669KB
flex-messaging-opt.jar 20KB
spring.jar 2.54MB
flex-rds-server.jar 53KB
xalan.jar 3MB
classes
flex
SpringFactory.class 1KB
SpringFactory$SpringFactoryInstance.class 3KB
test
HelloWorld.class 627B
index.jsp 834B
META-INF
MANIFEST.MF 36B
FlexTest-debug
AC_OETags.js 8KB
history.js 1KB
FlexTest.swf 326KB
playerProductInstall.swf 657B
history.htm 1KB
history.swf 3KB
FlexTest.html 4KB
.myeclipse
src
flex
SpringFactory.java 2KB
test
HelloWorld.java 123B
.classpath 1KB
共 51 条
- 1
资源评论
- zhboseu2014-01-26能有些文档更好了
- sweet6hero2012-12-27讲的不够详细
- quakexx2013-09-13一般吧,感觉不够用的
- anglesice2013-07-14讲的不够详细
sohero
- 粉丝: 4
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功