Hi Scott,
You can absolutely do what your asking.
First, for your MyBean, you want to look into creating custom Providers. You
can create a custom provider for MyBean that is created from the request body.
You should be able to find that documentation wth some google searches. You can
also use the @HeaderParam annotation to get your header values.
You can reasonably have a classes such as:
@Path(“/test")
public class MyService {
@GET
@Consumes(MediaType.APPLICATION_JSON)
public String get(MyBean bean, @HeaderParam("Referer") String referer) {
...
}
}
@Provider
@Consumes(MediaType.APPLICATION_JSON)
public final class MyBeanProvider implements MessageBodyReader<MyBean>{
@Override
public MyBean readFrom(Class<MyBean> type, Type genericType,
Annotation[] annotations,
MediaType mediaType, MultivaluedMap<String, String>
headers, InputStream inputStream) throws IOException {
//Code to build and return MyBean using request input stream
}
@Override
public boolean isReadable(Class<?> type, Type genericType, Annotation[]
annotations, MediaType mediaType) {
return true;
}
@Override
public long getSize(ANFRestResource instance, Class<?> type, Type
genericType, Annotation[] annotations,
MediaType mediaType) {
return -1;
}
}
Cheers
Darin
> On Mar 24, 2016, at 10:31 AM, Scott McMasters <[email protected]>
> wrote:
>
> Hello, all,
>
> Is there any way to have Wink automatically create an instance of a POJO and
> copy HTTP request parameter values, say, via BeanUtils, to a service method
> parameter?
>
> I'm thinking of something like this:
>
> @POST
> public void save(MyBean bean)
> {
> }
>
> Thanks,
>
> Scott McMasters
>