Sub resource java rest web service

Posted: April 28, 2014 in web
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.UriInfo;

@Path("/generic")
public class GenericResource {

    @Context
    private UriInfo context;

    public GenericResource() {
    }
    //http://localhost:8080/mavenproject2/webresources/generic
    @GET
    //@Produces("application/pdf")
    public Response getJson() throws IOException, DocumentException {
...
        return Response.ok(out.toByteArray()).type("application/pdf").build();
    }
    //http://localhost:8080/mavenproject2/webresources/generic/sub1
    @GET
    @Path("sub1")
public Response getTemp() throws IOException, DocumentException {
        ....
        return Response.ok(out.toByteArray()).type("application/pdf").build();
    }
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s