Hi All,
I have the following resources:
//the service class:
@ConsumeMime("text/xml")
@ProduceMime("text/xml")
public class AccountService{
@GET
@Path("/Account/{uniqueId}")
public Account get(
@PathParam("uniqueId")
long uniqueId
) {
//do something here and return the Account object
}
}
//the account class
@XmlType(name="Account")
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlRootElement(name="Account")
public class Account {
private String accountID = ""
@Path("accountID")
public String getAccountID() {
return accountID;
}
public void setAccountID(String accountID) {
this.accountID = accountID;
}
}
beans.xml having the following configuration for the service instance:
<jaxrs:server id="accountRestService" address="/rest/Accounts">
<jaxrs:serviceBeans>
<ref bean="AccountService" />
</jaxrs:serviceBeans>
</jaxrs:server>
Now, accessing the method that returns an Account object works fine,
i.e. access to http://localhost:8080/rest/Accounts/Account/1 responds
with the xml representation of the Account object.
However, I was hoping to take advantage of Sub-resource locators as
mentioned in http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html . When
I try accessing
http://localhost:8080/rest/Accounts/Account/1/accountID , I end up
getting a 'No operation matching request'. I'm thinking this might be
caused by the fact that the said method does not take any parameters? or
that I have JAX-WS annotations at class level for the Account class?
Gabo Manuel