java post 多个参数_java – 如何使用http post将多个参数传递给restful webservice

我有两个数组参数和对象数组,我想传递它们

我可以使用这样的方法吗?

@POST

@Path("Test3")

@Produces("text/plain")

@Consumes({"application/json"})

public String Test3(String[] id1,String[] id2 ,Object [] oo) {

String result = "Hello ";

....

....

return result;

}

什么是我应该传递给这个方法的相应的json

我尝试了很多jsons,我总是得到这样的错误

GlassFish Server Open Source Edition 4.0 - Error report

HTTP Status 500 - Internal Server Error


type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet entities.service.ApplicationConfig threw exception

root cause

org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.

[[FATAL] Method public java.lang.String entities.service.ItemFacadeREST.Test3(java.lang.String,java.lang.String) on resource class entities.service.ItemFacadeREST contains multiple parameters with no annotation. Unable to resolve the injection source.; source='ResourceMethod{httpMethod=POST, consumedTypes=[application/json], producedTypes=[text/plain], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=MethodHandler{handlerClass=class entities.service.ItemFacadeREST, handlerConstructors=[org.glassfish.jersey.server.model.HandlerConstructor@cdf30b]}, handlingMethod=public java.lang.String entities.service.ItemFacadeREST.Test3(java.lang.String,java.lang.String), parameters=[Parameter [type=class java.lang.String, source=null, defaultValue=null], Parameter [type=class java.lang.String, source=null, defaultValue=null]], responseType=class java.lang.String}, nameBindings=[]}']

note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.0 logs.


GlassFish Server Open Source Edition 4.0

注意 :

我想从Android调用http post

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值