1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.eclipse.jetty.client.webdav;
15
16 import java.io.IOException;
17
18 import org.eclipse.jetty.client.HttpExchange;
19 import org.eclipse.jetty.io.Buffer;
20 import org.eclipse.jetty.util.log.Log;
21
22
23 public class WebdavSupportedExchange extends HttpExchange
24 {
25 private boolean _webdavSupported = false;
26 private boolean _isComplete = false;
27
28 @Override
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 @Override
56 protected void onResponseComplete() throws IOException
57 {
58 _isComplete = true;
59
60 super.onResponseComplete();
61 }
62
63 public boolean isWebdavSupported()
64 {
65 return _webdavSupported;
66 }
67 }