com.caucho.hessian.server.HessianSkeleton Java Examples

The following examples show how to use com.caucho.hessian.server.HessianSkeleton. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HessianProtocol.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
@Override
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();
    final HessianSkeleton skeleton = new HessianSkeleton(impl, type);
    skeletonMap.put(path, skeleton);

    final String genericPath = path + "/" + Constants.GENERIC_KEY;
    skeletonMap.put(genericPath, new HessianSkeleton(impl, GenericService.class));

    return new Runnable() {
        @Override
        public void run() {
            skeletonMap.remove(path);
            skeletonMap.remove(genericPath);
        }
    };
}
 
Example #2
Source File: HessianProtocol.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
@Override
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());

        Enumeration<String> enumeration = request.getHeaderNames();
        while (enumeration.hasMoreElements()) {
            String key = enumeration.nextElement();
            if (key.startsWith(Constants.DEFAULT_EXCHANGER)) {
                RpcContext.getContext().setAttachment(key.substring(Constants.DEFAULT_EXCHANGER.length()),
                        request.getHeader(key));
            }
        }

        try {
            skeleton.invoke(request.getInputStream(), response.getOutputStream());
        } catch (Throwable e) {
            throw new ServletException(e);
        }
    }
}
 
Example #3
Source File: HessianProtocol.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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);
        }
    };
}
 
Example #4
Source File: HessianProtocol.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
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);
        }
    };
}
 
Example #5
Source File: HessianProtocol.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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);
        }
    };
}
 
Example #6
Source File: HessianProtocol.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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);
        }
    };
}
 
Example #7
Source File: HessianProtocol.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #8
Source File: HessianProtocol.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #9
Source File: HessianProtocol.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #10
Source File: HessianProtocol.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #11
Source File: HessianExporter.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Initialize this exporter.
 */
public void prepare() {
	checkService();
	checkServiceInterface();
	this.skeleton = new HessianSkeleton(getProxyForService(), getServiceInterface());
}
 
Example #12
Source File: HessianExporter.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Initialize this exporter.
 */
public void prepare() {
	checkService();
	checkServiceInterface();
	this.skeleton = new HessianSkeleton(getProxyForService(), getServiceInterface());
}
 
Example #13
Source File: HessianExporter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize this exporter.
 */
public void prepare() {
	checkService();
	checkServiceInterface();
	this.skeleton = new HessianSkeleton(getProxyForService(), getServiceInterface());
}
 
Example #14
Source File: HessianExporter.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize this exporter.
 */
public void prepare() {
	checkService();
	checkServiceInterface();
	this.skeleton = new HessianSkeleton(getProxyForService(), getServiceInterface());
}