Search in sources :

Example 6 with Container

use of com.sun.jersey.samples.storageservice.Container in project enunciate by stoicflame.

the class ContainerResource method getContainer.

@GET
public Container getContainer(@QueryParam("search") String search) {
    System.out.println("GET CONTAINER " + container + ", search = " + search);
    Container c = MemoryStore.MS.getContainer(container);
    if (c == null)
        throw new NotFoundException("Container not found");
    if (search != null) {
        c = c.clone();
        Iterator<Item> i = c.getItem().iterator();
        byte[] searchBytes = search.getBytes();
        while (i.hasNext()) {
            if (!match(searchBytes, container, i.next().getName()))
                i.remove();
        }
    }
    return c;
}
Also used : Item(com.sun.jersey.samples.storageservice.Item) Container(com.sun.jersey.samples.storageservice.Container)

Aggregations

Container (com.sun.jersey.samples.storageservice.Container)6 Response (javax.ws.rs.core.Response)4 Containers (com.sun.jersey.samples.storageservice.Containers)2 Item (com.sun.jersey.samples.storageservice.Item)2 URI (java.net.URI)2 WebTarget (javax.ws.rs.client.WebTarget)2 TypeHint (com.webcohesion.enunciate.metadata.rs.TypeHint)1 GregorianCalendar (java.util.GregorianCalendar)1 NotFoundException (javax.ws.rs.NotFoundException)1 PUT (javax.ws.rs.PUT)1 MediaType (javax.ws.rs.core.MediaType)1