使用嵌入式Jetty 7发布JAX-WS端点 [英] Publish JAX-WS endpoint with embedded Jetty 7

查看:195
本文介绍了使用嵌入式Jetty 7发布JAX-WS端点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮忙吗?

我想使用嵌入式Jetty 7作为端点。这就是我试过的:

I want to use an embedded Jetty 7 as Endpoint. This is what I tried:

public class MiniTestJetty {

@WebService(targetNamespace = "http")
public static class Calculator {

    @Resource
    WebServiceContext context;

    public int add(int a, int b) {
        return a + b;
    }
}


public static void main(String[] args) throws Exception {
    int port = 8080;
    Server server = new Server(port);

    Calculator calculator = new Calculator();
    Endpoint.publish("http://localhost:" + port + "/calc", calculator);

    server.start();
    server.join();
}

}

但我无法确定这是否真的使用Jetty而不是默认的sun HttpServer。

But I cannot see whether this really uses Jetty instead of the default sun HttpServer.

提到的一个博客

 System.setProperty("com.sun.net.httpserver.HttpServerProvider",
       "org.mortbay.jetty.j2se6.JettyHttpServerProvider");

但Jetty 7中似乎没有这样的HttpServerProvider。

But there doesn't seems to be such HttpServerProvider in Jetty 7.

感谢任何帮助,Axel。

Thanks for any help, Axel.

推荐答案

所有必要的东西似乎都是

All what is necessary seems to be

System.setProperty("com.sun.net.httpserver.HttpServerProvider", "org.mortbay.jetty.j2se6.JettyHttpServerProvider");

来自jetty-contrib / org / mortgay / jetty / j2se6的当前贡献代码尚未准备就绪Jetty 7.就是这样。

The current contrib code from jetty-contrib/org/mortgay/jetty/j2se6 is not ready yet for Jetty 7. That's all.

这篇关于使用嵌入式Jetty 7发布JAX-WS端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆