Lines 72-78
Link Here
|
72 |
import java.util.Date; |
72 |
import java.util.Date; |
73 |
import java.util.Enumeration; |
73 |
import java.util.Enumeration; |
74 |
import java.util.Hashtable; |
74 |
import java.util.Hashtable; |
75 |
import java.util.Locale; |
|
|
76 |
import java.util.Stack; |
75 |
import java.util.Stack; |
77 |
import java.util.TimeZone; |
76 |
import java.util.TimeZone; |
78 |
import java.util.Vector; |
77 |
import java.util.Vector; |
Lines 98-103
Link Here
|
98 |
import org.w3c.dom.Node; |
97 |
import org.w3c.dom.Node; |
99 |
import org.w3c.dom.NodeList; |
98 |
import org.w3c.dom.NodeList; |
100 |
import org.xml.sax.InputSource; |
99 |
import org.xml.sax.InputSource; |
|
|
100 |
import org.xml.sax.SAXException; |
101 |
|
101 |
|
102 |
|
102 |
|
103 |
/** |
103 |
/** |
Lines 113-119
Link Here
|
113 |
|
113 |
|
114 |
|
114 |
|
115 |
// -------------------------------------------------------------- Constants |
115 |
// -------------------------------------------------------------- Constants |
116 |
|
116 |
|
117 |
|
117 |
|
118 |
private static final String METHOD_HEAD = "HEAD"; |
118 |
private static final String METHOD_HEAD = "HEAD"; |
119 |
private static final String METHOD_PROPFIND = "PROPFIND"; |
119 |
private static final String METHOD_PROPFIND = "PROPFIND"; |
Lines 699-704
Link Here
|
699 |
return; |
699 |
return; |
700 |
} |
700 |
} |
701 |
|
701 |
|
|
|
702 |
if (req.getInputStream().available() > 0) { |
703 |
DocumentBuilder documentBuilder = getDocumentBuilder(); |
704 |
try { |
705 |
Document document = documentBuilder.parse |
706 |
(new InputSource(req.getInputStream())); |
707 |
// TODO : Process this request body |
708 |
resp.sendError(WebdavStatus.SC_NOT_IMPLEMENTED); |
709 |
return; |
710 |
|
711 |
} catch(SAXException saxe) { |
712 |
// Parse error - assume invalid content |
713 |
resp.sendError(WebdavStatus.SC_BAD_REQUEST); |
714 |
return; |
715 |
} |
716 |
} |
717 |
|
702 |
boolean result = true; |
718 |
boolean result = true; |
703 |
try { |
719 |
try { |
704 |
resources.createSubcontext(path); |
720 |
resources.createSubcontext(path); |
Lines 848-853
Link Here
|
848 |
if (lockDurationStr == null) { |
864 |
if (lockDurationStr == null) { |
849 |
lockDuration = DEFAULT_TIMEOUT; |
865 |
lockDuration = DEFAULT_TIMEOUT; |
850 |
} else { |
866 |
} else { |
|
|
867 |
int commaPos = lockDurationStr.indexOf(","); |
868 |
// If multiple timeouts, just use the first |
869 |
if (commaPos != -1) { |
870 |
lockDurationStr = lockDurationStr.substring(0,commaPos); |
871 |
} |
851 |
if (lockDurationStr.startsWith("Second-")) { |
872 |
if (lockDurationStr.startsWith("Second-")) { |
852 |
lockDuration = |
873 |
lockDuration = |
853 |
(new Integer(lockDurationStr.substring(7))).intValue(); |
874 |
(new Integer(lockDurationStr.substring(7))).intValue(); |
Lines 1365-1376
Link Here
|
1365 |
|
1386 |
|
1366 |
// -------------------------------------------------------- Private Methods |
1387 |
// -------------------------------------------------------- Private Methods |
1367 |
|
1388 |
|
1368 |
|
|
|
1369 |
protected String getETagValue(ResourceInfo resourceInfo) { |
1370 |
return resourceInfo.length + "-" + resourceInfo.date; |
1371 |
} |
1372 |
|
1373 |
|
1374 |
/** |
1389 |
/** |
1375 |
* Generate the namespace declarations. |
1390 |
* Generate the namespace declarations. |
1376 |
*/ |
1391 |
*/ |
Lines 2014-2032
Link Here
|
2014 |
generatedXML.writeElement(null, "displayname", XMLWriter.OPENING); |
2029 |
generatedXML.writeElement(null, "displayname", XMLWriter.OPENING); |
2015 |
generatedXML.writeData(resourceName); |
2030 |
generatedXML.writeData(resourceName); |
2016 |
generatedXML.writeElement(null, "displayname", XMLWriter.CLOSING); |
2031 |
generatedXML.writeElement(null, "displayname", XMLWriter.CLOSING); |
2017 |
generatedXML.writeProperty(null, "getcontentlanguage", |
|
|
2018 |
Locale.getDefault().toString()); |
2019 |
if (!resourceInfo.collection) { |
2032 |
if (!resourceInfo.collection) { |
2020 |
generatedXML.writeProperty |
2033 |
generatedXML.writeProperty |
2021 |
(null, "getlastmodified", resourceInfo.httpDate); |
2034 |
(null, "getlastmodified", resourceInfo.httpDate); |
2022 |
generatedXML.writeProperty |
2035 |
generatedXML.writeProperty |
2023 |
(null, "getcontentlength", |
2036 |
(null, "getcontentlength", |
2024 |
String.valueOf(resourceInfo.length)); |
2037 |
String.valueOf(resourceInfo.length)); |
2025 |
generatedXML.writeProperty |
2038 |
String contentType = getServletContext().getMimeType |
2026 |
(null, "getcontenttype", |
2039 |
(resourceInfo.path); |
2027 |
getServletContext().getMimeType(resourceInfo.path)); |
2040 |
if (contentType != null) { |
|
|
2041 |
generatedXML.writeProperty(null, "getcontenttype", |
2042 |
contentType); |
2043 |
} |
2028 |
generatedXML.writeProperty(null, "getetag", |
2044 |
generatedXML.writeProperty(null, "getetag", |
2029 |
getETagValue(resourceInfo)); |
2045 |
getETag(resourceInfo)); |
2030 |
generatedXML.writeElement(null, "resourcetype", |
2046 |
generatedXML.writeElement(null, "resourcetype", |
2031 |
XMLWriter.NO_CONTENT); |
2047 |
XMLWriter.NO_CONTENT); |
2032 |
} else { |
2048 |
} else { |
Lines 2127-2135
Link Here
|
2127 |
if (resourceInfo.collection) { |
2143 |
if (resourceInfo.collection) { |
2128 |
propertiesNotFound.addElement(property); |
2144 |
propertiesNotFound.addElement(property); |
2129 |
} else { |
2145 |
} else { |
2130 |
generatedXML.writeProperty |
2146 |
generatedXML.writeElement(null, "getcontentlanguage", |
2131 |
(null, "getcontentlanguage", |
2147 |
XMLWriter.NO_CONTENT); |
2132 |
Locale.getDefault().toString()); |
|
|
2133 |
} |
2148 |
} |
2134 |
} else if (property.equals("getcontentlength")) { |
2149 |
} else if (property.equals("getcontentlength")) { |
2135 |
if (resourceInfo.collection) { |
2150 |
if (resourceInfo.collection) { |
Lines 2153-2159
Link Here
|
2153 |
propertiesNotFound.addElement(property); |
2168 |
propertiesNotFound.addElement(property); |
2154 |
} else { |
2169 |
} else { |
2155 |
generatedXML.writeProperty |
2170 |
generatedXML.writeProperty |
2156 |
(null, "getetag", getETagValue(resourceInfo)); |
2171 |
(null, "getetag", getETag(resourceInfo)); |
2157 |
} |
2172 |
} |
2158 |
} else if (property.equals("getlastmodified")) { |
2173 |
} else if (property.equals("getlastmodified")) { |
2159 |
if (resourceInfo.collection) { |
2174 |
if (resourceInfo.collection) { |
Lines 2303-2310
Link Here
|
2303 |
generatedXML.writeData(resourceName); |
2318 |
generatedXML.writeData(resourceName); |
2304 |
generatedXML.writeElement |
2319 |
generatedXML.writeElement |
2305 |
(null, "displayname", XMLWriter.CLOSING); |
2320 |
(null, "displayname", XMLWriter.CLOSING); |
2306 |
generatedXML.writeProperty(null, "getcontentlanguage", |
|
|
2307 |
Locale.getDefault().toString()); |
2308 |
generatedXML.writeProperty(null, "getlastmodified", |
2321 |
generatedXML.writeProperty(null, "getlastmodified", |
2309 |
FastHttpDateFormat.formatDate |
2322 |
FastHttpDateFormat.formatDate |
2310 |
(lock.creationDate.getTime(), null)); |
2323 |
(lock.creationDate.getTime(), null)); |
Lines 2403-2411
Link Here
|
2403 |
generatedXML.writeElement |
2416 |
generatedXML.writeElement |
2404 |
(null, "displayname", XMLWriter.CLOSING); |
2417 |
(null, "displayname", XMLWriter.CLOSING); |
2405 |
} else if (property.equals("getcontentlanguage")) { |
2418 |
} else if (property.equals("getcontentlanguage")) { |
2406 |
generatedXML.writeProperty |
2419 |
generatedXML.writeElement(null, "getcontentlanguage", |
2407 |
(null, "getcontentlanguage", |
2420 |
XMLWriter.NO_CONTENT); |
2408 |
Locale.getDefault().toString()); |
|
|
2409 |
} else if (property.equals("getcontentlength")) { |
2421 |
} else if (property.equals("getcontentlength")) { |
2410 |
generatedXML.writeProperty |
2422 |
generatedXML.writeProperty |
2411 |
(null, "getcontentlength", (String.valueOf(0))); |
2423 |
(null, "getcontentlength", (String.valueOf(0))); |
Lines 2587-2597
Link Here
|
2587 |
return methodsAllowed; |
2599 |
return methodsAllowed; |
2588 |
} |
2600 |
} |
2589 |
|
2601 |
|
2590 |
methodsAllowed.append("OPTIONS, GET, HEAD, POST, DELETE, TRACE, "); |
2602 |
methodsAllowed.append("OPTIONS, GET, HEAD, POST, DELETE, TRACE"); |
2591 |
methodsAllowed.append("PROPPATCH, COPY, MOVE, LOCK, UNLOCK"); |
2603 |
methodsAllowed.append(", PROPPATCH, COPY, MOVE, LOCK, UNLOCK"); |
2592 |
|
2604 |
|
2593 |
if (listings) { |
2605 |
if (listings) { |
2594 |
methodsAllowed.append("PROPFIND, "); |
2606 |
methodsAllowed.append(", PROPFIND"); |
2595 |
} |
2607 |
} |
2596 |
|
2608 |
|
2597 |
if (!(object instanceof DirContext)) { |
2609 |
if (!(object instanceof DirContext)) { |