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-94f89814c4dfpull/2/head
parent
9b9432cbf4
commit
b3d9cf0f82
|
|
@ -42,6 +42,7 @@ import org.libreccm.theming.ThemeVersion;
|
||||||
import org.libreccm.theming.Themes;
|
import org.libreccm.theming.Themes;
|
||||||
import org.libreccm.webdav.ResponseStatus;
|
import org.libreccm.webdav.ResponseStatus;
|
||||||
import org.libreccm.webdav.methods.LOCK;
|
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.ActiveLock;
|
||||||
import org.libreccm.webdav.xml.elements.Collection;
|
import org.libreccm.webdav.xml.elements.Collection;
|
||||||
import org.libreccm.webdav.xml.elements.Depth;
|
import org.libreccm.webdav.xml.elements.Depth;
|
||||||
|
|
@ -66,6 +67,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.ws.rs.HeaderParam;
|
||||||
import javax.ws.rs.OPTIONS;
|
import javax.ws.rs.OPTIONS;
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
|
@ -131,7 +133,7 @@ public class ThemeFiles {
|
||||||
@LOCK
|
@LOCK
|
||||||
@Path("/{path}")
|
@Path("/{path}")
|
||||||
public Prop lock(@PathParam("theme")
|
public Prop lock(@PathParam("theme")
|
||||||
final String theme,
|
final String theme,
|
||||||
@PathParam("path")
|
@PathParam("path")
|
||||||
final String path,
|
final String path,
|
||||||
final LockInfo lockInfo) {
|
final LockInfo lockInfo) {
|
||||||
|
|
@ -139,7 +141,7 @@ public class ThemeFiles {
|
||||||
final String lockedPath = String.format("%s/path",
|
final String lockedPath = String.format("%s/path",
|
||||||
theme,
|
theme,
|
||||||
path);
|
path);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final String lockToken = lockManager.lockFile(lockedPath);
|
final String lockToken = lockManager.lockFile(lockedPath);
|
||||||
|
|
||||||
|
|
@ -227,6 +229,20 @@ public class ThemeFiles {
|
||||||
.build();
|
.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,
|
private WebDavResponse buildWebDavResponse(final ThemeFileInfo fileInfo,
|
||||||
final UriInfo uriInfo) {
|
final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue