My reading of the spec is that REST implementors must implement
application/x-www-form-urlencoded and so I was expecting with the
appropriate @Consumes this HTML Form would POST something Wink could process

<form method="post" action="/LibraryWink/library/editions" 
enctype="application/x-www-form-urlencoded">

The Wink method being

        @POST
        @Consumes({MediaType.APPLICATION_FORM_URLENCODED,
MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
        @Produces(MediaType.APPLICATION_JSON)
        public BookEdition addNewEdition(BookEdition edition) {
                System.out.println("Adding " + edition);
                // etc.
        }

Using the Firefox Poster plugin I've verified that the
MediaType.APPLICATION_XMLworks fine. But when I post my form I get:

[03/12/09 13:26:08:296 GMT] 00000024 RequestProces I
org.apache.wink.server.internal.RequestProcessor logException
WebApplicationException (415 - Unsupported Media Type) occured during the
handlers chain invocation
                                 javax.ws.rs.WebApplicationException
        at
org.apache.wink.server.internal.registry.ServerInjectableFactory$EntityParam.getValue(ServerInjectableFactory.java:200)
        at
org.apache.wink.common.internal.registry.InjectableFactory.instantiate(InjectableFactory.java:67)
        at
org.apache.wink.server.internal.handlers.CreateInvocationParametersHandler.handleRequest(CreateInvocationParametersHandler.java:44)
        at
org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
        at
org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
        at
org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:61)
        at
org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleResourceMethod(FindResourceMethodHandler.java:146)
        at
org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleRequest(FindResourceMethodHandler.java:66)

So I guess that there's some piece of config I need to do to enable this
MediaType. My starting point is the SimpleDefects Wink example, which has
only a very simple config listing an Application. I'm guessing I need to add
some more handlers but I'm not clear what I need to do to make that happen.

-- 
View this message in context: 
http://n2.nabble.com/POSTing-from-a-Form-tp4148475p4148475.html
Sent from the Apache Wink Users mailing list archive at Nabble.com.

Reply via email to