Я хочу открыть веб-сервис RESTfull с помощью верблюда. Я использовал шаблоны URI для определения моих контрактов на обслуживание. Я хочу знать, как мне направлять запросы к соответствующему методу моего ServiceProcessor на основе шаблона URI.Рекомендации лучших верблюдов для веб-сервиса RESTfull
В качестве примера возьмем следующие две операции:
@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;
}
}
спасибо Александру !!! – Dilunika