我有两个数组参数和对象数组,我想传递它们
我可以使用这样的方法吗?
@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 reportHTTP 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