001package co.codewizards.cloudstore.rest.server.service; 002 003import static co.codewizards.cloudstore.core.util.Util.*; 004 005import javax.ws.rs.Consumes; 006import javax.ws.rs.POST; 007import javax.ws.rs.Path; 008import javax.ws.rs.PathParam; 009import javax.ws.rs.Produces; 010import javax.ws.rs.core.MediaType; 011 012import org.slf4j.Logger; 013import org.slf4j.LoggerFactory; 014 015import co.codewizards.cloudstore.core.repo.transport.RepoTransport; 016 017@Path("_beginPutFile/{repositoryName}") 018@Consumes(MediaType.APPLICATION_XML) 019@Produces(MediaType.APPLICATION_XML) 020public class BeginPutFileService extends AbstractServiceWithRepoToRepoAuth 021{ 022 private static final Logger logger = LoggerFactory.getLogger(BeginPutFileService.class); 023 024 { 025 logger.debug("<init>: created new instance"); 026 } 027 028 @POST 029 @Path("{path:.*}") 030 public void beginPutFile(@PathParam("path") String path) 031 { 032 assertNotNull("path", path); 033 RepoTransport repoTransport = authenticateAndCreateLocalRepoTransport(); 034 try { 035 path = repoTransport.unprefixPath(path); 036 repoTransport.beginPutFile(path); 037 } finally { 038 repoTransport.close(); 039 } 040 } 041}