vlingo / xoom-http

The VLINGO XOOM platform SDK for Reactive, scalable, high-throughput, and resilient HTTP server supporting RESTful services running on XOOM LATTICE and XOOM ACTORS.
https://vlingo.io
Mozilla Public License 2.0
52 stars 16 forks source link

Content-Type text/plain is not supported #49

Closed wwerner closed 3 years ago

wwerner commented 5 years ago

Sending a POST/PUT/PATCH request w/ Content-Type: text/plain leads to

io.vlingo.http.resource.MediaTypeNotSupportedException: No mapper registered for the following media mimeType: text/plain
    at io.vlingo.http.resource.MediaTypeMapper.from(MediaTypeMapper.java:20) ~[classes/:na]
    at io.vlingo.http.resource.ParameterResolver.lambda$body$2(ParameterResolver.java:46) ~[classes/:na]
    at io.vlingo.http.resource.ParameterResolver.apply(ParameterResolver.java:91) ~[classes/:na]
    at io.vlingo.http.resource.RequestHandler6.execute(RequestHandler6.java:115) ~[classes/:na]
    at io.vlingo.http.resource.ResourceRequestHandlerActor.lambda$handleFor$0(ResourceRequestHandlerActor.java:44) ~[classes/:na]
    at io.vlingo.http.resource.ResourceRequestHandlerActor.handleFor(ResourceRequestHandlerActor.java:30) ~[classes/:na]
    at io.vlingo.http.resource.ResourceRequestHandlerActor.handleFor(ResourceRequestHandlerActor.java:47) ~[classes/:na]
    at io.vlingo.http.resource.ResourceRequestHandler__Proxy.lambda$handleFor$1(ResourceRequestHandler__Proxy.java:47) ~[classes/:na]
    at io.vlingo.actors.LocalMessage.internalDeliver(LocalMessage.java:115) ~[classes/:na]
    at io.vlingo.actors.LocalMessage.deliver(LocalMessage.java:47) ~[classes/:na]
    at io.vlingo.actors.plugin.mailbox.concurrentqueue.ConcurrentQueueMailbox.run(ConcurrentQueueMailbox.java:101) ~[classes/:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_212]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_212]
    at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_212]
bwehrle commented 3 years ago

Hi @wwerner You are trying to POST plain/text to a method I see. I don't think this is going to be widely used. So, would you be ok with adding this mapper yourself to your handler methods as the Mapper, or setting up DefaultMediaTypeMapper (the instance is not final). If you can make a case that this will be frequently used, then happy to add it into the DefaultTypeMapper. -Brian

bwehrle commented 3 years ago

Raised changes in PR https://github.com/vlingo/vlingo-http/pull/80

bwehrle commented 3 years ago

Closing this as I think its now supported, albeit not without setting up the DefaultMediaTypeMapper as I state above.