CcmNG: Implementation of unlock method for WebDAV access to theme files

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5451 8810af33-2d31-482b-a856-94f89814c4df
ccm-docs
jensp 2018-05-25 15:00:50 +00:00
parent e27bbad3a5
commit 0e0549335f
1 changed files with 18 additions and 2 deletions

View File

@ -42,6 +42,7 @@ import org.libreccm.theming.ThemeVersion;
import org.libreccm.theming.Themes;
import org.libreccm.webdav.ResponseStatus;
import org.libreccm.webdav.methods.LOCK;
import org.libreccm.webdav.methods.UNLOCK;
import org.libreccm.webdav.xml.elements.ActiveLock;
import org.libreccm.webdav.xml.elements.Collection;
import org.libreccm.webdav.xml.elements.Depth;
@ -66,6 +67,7 @@ import java.util.stream.Collectors;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.OPTIONS;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
@ -131,7 +133,7 @@ public class ThemeFiles {
@LOCK
@Path("/{path}")
public Prop lock(@PathParam("theme")
final String theme,
final String theme,
@PathParam("path")
final String path,
final LockInfo lockInfo) {
@ -139,7 +141,7 @@ public class ThemeFiles {
final String lockedPath = String.format("%s/path",
theme,
path);
try {
final String lockToken = lockManager.lockFile(lockedPath);
@ -227,6 +229,20 @@ public class ThemeFiles {
.build();
}
@UNLOCK
@Path("/{path}")
public Response unlock(
@PathParam("theme")
final String theme,
@PathParam("path")
final String path,
@HeaderParam("Lock-Tocken") final String lockToken) {
lockManager.unlock(lockToken);
return Response.status(Response.Status.NO_CONTENT).build();
}
private WebDavResponse buildWebDavResponse(final ThemeFileInfo fileInfo,
final UriInfo uriInfo) {