* javax.servlet.http.HttpServlet#doPut(javax.servlet.http.HttpServletRequest
* , javax.servlet.http.HttpServletResponse)
*/
@Override
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
IUser user = null;
try {
user = ServerManager.getServerManager().getUserManager().getUser(req);
if(user==null){
resp.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
String path = getPathInfo(req);
if (path == null) {
theLogger.warning("DavinciPageServlet:doPut getPathInfo returned Null for user: " + user.getUserID());
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
boolean isWorkingCopy = (path.indexOf(IDavinciServerConstants.WORKING_COPY_EXTENSION) > -1);
if ( isWorkingCopy ) {
path = path.substring(0, path.indexOf(IDavinciServerConstants.WORKING_COPY_EXTENSION));
}
IVResource file = user.getResource(path);
if (file == null) {
theLogger.warning("DavinciPageServlet:doPut user.getResource("+path+") returned Null for user: " + user.getUserID());
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
/* user is trying to save over a library path */
if ( file.isVirtual() ) {
file = user.createResource(path, file.isDirectory());
if(file.isDirectory())
file.mkdir();
else
file.createNewInstance();
}