218 |
return doUnknown(req, resf); |
return doUnknown(req, resf); |
219 |
} |
} |
220 |
|
|
221 |
|
// WebDAV methods |
222 |
|
|
223 |
|
/** HTTP PROPFIND method handler. This method is called when the |
224 |
|
* HTTP PROPFIND request is to be processed. By default, doUnknown |
225 |
|
* is called. |
226 |
|
* @param req The HTTP request from the client |
227 |
|
* @param resf A factory of HTTP responses |
228 |
|
* @return A HTTP response to be sent to the client |
229 |
|
* @throws IOException |
230 |
|
*/ |
231 |
|
protected HTTPResponse doPropfind(HTTPRequest req, HTTPResponse.Factory resf) |
232 |
|
throws IOException { |
233 |
|
return doUnknown(req, resf); |
234 |
|
} |
235 |
|
|
236 |
|
/** HTTP PROPPATCH method handler. This method is called when the |
237 |
|
* HTTP PROPPATCH request is to be processed. By default, doUnknown |
238 |
|
* is called. |
239 |
|
* @param req The HTTP request from the client |
240 |
|
* @param resf A factory of HTTP responses |
241 |
|
* @return A HTTP response to be sent to the client |
242 |
|
* @throws IOException |
243 |
|
*/ |
244 |
|
protected HTTPResponse doProppatch(HTTPRequest req, HTTPResponse.Factory resf) |
245 |
|
throws IOException { |
246 |
|
return doUnknown(req, resf); |
247 |
|
} |
248 |
|
|
249 |
|
/** HTTP MKCOL method handler. This method is called when the |
250 |
|
* HTTP MKCOL request is to be processed. By default, doUnknown |
251 |
|
* is called. |
252 |
|
* @param req The HTTP request from the client |
253 |
|
* @param resf A factory of HTTP responses |
254 |
|
* @return A HTTP response to be sent to the client |
255 |
|
* @throws IOException |
256 |
|
*/ |
257 |
|
protected HTTPResponse doMkcol(HTTPRequest req, HTTPResponse.Factory resf) |
258 |
|
throws IOException { |
259 |
|
return doUnknown(req, resf); |
260 |
|
} |
261 |
|
|
262 |
|
/** HTTP COPY method handler. This method is called when the |
263 |
|
* HTTP COPY request is to be processed. By default, doUnknown |
264 |
|
* is called. |
265 |
|
* @param req The HTTP request from the client |
266 |
|
* @param resf A factory of HTTP responses |
267 |
|
* @return A HTTP response to be sent to the client |
268 |
|
* @throws IOException |
269 |
|
*/ |
270 |
|
protected HTTPResponse doCopy(HTTPRequest req, HTTPResponse.Factory resf) |
271 |
|
throws IOException { |
272 |
|
return doUnknown(req, resf); |
273 |
|
} |
274 |
|
|
275 |
|
/** HTTP MOVE method handler. This method is called when the |
276 |
|
* HTTP MOVE request is to be processed. By default, doUnknown |
277 |
|
* is called. |
278 |
|
* @param req The HTTP request from the client |
279 |
|
* @param resf A factory of HTTP responses |
280 |
|
* @return A HTTP response to be sent to the client |
281 |
|
* @throws IOException |
282 |
|
*/ |
283 |
|
protected HTTPResponse doMove(HTTPRequest req, HTTPResponse.Factory resf) |
284 |
|
throws IOException { |
285 |
|
return doUnknown(req, resf); |
286 |
|
} |
287 |
|
|
288 |
|
/** HTTP LOCK method handler. This method is called when the |
289 |
|
* HTTP LOCK request is to be processed. By default, doUnknown |
290 |
|
* is called. |
291 |
|
* @param req The HTTP request from the client |
292 |
|
* @param resf A factory of HTTP responses |
293 |
|
* @return A HTTP response to be sent to the client |
294 |
|
* @throws IOException |
295 |
|
*/ |
296 |
|
protected HTTPResponse doLock(HTTPRequest req, HTTPResponse.Factory resf) |
297 |
|
throws IOException { |
298 |
|
return doUnknown(req, resf); |
299 |
|
} |
300 |
|
|
301 |
|
/** HTTP UNLOCK method handler. This method is called when the |
302 |
|
* HTTP UNLOCK request is to be processed. By default, doUnknown |
303 |
|
* is called. |
304 |
|
* @param req The HTTP request from the client |
305 |
|
* @param resf A factory of HTTP responses |
306 |
|
* @return A HTTP response to be sent to the client |
307 |
|
* @throws IOException |
308 |
|
*/ |
309 |
|
protected HTTPResponse doUnlock(HTTPRequest req, HTTPResponse.Factory resf) |
310 |
|
throws IOException { |
311 |
|
return doUnknown(req, resf); |
312 |
|
} |
313 |
|
|
314 |
/** Unknown method handler. This method is called when the |
/** Unknown method handler. This method is called when the |
315 |
* an unknown HTTP request is to be processed. By default, it is |
* an unknown HTTP request is to be processed. By default, it is |
316 |
* responded with a 501. |
* responded with a 501. |
336 |
protected HTTPResponse dispatch(HTTPRequest req, HTTPResponse.Factory resf) |
protected HTTPResponse dispatch(HTTPRequest req, HTTPResponse.Factory resf) |
337 |
throws IOException { |
throws IOException { |
338 |
String method = req.getMethod(); |
String method = req.getMethod(); |
339 |
|
/* HTTP proper methods */ |
340 |
if (method.equals("HEAD")) return doHead(req, resf); |
if (method.equals("HEAD")) return doHead(req, resf); |
341 |
if (method.equals("GET")) return doGet(req, resf); |
if (method.equals("GET")) return doGet(req, resf); |
342 |
if (method.equals("POST")) return doPost(req, resf); |
if (method.equals("POST")) return doPost(req, resf); |
345 |
if (method.equals("OPTIONS")) return doOptions(req, resf); |
if (method.equals("OPTIONS")) return doOptions(req, resf); |
346 |
if (method.equals("TRACE")) return doTrace(req, resf); |
if (method.equals("TRACE")) return doTrace(req, resf); |
347 |
if (method.equals("CONNECT")) return doConnect(req, resf); |
if (method.equals("CONNECT")) return doConnect(req, resf); |
348 |
/* */ return doUnknown(req, resf); |
|
349 |
|
/* WebDAV methods */ |
350 |
|
if (method.equals("PROPFIND")) return doPropfind(req, resf); |
351 |
|
if (method.equals("PROPPATCH")) return doProppatch(req, resf); |
352 |
|
if (method.equals("MKCOL")) return doMkcol(req, resf); |
353 |
|
if (method.equals("COPY")) return doCopy(req, resf); |
354 |
|
if (method.equals("MOVE")) return doMove(req, resf); |
355 |
|
if (method.equals("LOCK")) return doLock(req, resf); |
356 |
|
if (method.equals("UNLOCK")) return doUnlock(req, resf); |
357 |
|
|
358 |
|
/* else: unknown method */ return doUnknown(req, resf); |
359 |
} |
} |
360 |
|
|
361 |
|
|