Does anyone know how to set multiple request parameters in a REST web service? I am writing using java.My curl sample looks like this:
curl -X PUT http://localhost:8080/project/resources/user/directory/sub-directory?name=shareuser&type=Read -v
My program:
@PUT @Path("{user}/{directory:.+}") public Response doshare(@PathParam("user")String name, @PathParam("directory")String dir, @QueryParam("name")String sharename, @QueryParam("type")String type){ mongoDAOImpl impl=new mongoDAOImpl(); Mongo mongo=impl.getConnection("127.0.0.1","27017"); DB db=impl.getDataBase(mongo,"public"); DBCollection coll=impl.getColl(db,name); DBCollection coll2=impl.getColl(db,"sharedb"); shareDTO sharedto=new shareDTO(); String authority=type.toLowerCase(); if(authority.equals("rd")){ sharedto.setAuthority("4"); }else if(authority.equals("rw")){ sharedto.setAuthority("12"); } sharedto.setTargetuser(sharename); sharedto.setRealURI("/home/public/"+name+"/"+dir); sharedto.setIdentifier(name); sharedto.setParentURI("/home/public/"+sharename); boolean bool = false; sharefun=new sharefunction(); if(sharefun.checksubfoldershared(coll, coll2, sharedto)){ bool=sharefun.sharefiles(coll, coll2, sharedto); }else{ System.out.println("Error"); }
But I only get the name query parameter. How to get or how to enter curl command to get all query parameters?
source share