开发者

Can we send or return char in java webservices using JAX-RS

开发者 https://www.devze.com 2023-04-07 13:48 出处:网络
I am new to webservices. I have some services which accept char as input parameter e.g char langPref etc.

I am new to webservices. I have some services which accept char as input parameter e.g char langPref etc. When I am trying to expose that service it is t开发者_运维技巧hrowing an exception. Can we send or return char in web services ?


Try to set an @Produces("text/plain") and return a String (cast from your char)

Likewise, an @Consumes should do the same trick for input.

(Having said that, you should probably emphasize the payload more. Just having chars as input/output is an indicator that your resource design is flawed)

0

精彩评论

暂无评论...
验证码 换一张
取 消