Well, if i understood what is OP asking for, the simplest way for me to do this is use JAX-RS, aka Java API for RESTful Web Services
Here is the JAX-RS oracle tutorial: http://docs.oracle.com/javaee/6/tutorial/doc/giepu.html
And here is an example service class for your example URL:
@Path("/")
public class testClass {
@GET
@Path("/{id}/")
@Produces(MediaType.APPLICATION_JSON)
public Response testMethod(@PathParam(value = "id") String id) {
return Response.ok().entity("HELLO! You sent me this id: " + id).build();
}
}
Assuming that /urltest
is the path configured for your base url, this service will be invoked with the following URL:
http://sample.com/urltest/23423ea342
and the "23423ea342" will be your {id}
parameter for your service