Package com.sun.jersey.samples.optimisticconcurrency

Examples of com.sun.jersey.samples.optimisticconcurrency.ItemData


    }
   
    @GET
    @Produces("application/xml")
    public Item get() {
        ItemData id = ItemData.ITEM;
        String version = null;
        MediaType mediaType = null;
        synchronized (id) {
            version = id.getVersionAsString();
            mediaType = id.getMediaType();
        }
       
        UriBuilder ub = uriInfo.getAbsolutePathBuilder().path("content");
        return new Item(
                ub.build(),
View Full Code Here


*/
public class ItemContentResource {
   
    @GET
    public Response get() {
        ItemData id = ItemData.ITEM;
        MediaType mediaType = null;
        byte[] content = null;
        synchronized (id) {
            mediaType = id.getMediaType();
            content = id.getContent();
        }
       
        return Response.ok(content, mediaType).build();
    }
View Full Code Here

    @Path("{version}")
    public void put(
            @PathParam("version") int version,
            @Context HttpHeaders headers,
            byte[] in) {
        ItemData id = ItemData.ITEM;
        synchronized (id) {
            int currentVersion = id.getVersion();
            if (currentVersion > version) {
                throw new ConflictException("Conflict");
            }
            id.update(headers.getMediaType(), in);
        }
       
    }   
View Full Code Here

TOP

Related Classes of com.sun.jersey.samples.optimisticconcurrency.ItemData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.