15.3使用Hessian和Burlap釋出遠端服務
阿新 • • 發佈:2021-01-21
15.3.1使用Hessian和Burlap匯出Bean的功能
1)匯出Hessian服務@Bean2)配置hessian控制器(配置DispatcherServlet、處理器對映器handlermapping)
public HessianServiceExporter hessianServiceExporterSpittrService(SpittrService spittrService){
HessianServiceExporter exporter = new HessianServiceExporter();
exporter.setService(spittrService);
exporter.setServiceInterface(SpittrService.class);
return exporter;
}
@Override
protected String[] getServletMappings() {
return new String[]{"/","*.service"};
}
@Bean
public HandlerMapping hessianMapping(){
SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
Properties mappings = newProperties();
mappings.setProperty("/spttr.service","hessianServiceExporterSpittrService");
mapping.setMappings(mappings);
return mapping;
}
15.3.2訪問Hessian/Burlap服務
@Bean
public HessianProxyFactoryBean spittrService(){
HessianProxyFactoryBean proxyFactoryBean = new HessianProxyFactoryBean();
proxyFactoryBean.setServiceUrl("http://localhost:8080/RpcServer/spttr.service");
proxyFactoryBean.setServiceInterface(SpittrService.class);
return proxyFactoryBean;
}
來自為知筆記(Wiz)