I would like to have a following code:
@POST
@Path("path")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
public String doSomething(String body, CustomObject o) {
return o.getText();
}
Simply put, a POST method that takes string request body (mapped to the first argument) and responds with a string response, based on a CustomObject in parameters. The custom object value is provided via ValueFactoryProvider
- basically the value is populated in filter.
However, I am not able to call the resource - I get:
java.lang.IllegalStateException: The resource configuration
is not modifiable in this context.
Can you point me in the right direction? Thank you.
Note: This type of code is currently used in our Spring implementation (Spring smartly maps everything), we are currently working on Java EE version and we would like to have similar API.