package com.sun.ws.rest.samples.atomserver.resources; import com.sun.ws.rest.api.ConsumeMime; import com.sun.ws.rest.api.HttpMethod; import com.sun.ws.rest.api.ProduceMime; import com.sun.ws.rest.api.UriParam; import com.sun.ws.rest.api.UriTemplate; import com.sun.ws.rest.api.representation.Representation; import java.io.InputStream; /** * * @author Paul.Sandoz@Sun.Com */ @UriTemplate("{entry}") @ConsumeMime("application/atom+xml") @ProduceMime("application/atom+xml") public class EntryResource { @HttpMethod public InputStream getEntry(@UriParam("entry") String entryId) { String entryPath = FileHelper.getEntryPath(entryId); FileHelper.checkExistence(entryPath); return FileStore.FS.getFileContents(entryPath); } @HttpMethod @UriTemplate("media") @ProduceMime("*/*") public Representation getMedia(@UriParam("entry") String entryId) { String mediaPath = FileHelper.getMediaPath(entryId); FileHelper.checkExistence(mediaPath); InputStream in = FileStore.FS.getFileContents(mediaPath); // TODO set the content type return new Representation(in); } }