8

誰かがこれを手伝ってくれる?

組み込みのJetty7をエンドポイントとして使用したい。これは私が試したものです:

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();
}

}

しかし、これがデフォルトのsunHttpServerの代わりにJettyを実際に使用しているかどうかはわかりません。

言及された1つのブログ

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

しかし、Jetty7にはそのようなHttpServerProviderはないようです。

助けてくれてありがとう、アクセル。

4

3 に答える 3

4

必要なものはすべてそうです

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

jetty-contrib/org/mortgay/jetty/j2se6 からの現在の contrib コードは、まだ Jetty 7 用の準備ができていません。それだけです。

于 2009-10-29T20:12:16.170 に答える
3

FirefoxでWSDLのURLを開き、Firebugで応答ヘッダーを確認するだけです。次のようなものを取得する必要があります。

HTTP/1.1 200 OK
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Server: Jetty(7.1.2.v20100523)
于 2010-05-26T16:43:51.130 に答える
2

クラスの名前が次のように変更されました

org.eclipse.jetty.http.spi.JettyHttpServerProvider

そして、 http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.0.6.v20130930/から取得しました:

Java 7 用の
V9.0.6 V9.3.2 は Java 8 用です

于 2015-09-09T09:58:07.927 に答える