[英]Send java object to a rest WebService
I'm searching a nice way to send a java object to my rest web service. 我正在寻找一种将java对象发送到我的其余Web服务的好方法。
It's possible or not ? 这可能与否?
For sample I wan't to send an "User" Object to my rest : 对于示例,我不想向我的其余部分发送“用户”对象:
public Class User{
private String name;
private String surname;
public getName(){
return name;
}
public setName(String name){
[...]
}
It's possible to generate AUTOMATICALY this kind of Rest ? 有可能生成AUTOMATICALY这种休息吗?
www.foo.com/createUser/name="foo"&surname="foo" www.foo.com/createUser/name="foo"&surname="foo”
I would consider using a JSON representation for this kind of Java objects. 我会考虑为这种Java对象使用JSON表示。 I prefer the Jersey implementation of JAX-RS and it has built-in support for JSON serialization over JAXB.
我更喜欢JAX-RS的Jersey实现,它内置了对JAXB的JSON序列化支持。
Hope this helps... 希望这可以帮助...
It's possible to generate AUTOMATICALY this kind of Rest ?
有可能生成AUTOMATICALY这种休息吗? www.foo.com/createUser/name="foo"&surname="foo"
www.foo.com/createUser/name="foo"&surname="foo”
That's NOT REST. 那不是休息。 That's RPC .
这是RPC 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.