// -------------------------------------------------------------- Constants
- private static final String METHOD_HEAD = "HEAD";
private static final String METHOD_PROPFIND = "PROPFIND";
private static final String METHOD_PROPPATCH = "PROPPATCH";
private static final String METHOD_MKCOL = "MKCOL";
int slash = path.lastIndexOf('/');
if (slash != -1) {
String parentPath = path.substring(0, slash);
- Vector currentLockNullResources =
- (Vector) lockNullResources.get(parentPath);
+ Vector<String> currentLockNullResources =
+ lockNullResources.get(parentPath);
if (currentLockNullResources != null) {
- Enumeration lockNullResourcesList =
+ Enumeration<String> lockNullResourcesList =
currentLockNullResources.elements();
while (lockNullResourcesList.hasMoreElements()) {
String lockNullPath = (String)
if ((object instanceof DirContext) && (depth > 0)) {
try {
- NamingEnumeration enumeration = resources.list(currentPath);
+ NamingEnumeration<NameClassPair> enumeration =
+ resources.list(currentPath);
while (enumeration.hasMoreElements()) {
NameClassPair ncPair =
(NameClassPair) enumeration.nextElement();
if (lockPath.endsWith("/"))
lockPath =
lockPath.substring(0, lockPath.length() - 1);
- Vector currentLockNullResources =
- (Vector) lockNullResources.get(lockPath);
+ Vector<String> currentLockNullResources =
+ lockNullResources.get(lockPath);
if (currentLockNullResources != null) {
- Enumeration lockNullResourcesList =
+ Enumeration<String> lockNullResourcesList =
currentLockNullResources.elements();
while (lockNullResourcesList.hasMoreElements()) {
String lockNullPath = (String)
}
boolean exists = true;
- Object object = null;
try {
- object = resources.lookup(path);
+ resources.lookup(path);
} catch (NamingException e) {
exists = false;
}
if (req.getInputStream().available() > 0) {
DocumentBuilder documentBuilder = getDocumentBuilder();
try {
- Document document = documentBuilder.parse
- (new InputSource(req.getInputStream()));
+ // Document document =
+ documentBuilder.parse(new InputSource(req.getInputStream()));
// TODO : Process this request body
resp.sendError(WebdavStatus.SC_NOT_IMPLEMENTED);
return;
exists = false;
}
- Enumeration locksList = null;
+ Enumeration<LockInfo> locksList = null;
if (lockRequestType == LOCK_CREATION) {
// One of the child paths was locked
// We generate a multistatus error report
- Enumeration lockPathsList = lockPaths.elements();
+ Enumeration<String> lockPathsList = lockPaths.elements();
resp.setStatus(WebdavStatus.SC_CONFLICT);
// Checking resource locks
LockInfo toRenew = (LockInfo) resourceLocks.get(path);
- Enumeration tokenList = null;
+ Enumeration<String> tokenList = null;
if (lock != null) {
// At least one of the tokens of the locks must have been given
// Checking inheritable collection locks
- Enumeration collectionLocksList = collectionLocks.elements();
+ Enumeration<LockInfo> collectionLocksList =
+ collectionLocks.elements();
while (collectionLocksList.hasMoreElements()) {
toRenew = (LockInfo) collectionLocksList.nextElement();
if (path.equals(toRenew.path)) {
// Checking resource locks
LockInfo lock = (LockInfo) resourceLocks.get(path);
- Enumeration tokenList = null;
+ Enumeration<String> tokenList = null;
if (lock != null) {
// At least one of the tokens of the locks must have been given
// Checking inheritable collection locks
- Enumeration collectionLocksList = collectionLocks.elements();
+ Enumeration<LockInfo> collectionLocksList = collectionLocks.elements();
while (collectionLocksList.hasMoreElements()) {
lock = (LockInfo) collectionLocksList.nextElement();
if (path.equals(lock.path)) {
// Checking resource locks
LockInfo lock = (LockInfo) resourceLocks.get(path);
- Enumeration tokenList = null;
+ Enumeration<String> tokenList = null;
if ((lock != null) && (lock.hasExpired())) {
resourceLocks.remove(path);
} else if (lock != null) {
// Checking inheritable collection locks
- Enumeration collectionLocksList = collectionLocks.elements();
+ Enumeration<LockInfo> collectionLocksList = collectionLocks.elements();
while (collectionLocksList.hasMoreElements()) {
lock = (LockInfo) collectionLocksList.nextElement();
if (lock.hasExpired()) {
}
try {
- NamingEnumeration enumeration = resources.list(source);
+ NamingEnumeration<NameClassPair> enumeration =
+ resources.list(source);
while (enumeration.hasMoreElements()) {
NameClassPair ncPair = (NameClassPair) enumeration.nextElement();
String childDest = dest;
if (lockTokenHeader == null)
lockTokenHeader = "";
- Enumeration enumeration = null;
+ Enumeration<NameClassPair> enumeration = null;
try {
enumeration = resources.list(path);
} catch (NamingException e) {
* @param errorList List of error to be displayed
*/
private void sendReport(HttpServletRequest req, HttpServletResponse resp,
- Hashtable errorList)
+ Hashtable<String,Integer> errorList)
throws ServletException, IOException {
resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
+ generateNamespaceDeclarations(),
XMLWriter.OPENING);
- Enumeration pathList = errorList.keys();
+ Enumeration<String> pathList = errorList.keys();
while (pathList.hasMoreElements()) {
String errorPath = (String) pathList.nextElement();
generatedXML.writeElement(null, "status", XMLWriter.CLOSING);
generatedXML.writeElement(null, "propstat", XMLWriter.CLOSING);
- Enumeration propertiesNotFoundList = propertiesNotFound.elements();
+ Enumeration<String> propertiesNotFoundList =
+ propertiesNotFound.elements();
if (propertiesNotFoundList.hasMoreElements()) {
private void parseLockNullProperties(HttpServletRequest req,
XMLWriter generatedXML,
String path, int type,
- Vector propertiesVector) {
+ Vector<String> propertiesVector) {
// Exclude any resource in the /WEB-INF and /META-INF subdirectories
// (the "toUpperCase()" avoids problems on Windows systems)
generatedXML.writeElement(null, "propstat", XMLWriter.OPENING);
generatedXML.writeElement(null, "prop", XMLWriter.OPENING);
- Enumeration properties = propertiesVector.elements();
+ Enumeration<String> properties = propertiesVector.elements();
while (properties.hasMoreElements()) {
generatedXML.writeElement(null, "status", XMLWriter.CLOSING);
generatedXML.writeElement(null, "propstat", XMLWriter.CLOSING);
- Enumeration propertiesNotFoundList = propertiesNotFound.elements();
+ Enumeration<String> propertiesNotFoundList = propertiesNotFound.elements();
if (propertiesNotFoundList.hasMoreElements()) {
(String path, XMLWriter generatedXML) {
LockInfo resourceLock = (LockInfo) resourceLocks.get(path);
- Enumeration collectionLocksList = collectionLocks.elements();
+ Enumeration<LockInfo> collectionLocksList = collectionLocks.elements();
boolean wroteStart = false;
result += "Owner:" + owner + "\n";
result += "Expiration:"
+ FastHttpDateFormat.formatDate(expiresAt, null) + "\n";
- Enumeration tokensList = tokens.elements();
+ Enumeration<String> tokensList = tokens.elements();
while (tokensList.hasMoreElements()) {
result += "Token:" + tokensList.nextElement() + "\n";
}
generatedXML.writeElement(null, "timeout", XMLWriter.CLOSING);
generatedXML.writeElement(null, "locktoken", XMLWriter.OPENING);
- Enumeration tokensList = tokens.elements();
+ Enumeration<String> tokensList = tokens.elements();
while (tokensList.hasMoreElements()) {
generatedXML.writeElement(null, "href", XMLWriter.OPENING);
generatedXML.writeText("opaquelocktoken:"