camel を使用して RESTfull Web サービスを公開したいと考えています。URI テンプレートを使用してサービス コントラクトを定義しました。URI テンプレートに基づいて、ServiceProcessor の関連するメソッドにリクエストをルーティングする方法を知りたいです。
例として、次の 2 つの操作を取り上げます。
@GET
@Path("/customers/{customerId}/")
public Customer loadCustomer(@PathParam("customerId") final String customerId){
return null;
}
@GET
@Path("/customers/{customerId}/accounts/")
List<Account> loadAccountsForCustomer(@PathParam("customerId") final String customerId){
return null;
}
以下は私が使用したルートです:
<osgi:camelContext xmlns="http://camel.apache.org/schema/spring">
<route trace="true" id="PaymentService">
<from uri="`enter code here`cxfrs://bean://customerCareServer" />
<process ref="customerCareProcessor" />
</route>
</osgi:camelContext>
uri ヘッダー (Exchange.HTTP_PATH) をサービス定義の既存のテンプレート uri に一致させる方法はありますか?
以下は、私のサービスのサービス契約です。
@Path("/customercare/")
public class CustomerCareService {
@POST
@Path("/customers/")
public void registerCustomer(final Customer customer){
}
@POST
@Path("/customers/{customerId}/accounts/")
public void registerAccount(@PathParam("customerId") final String customerId, final Account account){
}
@PUT
@Path("/customers/")
public void updateCustomer(final Customer customer){
}
@PUT
@Path("/accounts/")
public void updateAccount(final Account account){
}
@GET
@Path("/customers/{customerId}/")
public Customer loadCustomer(@PathParam("customerId") final String customerId){
return null;
}
@GET
@Path("/customers/{customerId}/accounts/")
List<Account> loadAccountsForCustomer(@PathParam("customerId") final String customerId){
return null;
}
@GET
@Path("/accounts/{accountNumber}")
Account loadAccount(@PathParam("accountNumber") final String accountNumber){
return null;
}
}