私の目標は、Eclipse で Restful サービス Maven プロジェクトを作成することです。次に、バンドルとしてパッケージ化し、Fuse ESB karaf OSGi コンテナーにデプロイします。これまでのところ、私が知っているのは、JAX-RS API アノテーション @Path @GET の使用方法です。
package com.restfultest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path("/example")
public class ExampleService {
@GET
public String sayHello() {
return "Hello Restful service";
}
}
私の質問は次のとおりです。1.どのMavenアーキタイプを使用すればよいですか? maven-archetype-webapp またはクイックスタート?
2.アクティベーターの実装方法は?このような?
public class Activator implements BundleActivator {
private ServiceRegistration<?> registration;
public void start(BundleContext context) throws Exception {
// TODO Auto-generated method stub
ExampleService exampleService = new ExampleService();
registration = context.registerService( ExampleService.class.getName(), exampleService, null );
}
public void stop(BundleContext context) throws Exception {
// TODO Auto-generated method stub
registration.unregister();
}
}
3. サービスを登録して公開する方法 (エンドポイントのアドレスとポートを構成する方法など)?
私はosgiが初めてです。リソースや詳細なチュートリアルを提供してくれる人はいますか?