Search in sources :

Example 1 with HttpInvokerServiceExporter

use of org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter in project dubbo by alibaba.

the class HttpProtocol method doExport.

protected <T> Runnable doExport(final 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 InternalHandler());
        serverMap.put(addr, server);
    }
    final HttpInvokerServiceExporter httpServiceExporter = new HttpInvokerServiceExporter();
    httpServiceExporter.setServiceInterface(type);
    httpServiceExporter.setService(impl);
    try {
        httpServiceExporter.afterPropertiesSet();
    } catch (Exception e) {
        throw new RpcException(e.getMessage(), e);
    }
    final String path = url.getAbsolutePath();
    skeletonMap.put(path, httpServiceExporter);
    return new Runnable() {

        public void run() {
            skeletonMap.remove(path);
        }
    };
}
Also used : HttpInvokerServiceExporter(org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter) RpcException(com.alibaba.dubbo.rpc.RpcException) HttpServer(com.alibaba.dubbo.remoting.http.HttpServer) ServletException(javax.servlet.ServletException) IOException(java.io.IOException) RpcException(com.alibaba.dubbo.rpc.RpcException) RemoteAccessException(org.springframework.remoting.RemoteAccessException) SocketTimeoutException(java.net.SocketTimeoutException)

Aggregations

HttpServer (com.alibaba.dubbo.remoting.http.HttpServer)1 RpcException (com.alibaba.dubbo.rpc.RpcException)1 IOException (java.io.IOException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 ServletException (javax.servlet.ServletException)1 RemoteAccessException (org.springframework.remoting.RemoteAccessException)1 HttpInvokerServiceExporter (org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter)1