0

My web service is in Net Beans and i want to pass dynamic values to method from Android studio

My json url is :

http://192.168.1.31:8084/adminWebservice/mywebservice/ShowSelectedCategory/Bar

My webservice class is:

@GET
@Path("/ShowSelectedCategory/{strRestroTypes}")
@Produces(MediaType.APPLICATION_JSON)
public List<CategoryTypes> ShowSelectedCategory(@PathParam("strRestroTypes")String[] strRestroTypes)
{
}

My entity file contains

@XmlRootElement(name="restaurant")
@XmlType(propOrder = {"restroid","restroname"})
public class RestaurantTypes {

    private int restroid;
    private String restroname;

   //getter and setter   
}

Through this code I can only pass one parameter, and not more than that Thanks in advance for help and suggestions

Shruti
  • 391
  • 1
  • 5
  • 21
  • Why do you need more than a single value? What do you expect the path segment value to be? Maybe you want to instead work with [matrix params or query params](http://stackoverflow.com/a/26993356/2587435) – Paul Samsotha Apr 01 '15 at 12:18
  • Data flow : When user select multiple Restaurant types, based on that Categories will be fetched and shown to Android interface. – Shruti Apr 01 '15 at 12:23
  • Use query params. `/ShowSelectedCategory?type=bar&type=whatever`. Then use `@QueryParam("type") List types`. You _could_ use `/ShowSelectedCategory?type=bar,whatever`, but then you need to parse the String value yourself. What you don't want to do is `/ShowSelectedCategory/bar/whatever`. – Paul Samsotha Apr 01 '15 at 12:26
  • ok, I will try this and let u know, thanks – Shruti Apr 01 '15 at 12:30

0 Answers0