In my gwt application, I've implemented this method:
@Service("carService")
@Path("/cars")
@Scope("request")
public class CarServiceImpl implements CarService {
@Autowired
private CarDAO carDAO;
@Override
@GET @Path("{type}/{start}/{end}")
@Produces({MediaType.APPLICATION_XML})
public List<Car> findByType(@PathParam("type") CarType type,
@PathParam("start") Date start,
@PathParam("end") Date end) {
return carDAO.findByType(type, start, end);
}
where findByType is a method in the carDAO asking to databases (in a peer-to-peer architecture where each host of this application has got its own database) for available cars to rent. Now I have to implement its rest client and I have:
package it.unibo.ronf.server.rest;
import java.util.Date;
import java.util.List;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;
import it.unibo.ronf.shared.entities.Car;
import it.unibo.ronf.shared.entities.CarType;
public class ClientRestCars {
public List<Car> findAvailableCar(CarType type, Date start, Date end) {
Client client = Client.create();
WebResource webResource = client
.resource("http://localhost:8080/RONF/rest/cars");
}
}
and I don't know how to go on, how to pass the parameters to the url and get the list of cars as results. How can I write the request and pass those parameters (which are not primitive but classes) to the jersey request? Can help?
--
You received this message because you are subscribed to the Google Groups "vogella" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vogella+u...@googlegroups.com.
To post to this group, send email to vog...@googlegroups.com.
Visit this group at http://groups.google.com/group/vogella?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.