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 protected void onResponseHeader(Buffer name, Buffer value) throws IOException
29 {
30 if (Log.isDebugEnabled())
31 Log.debug("WebdavSupportedExchange:Header:" + name.toString() + " / " + value.toString() );
32 if ( "DAV".equals( name.toString() ) )
33 {
34 if ( value.toString().indexOf( "1" ) >= 0 || value.toString().indexOf( "2" ) >= 0 )
35 {
36 _webdavSupported = true;
37 }
38 }
39
40 super.onResponseHeader(name, value);
41 }
42
43 public void waitTilCompletion() throws InterruptedException
44 {
45 synchronized (this)
46 {
47 while ( !_isComplete)
48 {
49 this.wait();
50 }
51 }
52 }
53
54 protected void onResponseComplete() throws IOException
55 {
56 _isComplete = true;
57
58 super.onResponseComplete();
59 }
60
61 public boolean isWebdavSupported()
62 {
63 return _webdavSupported;
64 }
65 }