本文整理汇总了Java中com.caucho.hessian.server.HessianSkeleton类的典型用法代码示例。如果您正苦于以下问题:Java HessianSkeleton类的具体用法?Java HessianSkeleton怎么用?Java HessianSkeleton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HessianSkeleton类属于com.caucho.hessian.server包,在下文中一共展示了HessianSkeleton类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExport
import com.caucho.hessian.server.HessianSkeleton; //导入依赖的package包/类
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
String addr = url.getIp() + ":" + url.getPort();
HttpServer server = serverMap.get(addr);
if (server == null) {
server = httpBinder.bind(url, new HessianHandler());
serverMap.put(addr, server);
}
final String path = url.getAbsolutePath();
HessianSkeleton skeleton = new HessianSkeleton(impl, type);
skeletonMap.put(path, skeleton);
return new Runnable() {
public void run() {
skeletonMap.remove(path);
}
};
}
示例2: handle
import com.caucho.hessian.server.HessianSkeleton; //导入依赖的package包/类
public void handle(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
globalDataTranster(request);
String uri = request.getRequestURI();
HessianSkeleton skeleton = skeletonMap.get(uri);
if (! request.getMethod().equalsIgnoreCase("POST")) {
response.setStatus(500);
} else {
RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
try {
skeleton.invoke(request.getInputStream(), response.getOutputStream());
} catch (Throwable e) {
throw new ServletException(e);
}
}
}
示例3: HessianFilter
import com.caucho.hessian.server.HessianSkeleton; //导入依赖的package包/类
public HessianFilter(ServletContext context) {
WebApplicationContext webApplicationContext = WebApplicationContextUtils.findWebApplicationContext(context);
String[] strarr = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(webApplicationContext, Object.class);
for (String s : strarr) {
Object target = webApplicationContext.getBean(s);
HessianEndpoint hessianEndpointAnnotation = target.getClass().getAnnotation(HessianEndpoint.class);
if (hessianEndpointAnnotation != null) {
try {
Class apiClz = null;
Class[] interfacesClass = target.getClass().getInterfaces();
if (interfacesClass != null && interfacesClass.length > 0) {
apiClz = interfacesClass[0];
} else {
apiClz = target.getClass();
}
HessianSkeleton hessianSkeleton = new HessianSkeleton(target, apiClz);
hessianSkeletonMap.put(HessianConstant.HESSIAN_PATH + hessianEndpointAnnotation.servicePattern(), hessianSkeleton);
} catch (Exception e) {
logger.error("registerProcessor error : " + e.getMessage(), e);
}
}
}
}
示例4: doFilter
import com.caucho.hessian.server.HessianSkeleton; //导入依赖的package包/类
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
String urlPattern = httpServletRequest.getRequestURI();
HessianSkeleton hessianSkeleton = hessianSkeletonMap.get(urlPattern);
try {
if (hessianSkeleton != null) {
hessianSkeleton.invoke(request.getInputStream(), response.getOutputStream());
} else {
chain.doFilter(request,response);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: doExport
import com.caucho.hessian.server.HessianSkeleton; //导入依赖的package包/类
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws JahhanException {
String addr = url.getIp() + ":" + url.getPort();
HttpServer server = serverMap.get(addr);
if (server == null) {
server = httpBinder.bind(url, new HessianHandler());
serverMap.put(addr, server);
}
final String path = url.getAbsolutePath();
HessianSkeleton skeleton = new HessianSkeleton(impl, type);
skeletonMap.put(path, skeleton);
return new Runnable() {
public void run() {
skeletonMap.remove(path);
}
};
}
示例6: doExport
import com.caucho.hessian.server.HessianSkeleton; //导入依赖的package包/类
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
String addr = getAddr(url);
HttpServer server = serverMap.get(addr);
if (server == null) {
server = httpBinder.bind(url, new HessianHandler());
serverMap.put(addr, server);
}
final String path = url.getAbsolutePath();
HessianSkeleton skeleton = new HessianSkeleton(impl, type);
skeletonMap.put(path, skeleton);
return new Runnable() {
public void run() {
skeletonMap.remove(path);
}
};
}
示例7: handle
import com.caucho.hessian.server.HessianSkeleton; //导入依赖的package包/类
public void handle(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String uri = request.getRequestURI();
HessianSkeleton skeleton = skeletonMap.get(uri);
if (! request.getMethod().equalsIgnoreCase("POST")) {
response.setStatus(500);
} else {
RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
try {
skeleton.invoke(request.getInputStream(), response.getOutputStream());
} catch (Throwable e) {
throw new ServletException(e);
}
}
}
示例8: handle
import com.caucho.hessian.server.HessianSkeleton; //导入依赖的package包/类
public void handle(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String uri = request.getRequestURI();
HessianSkeleton skeleton = skeletonMap.get(uri);
if (!request.getMethod().equalsIgnoreCase("POST")) {
response.setStatus(500);
} else {
RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
try {
skeleton.invoke(request.getInputStream(), response.getOutputStream());
} catch (Throwable e) {
throw new ServletException(e);
}
}
}
示例9: prepare
import com.caucho.hessian.server.HessianSkeleton; //导入依赖的package包/类
/**
* Initialize this exporter.
*/
public void prepare() {
checkService();
checkServiceInterface();
this.skeleton = new HessianSkeleton(getProxyForService(), getServiceInterface());
}