当前位置: 首页>>代码示例>>Java>>正文


Java GetRestful.getRootResourceClass方法代码示例

本文整理汇总了Java中org.jboss.resteasy.util.GetRestful.getRootResourceClass方法的典型用法代码示例。如果您正苦于以下问题:Java GetRestful.getRootResourceClass方法的具体用法?Java GetRestful.getRootResourceClass怎么用?Java GetRestful.getRootResourceClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.resteasy.util.GetRestful的用法示例。


在下文中一共展示了GetRestful.getRootResourceClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doExport

import org.jboss.resteasy.util.GetRestful; //导入方法依赖的package包/类
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
    String addr = url.getIp() + ":" + url.getPort();
    Class implClass = ServiceImplHolder.getInstance().popServiceImpl().getClass();
    RestServer server = servers.get(addr);
    if (server == null) {
        server = serverFactory.createServer(url.getParameter(Constants.SERVER_KEY, "jetty"));
        server.start(url);
        servers.put(addr, server);
    }

    final Class resourceDef = GetRestful.getRootResourceClass(implClass) != null ? implClass : type;
    server.deploy(resourceDef, impl, getContextPath(url));

    final RestServer s = server;
    return new Runnable() {
        public void run() {
            // TODO due to dubbo's current architecture,
            // it will be called from registry protocol in the shutdown process and won't appear in logs
            s.undeploy(resourceDef);
        }
    };
}
 
开发者ID:lsjiguang,项目名称:dangdangdotcom,代码行数:23,代码来源:RestProtocol.java

示例2: doExport

import org.jboss.resteasy.util.GetRestful; //导入方法依赖的package包/类
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
    String addr = url.getIp() + ":" + url.getPort();
    Class implClass = ServiceClassHolder.getInstance().popServiceClass();
    RestServer server = servers.get(addr);
    if (server == null) {
        server = serverFactory.createServer(url.getParameter(Constants.SERVER_KEY, "jetty"));
        server.start(url);
        servers.put(addr, server);
    }

    String contextPath = getContextPath(url);
    if ("servlet".equalsIgnoreCase(url.getParameter(Constants.SERVER_KEY, "jetty"))) {
        ServletContext servletContext = ServletManager.getInstance().getServletContext(ServletManager.EXTERNAL_SERVER_PORT);
        if (servletContext == null) {
            throw new RpcException("No servlet context found. Since you are using server='servlet', " +
                    "make sure that you've configured " + BootstrapListener.class.getName() + " in web.xml");
        }
        String webappPath = servletContext.getContextPath();
        if (StringUtils.isNotEmpty(webappPath)) {
            webappPath = webappPath.substring(1);
            if (!contextPath.startsWith(webappPath)) {
                throw new RpcException("Since you are using server='servlet', " +
                        "make sure that the 'contextpath' property starts with the path of external webapp");
            }
            contextPath = contextPath.substring(webappPath.length());
            if (contextPath.startsWith("/")) {
                contextPath = contextPath.substring(1);
            }
        }
    }

    final Class resourceDef = GetRestful.getRootResourceClass(implClass) != null ? implClass : type;

    server.deploy(resourceDef, impl, contextPath);

    final RestServer s = server;
    return new Runnable() {
        public void run() {
            // TODO due to dubbo's current architecture,
            // it will be called from registry protocol in the shutdown process and won't appear in logs
            s.undeploy(resourceDef);
        }
    };
}
 
开发者ID:zhuxiaolei,项目名称:dubbo2,代码行数:45,代码来源:RestProtocol.java

示例3: doExport

import org.jboss.resteasy.util.GetRestful; //导入方法依赖的package包/类
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
    String addr = url.getIp() + ":" + url.getPort();
    Class implClass = ServiceClassHolder.getInstance().popServiceClass();
    RestServer server = servers.get(addr);
    if (server == null) {
        server = serverFactory.createServer(url.getParameter(Constants.SERVER_KEY, "jetty"));
        server.start(url);
        servers.put(addr, server);
    }

    String contextPath = getContextPath(url);
    if ("servlet".equalsIgnoreCase(url.getParameter(Constants.SERVER_KEY, "jetty"))) {
        ServletContext servletContext = ServletManager.getInstance().getServletContext(ServletManager.EXTERNAL_SERVER_PORT);
        if (servletContext == null) {
            throw new RpcException("No servlet context found. Since you are using server='servlet', " +
                    "make sure that you've configured " + BootstrapListener.class.getName() + " in web.xml");
        }
        String webappPath = servletContext.getContextPath();
        if (StringUtils.isNotEmpty(webappPath)) {
            webappPath = webappPath.substring(1);
            if (!contextPath.startsWith(webappPath)) {
                throw new RpcException("Since you are using server='servlet', " +
                        "make sure that the 'contextpath' property starts with the path of external webapp");
            }
            contextPath = contextPath.substring(webappPath.length());
            if (contextPath.startsWith("/")) {
                contextPath = contextPath.substring(1);
            }
        }
    }

    final Class resourceDef = GetRestful.getRootResourceClass(implClass) != null ? implClass : type;

    // dubbo 服务多版本
    String version = url.getParameter(Constants.VERSION_KEY);
    if (StringUtils.isNotEmpty(version)) {
        contextPath = version + "/" + contextPath;
    }
    server.deploy(resourceDef, impl, contextPath);

    final RestServer s = server;
    return new Runnable() {
        public void run() {
            // TODO due to dubbo's current architecture,
            // it will be called from registry protocol in the shutdown process and won't appear in logs
            s.undeploy(resourceDef);
        }
    };
}
 
开发者ID:sdcuike,项目名称:dubbo-rpc-rest,代码行数:50,代码来源:RestProtocol.java

示例4: doExport

import org.jboss.resteasy.util.GetRestful; //导入方法依赖的package包/类
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws JahhanException {
	String addr = url.getIp() + ":" + url.getPort();
	Class implClass = ServiceClassHolder.getInstance().popServiceClass();
	RestServer server = servers.get(addr);
	if (server == null) {
		serverFactory.setHttpBinder(httpBinder);
		server = serverFactory.createServer(url.getParameter(Constants.SERVER_KEY, "jetty"));
		server.start(url);
		servers.put(addr, server);
	}

	String contextPath = getContextPath(url);
	if ("servlet".equalsIgnoreCase(url.getParameter(Constants.SERVER_KEY, "jetty"))) {
		ServletContext servletContext = BaseContext.CTX.getServletContext(url.getPort());
		if (servletContext == null) {
			throw new JahhanException("No servlet context found. Since you are using server='servlet', "
					+ "make sure that you've configured in web.xml");
		}
		String webappPath = servletContext.getContextPath();
		if (StringUtils.isNotEmpty(webappPath)) {
			webappPath = webappPath.substring(1);
			if (!contextPath.startsWith(webappPath)) {
				throw new JahhanException("Since you are using server='servlet', "
						+ "make sure that the 'contextpath' property starts with the path of external webapp");
			}
			contextPath = contextPath.substring(webappPath.length());
			if (contextPath.startsWith("/")) {
				contextPath = contextPath.substring(1);
			}
		}
	}

	final Class resourceDef = GetRestful.getRootResourceClass(implClass) != null ? implClass : type;

	server.deploy(resourceDef, impl, contextPath);

	final RestServer s = server;
	return new Runnable() {
		public void run() {
			// TODO due to dubbo's current architecture,
			// it will be called from registry protocol in the shutdown
			// process and won't appear in logs
			s.undeploy(resourceDef);
		}
	};
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:47,代码来源:RestProtocol.java


注:本文中的org.jboss.resteasy.util.GetRestful.getRootResourceClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。