Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use the <a href="http://jackrabbit.apache.org/jackrabbit-webdav-library.html" rel="noreferrer">Jackrabbit WebDAV Library</a>.</p> <p>An example of a WebDAV client to upload content to a WebDAV server (taken from <a href="http://indiwiz.com/2009/02/11/webdav-client-in-java/" rel="noreferrer">here</a>):</p> <pre><code>import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.net.URL; import org.apache.commons.httpclient.Credentials; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.methods.InputStreamRequestEntity; import org.apache.commons.httpclient.methods.RequestEntity; import org.apache.jackrabbit.webdav.client.methods.PutMethod; ... // WebDAV URL: final String baseUrl = ...; // Source file to upload: File f = ...; try{ HttpClient client = new HttpClient(); Credentials creds = new UsernamePasswordCredentials("username", "password"); client.getState().setCredentials(AuthScope.ANY, creds); PutMethod method = new PutMethod(baseUrl + "/" + f.getName()); RequestEntity requestEntity = new InputStreamRequestEntity( new FileInputStream(f)); method.setRequestEntity(requestEntity); client.executeMethod(method); System.out.println(method.getStatusCode() + " " + method.getStatusText()); } catch(HttpException ex){ // Handle Exception } catch(IOException ex){ // Handle Exception } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload