public void put() throws IOException {
java.io.File file = getFilesystem().getFileHandle(getUser(), getPath());
SessionTracker tracker = getSessionTracker();
synchronized (tracker) {
EditSession session = tracker.getSession(file, getUser());
// check if the lastEdit parameter was sent
String lastEdit = getCtx().getReq().getParameter("lastEdit");
if (StringUtils.isNumeric(lastEdit) && StringUtils.isNotBlank(lastEdit)) {
// verify that the user has a session open
if ((session == null) || (session.getEditMode() != EditMode.ReadWrite)) {
getCtx().getResp().sendError(400, "File not open for read/write access");
return;
}
session.setLastEditBeforeSave(Integer.parseInt(lastEdit));
} else {
// TODO: We may not be in a collaborate mode, but still want to save back
// if ((session != null) && (session.getEditMode() == EditMode.ReadWrite)) {
// getCtx().getResp().sendError(400, "File open for read/write access; could not save without lastEdit parameter");
// return;