1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.mortbay.jetty.client.webdav;
16
17 import java.io.IOException;
18
19 import org.mortbay.io.Buffer;
20 import org.mortbay.jetty.client.HttpExchange;
21 import org.mortbay.log.Log;
22
23
24 public class WebdavSupportedExchange extends HttpExchange
25 {
26 private boolean _webdavSupported = false;
27 private boolean _isComplete = false;
28
29 protected void onResponseHeader(Buffer name, Buffer value) throws IOException
30 {
31 if (Log.isDebugEnabled())
32 Log.debug("WebdavSupportedExchange:Header:" + name.toString() + " / " + value.toString() );
33 if ( "DAV".equals( name.toString() ) )
34 {
35 if ( value.toString().indexOf( "1" ) >= 0 || value.toString().indexOf( "2" ) >= 0 )
36 {
37 _webdavSupported = true;
38 }
39 }
40
41 super.onResponseHeader(name, value);
42 }
43
44 public void waitTilCompletion() throws InterruptedException
45 {
46 synchronized (this)
47 {
48 while ( !_isComplete)
49 {
50 this.wait();
51 }
52 }
53 }
54
55 protected void onResponseComplete() throws IOException
56 {
57 _isComplete = true;
58
59 super.onResponseComplete();
60 }
61
62 public boolean isWebdavSupported()
63 {
64 return _webdavSupported;
65 }
66 }