且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Jersey客户端API问题

更新时间:2022-06-24 21:55:45

我也是新泽西新手,但我认为您的帖子code不工作的原因是FORMDATA必须在类型中的一种认可。我不完全确定的类型和在这个环境中接受命令的区别,但我pretty的肯定FORMDATA必须是你调用构建器支持的类型之一。例如。如果序列FORMDATA作为一个JSON对象,并设置类型/接受JSON那么这个code会工作。由于这是它可能是调用一些bodymethodwriter以连载它变成一个可以接受的类型,但FORMDATA可是没有一个,这样的方法调用返回null。事实上,它看起来像它调用的valueOf尝试获取数据出来FORMDATA的序列化,但返回null。

I am also a Jersey newbie, but I think that the reason your post code does not work is that formData must be in one of the types accepted. I'm not totally sure on the difference between the type and the accept commands in this contexts, but I am pretty sure that formData must be of one of the types that your invocation builder supports. E.g. if you serialised formData as a JSON object and set type/accept to JSON then this code would work. As it is it is probably calling some bodymethodwriter to serialise it into an acceptable type but formData doesnt have one so the method call returns null. In fact, it looks like its calling ValueOf to try to obtain the data out of formData for serialisation, but that returns null.