[prev in list] [next in list] [prev in thread] [next in thread]
List: slide-dev
Subject: cvs commit: jakarta-slide/src/share/org/apache/slide/webdav/method PropPatchMethod.java
From: remm () locus ! apache ! org
Date: 2000-06-19 7:31:20
[Download RAW message or body]
remm 00/06/19 00:31:19
Modified: . build.xml
src/share/org/apache/slide/webdav/method
PropPatchMethod.java
Added: src/clients/webdav/src/org/apache/webdav/cmd Main.java
src/clients/webdav/src/org/apache/webdav/lib
Credentials.java Header.java
ResponseInputStream.java State.java
WebdavClient.java WebdavException.java
WebdavStatus.java
src/clients/webdav/src/org/apache/webdav/lib/methods
CopyMethod.java DeleteMethod.java GetMethod.java
HeadMethod.java LockMethod.java MkcolMethod.java
MoveMethod.java OptionsMethod.java PostMethod.java
PropFindMethod.java PropPatchMethod.java
PutMethod.java UnlockMethod.java WebdavMethod.java
WebdavMethodBase.java
Log:
- First draft of the DAV client library. Comments are welcome !
- To build, use the "webdav" target.
- Not functional for now.
- Input chunking support (the code will be included in Catalina soon).
- No HTTP authentication support for now (coming soon).
Revision Changes Path
1.15 +35 -5 jakarta-slide/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/build.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- build.xml 2000/06/15 03:23:55 1.14
+++ build.xml 2000/06/19 07:31:05 1.15
@@ -1,9 +1,6 @@
<project name="Slide" default="main" basedir=".">
- <!-- =================================================================== -->
- <!-- Prepare -->
- <!-- =================================================================== -->
<property name="name" value="Jakarta-Slide" />
<property name="year" value="2000" />
<property name="version" value="0.9dev" />
@@ -19,6 +16,8 @@
<property name="avalon.dist" value="../dist/avalon" />
<property name="slide.build" value="../build/slide" />
<property name="slide.dist" value="../dist/slide" />
+ <property name="webdav.build" value="../build/webdav" />
+ <property name="webdav.dist" value="../dist/webdav" />
<!-- =================================================================== -->
@@ -69,6 +68,27 @@
<!-- =================================================================== -->
+ <!-- Prepare WebDAV client -->
+ <!-- =================================================================== -->
+ <target name="prepare-webdav">
+ <mkdir dir="${webdav.build}"/>
+ <mkdir dir="${webdav.build}/classes"/>
+ <mkdir dir="${webdav.build}/conf"/>
+ <mkdir dir="${webdav.build}/logs"/>
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- Build WebDAV client -->
+ <!-- =================================================================== -->
+ <target name="webdav" depends="prepare-webdav">
+ <javac srcdir="src/clients/webdav/src" destdir="${webdav.build}/classes"
+ debug="on" deprecation="on"
+ excludes="**/CVS/**,**/package.html" />
+ </target>
+
+
+ <!-- =================================================================== -->
<!-- Build some examples -->
<!-- =================================================================== -->
<target name="examples" depends="main">
@@ -83,6 +103,8 @@
<target name="clean">
<deltree dir="${slide.build}"/>
<deltree dir="${slide.dist}"/>
+ <deltree dir="${webdav.build}"/>
+ <deltree dir="${webdav.dist}"/>
</target>
@@ -142,7 +164,7 @@
<!-- =================================================================== -->
<!-- Build a standalone Slide server -->
- <!-- This target requires Catalina and Avalon -->
+ <!-- This target requires Catalina -->
<!-- =================================================================== -->
<target name="catalina-dist" depends="no-debug, prepare-dist">
@@ -155,7 +177,7 @@
<javac srcdir="src/clients/tomcat"
destdir="${slide.build}/classes"
debug="off" deprecation="off"
- includes="**/realm/SlideRelm.java"
+ includes="**/org/apache/tomcat/**"
classpath="${slide.build}/classes,${catalina.build}/classes" />
<copyfile src="src/etc/MANIFEST.MF"
dest="${slide.build}/classes/MANIFEST.MF" />
@@ -248,6 +270,14 @@
<!-- Build a JMX-enabled Catalina - Slide server -->
<!-- =================================================================== -->
<target name="jmx-dist" depends="dist">
+
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- Build a distribution of the DAV client -->
+ <!-- =================================================================== -->
+ <target name="webdav-dist" depends="dist">
</target>
1.1 \
jakarta-slide/src/clients/webdav/src/org/apache/webdav/cmd/Main.java
Index: Main.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/clients/webdav/src/org/apache/webdav/cmd/Main.java,v \
1.1 2000/06/19 07:31:06 remm Exp $
* $Revision: 1.1 $
* $Date: 2000/06/19 07:31:06 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.webdav.cmd;
import java.io.IOException;
import java.util.*;
import java.security.Principal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.net.Socket;
import java.net.UnknownHostException;
import org.apache.webdav.lib.*;
import org.apache.webdav.lib.methods.*;
/**
* Command line WebDAV client.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
*/
public class Main {
// --------------------------------------------------------- Public Methods
/**
* Main function.
*/
public static void main(String args[]) {
try {
String host = "127.0.0.1";
int port = 80;
WebdavClient client = new WebdavClient();
// Parsing host and port from command line
if (args.length >= 2) {
host = args[0];
port = Integer.parseInt(args[1]);
}
client.startSession(host, port);
WebdavMethod method = new GetMethod();
method.setPath("/index.html");
client.executeMethod(method);
System.out.println("Response :");
System.out.println("Status code : " + method.getStatusCode());
System.out.println("Status text : " + method.getStatusText());
} catch (Throwable t) {
t.printStackTrace();
}
}
}
1.1 \
jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/Credentials.java
Index: Credentials.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/Credentials.java,v \
1.1 2000/06/19 07:31:07 remm Exp $
* $Revision: 1.1 $
* $Date: 2000/06/19 07:31:07 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.webdav.lib;
/**
* Credentials class.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
*/
public class Credentials {
// ----------------------------------------------------------- Constructors
/**
* Default constructor.
*/
public Credentials() {
}
/**
* Constructor.
*/
public Credentials(String userName, String password) {
this.userName = userName;
this.password = password;
}
// ----------------------------------------------------- Instance Variables
/**
* UserName.
*/
protected String userName;
/**
* Password.
*/
protected String password;
// ------------------------------------------------------------- Properties
/**
* UserName property setter.
*
* @param userName
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* UserName property getter.
*
* @return String userName
*/
public String getUserName() {
return userName;
}
/**
* Password property setter.
*
* @param password
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Password property getter.
*
* @return String password
*/
public String getPassword() {
return password;
}
}
1.1 \
jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/Header.java
Index: Header.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/Header.java,v \
1.1 2000/06/19 07:31:07 remm Exp $
* $Revision: 1.1 $
* $Date: 2000/06/19 07:31:07 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.webdav.lib;
import java.io.IOException;
import java.util.*;
import java.security.Principal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.net.Socket;
import java.net.UnknownHostException;
/**
* Header class.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
*/
public class Header {
// ----------------------------------------------------------- Constructors
/**
* Default constructor.
*/
public Header() {
}
/**
* Constructor.
*/
public Header(String name, String value) {
this.name = name;
this.value = value;
}
// ----------------------------------------------------- Instance Variables
/**
* Name.
*/
protected String name;
/**
* Value.
*/
protected String value;
// ------------------------------------------------------------- Properties
/**
* Name property setter.
*
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
* Name property getter.
*
* @return String name
*/
public String getName() {
return name;
}
/**
* Value property setter.
*
* @param value
*/
public void setValue(String value) {
this.value = value;
}
/**
* Value property getter.
*
* @return String value
*/
public String getValue() {
return value;
}
// --------------------------------------------------------- Public Methods
/**
* Get a String representation of the header.
*/
public String toString() {
return (name + ": " + value + "\r\n");
}
}
1.1 \
jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/ResponseInputStream.java
Index: ResponseInputStream.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/ResponseInputStream.java,v \
1.1 2000/06/19 07:31:07 remm Exp $
* $Revision: 1.1 $
* $Date: 2000/06/19 07:31:07 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.webdav.lib;
import java.io.InputStream;
import java.io.IOException;
import java.util.Hashtable;
/**
* Socket input stream wrapper.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
* @version $Revision: 1.1 $ $Date: 2000/06/19 07:31:07 $
*/
public class ResponseInputStream
extends InputStream {
// ----------------------------------------------------------- Constructors
/**
* Construct a servlet input stream associated with the specified Request.
*
* @param request The associated request
*/
public ResponseInputStream(InputStream stream, Hashtable responseHeaders) {
super();
closed = false;
count = 0;
// Retrieving transfer encoding header
Header transferEncoding =
(Header) responseHeaders.get("transfer-encoding");
if ((transferEncoding != null)
&& (transferEncoding.getValue().indexOf("chunked") != -1))
chunk = true;
// Retrieving content length header
Header contentLength =
(Header) responseHeaders.get("content-length");
if (contentLength != null) {
try {
length = Integer.parseInt(contentLength.getValue());
} catch (NumberFormatException e) {
}
}
this.stream = stream;
}
// ----------------------------------------------------- Instance Variables
/**
* Has this stream been closed?
*/
protected boolean closed = false;
/**
* Use chunking ?
*/
protected boolean chunk = false;
/**
* True if the final chunk was found.
*/
protected boolean endChunk = false;
/**
* Chunk buffer.
*/
protected byte[] chunkBuffer = null;
/**
* Chunk length.
*/
protected int chunkLength = 0;
/**
* Chunk buffer position.
*/
protected int chunkPos = 0;
/**
* The number of bytes which have already been returned by this stream.
*/
protected int count = 0;
/**
* The content length past which we will not read, or -1 if there is
* no defined content length.
*/
protected int length = -1;
/**
* The underlying input stream from which we should read data.
*/
protected InputStream stream = null;
// --------------------------------------------------------- Public Methods
/**
* Close this input stream. No physical level I-O is performed, but
* any further attempt to read from this stream will throw an IOException.
* If a content length has been set but not all of the bytes have yet been
* consumed, the remaining bytes will be swallowed.
*/
public void close()
throws IOException {
if (closed)
throw new IOException("Stream is closed");
if (chunk) {
while (!endChunk) {
int b = read();
if (b < 0)
break;
}
} else {
if (length > 0) {
while (count < length) {
int b = read();
if (b < 0)
break;
}
}
}
closed = true;
}
/**
* Read and return a single byte from this input stream, or -1 if end of
* file has been encountered.
*
* @exception IOException if an input/output error occurs
*/
public int read()
throws IOException {
// Has this stream been closed?
if (closed)
throw new IOException("Stream is closed");
if (endChunk)
return (-1);
if (chunk) {
if ((chunkBuffer == null)
|| (chunkPos == chunkLength)) {
chunkPos = 0;
try {
chunkLength = Integer.parseInt(readLine(), 16);
} catch (NumberFormatException e) {
// Critical error, unable to parse the chunk length
chunkLength = 0;
chunk = false;
close();
return -1;
}
if (chunkLength == 0) {
// TODO : Parse the trailing headers, if any
readLine();
endChunk = true;
return (-1);
// TODO : Should the stream be automatically closed ?
} else {
if ((chunkBuffer == null)
|| (chunkLength > chunkBuffer.length))
chunkBuffer = new byte[chunkLength];
// Now read the whole chunk into the buffer
int nbRead = 0;
int currentRead = 0;
while (nbRead < chunkLength) {
currentRead =
stream.read(chunkBuffer, nbRead,
chunkLength - nbRead);
if (currentRead == -1)
throw new IOException("Unexpected end of stream");
nbRead += currentRead;
}
// Skipping the CRLF
stream.read();
stream.read();
}
}
return (chunkBuffer[chunkPos++]);
} else {
// Have we read the specified content length already?
if ((length >= 0) && (count >= length))
return (-1); // End of file indicator
// Read and count the next byte, then return it
int b = stream.read();
if (b >= 0)
count++;
return (b);
}
}
// -------------------------------------------------------- Private Methods
/**
* Reads the input stream, one line at a time. Reads bytes into an array,
* until it reads a certain number of bytes or reaches a newline character,
* which it reads into the array as well.
*
* @param input Input stream on which the bytes are read
* @return The line that was read, or <code>null</code> if end-of-file
* was encountered
* @exception IOException if an input or output exception has occurred
*/
private String readLine()
throws IOException {
StringBuffer sb = new StringBuffer();
while (true) {
int ch = stream.read();
if (ch < 0) {
if (sb.length() == 0) {
return (null);
} else {
break;
}
} else if (ch == '\r') {
continue;
} else if (ch == '\n') {
break;
}
sb.append((char) ch);
}
return (sb.toString());
}
}
1.1 \
jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/State.java
Index: State.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/State.java,v \
1.1 2000/06/19 07:31:07 remm Exp $
* $Revision: 1.1 $
* $Date: 2000/06/19 07:31:07 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.webdav.lib;
import java.io.IOException;
import java.util.*;
/**
* Session state.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
*/
public class State {
// ----------------------------------------------------- Instance Variables
/**
* Lock tokens.
*/
protected Hashtable lockTokens = new Hashtable();
// ------------------------------------------------------------- Properties
/**
* Add a lock token.
*
* @param uri Uri
* @param value Lock token value
*/
public void addLock(String uri, String value) {
Vector currentLocks = (Vector) lockTokens.get(uri);
if (currentLocks == null)
currentLocks = new Vector();
currentLocks.addElement(value);
lockTokens.put(uri, currentLocks);
}
/**
* Remove a lock.
*
* @param uri Uri
* @param value LockToken value
*/
public void removeLock(String uri, String value) {
Vector currentLocks = (Vector) lockTokens.get(uri);
if (currentLocks == null)
return;
currentLocks.removeElement(value);
}
/**
* Remove locks.
*
* @param uri Uri
*/
public void removeLocks(String uri) {
lockTokens.remove(uri);
}
/**
* Get locks
*
* @param uri Uri
* @return Enumeration of lock tokens
*/
public Enumeration getLocks(String uri) {
Vector result = (Vector) lockTokens.get(uri);
if (result == null)
result = new Vector();
return result.elements();
}
}
1.1 \
jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/WebdavClient.java
Index: WebdavClient.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/WebdavClient.java,v \
1.1 2000/06/19 07:31:07 remm Exp $
* $Revision: 1.1 $
* $Date: 2000/06/19 07:31:07 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.webdav.lib;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.*;
import java.security.Principal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.net.Socket;
import java.net.UnknownHostException;
import org.apache.webdav.lib.methods.WebdavMethod;
/**
* WebDAV client.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
*/
public class WebdavClient {
// -------------------------------------------------------------- Constants
/**
* HTTP Date format pattern (RFC 2068, 822, 1123).
*/
public static final String DATE_FORMAT = "EEE, d MMM yyyy kk:mm:ss z";
/**
* Date formatter.
*/
protected static final DateFormat formatter =
new SimpleDateFormat(DATE_FORMAT);
// ----------------------------------------------------- Instance Variables
/**
* Client Socket in use.
*/
protected Socket socket;
/**
* Session state.
*/
protected State state;
/**
* Credentials to use.
*/
protected Credentials credentials;
// ------------------------------------------------------------- Properties
/**
* Set the socket to use.
*/
public void setSocket(Socket socket) {
this.socket = socket;
}
/**
* Set the credentials to use.
*/
public void setCredentials(Credentials credentials) {
this.credentials = credentials;
}
// --------------------------------------------------------- Public Methods
/**
* Execute a DAV method.
*/
public void executeMethod(WebdavMethod method)
throws IOException, WebdavException {
InputStream is = socket.getInputStream();
OutputStream os = socket.getOutputStream();
// TODO : Wrap those two !
String requestLine = method.generateRequestLine();
method.generateHeaders(state);
Enumeration headersList = method.getHeaders();
String query = method.generateQuery();
if (query == null)
query = new String();
// Sending request line
os.write(requestLine.getBytes());
// TEMP CODE : Writing content length
os.write(("Content-Length: " + query.length() + "\r\n").getBytes());
// Writing HTTP headers
while (headersList.hasMoreElements()) {
os.write(headersList.nextElement().toString().getBytes());
}
os.write("\r\n".getBytes());
// Writing query
os.write(query.getBytes());
// Parsing response
// Parse status line
byte[] buffer = new byte[4096];
String statusLine = readLine(is);
parseStatusLine(statusLine, method);
// Parse headers
Hashtable responseHeaders = parseHeaders(is);
method.processResponseHeaders(responseHeaders.elements());
// Parse response
ResponseInputStream responseInputStream =
new ResponseInputStream(is, responseHeaders);
method.parseResponse(responseInputStream);
// TEMP TEST CODE ...
System.out.println("Response : ");
int nb = 0;
while (true) {
nb = responseInputStream.read(buffer);
if (nb == -1)
break;
System.out.println(new String(buffer, 0, nb));
}
}
/**
* Start a session.
*/
public void startSession()
throws IOException {
state = new State();
}
/**
* Start a session.
*/
public void startSession(String host, int port)
throws UnknownHostException, IOException {
state = new State();
socket = new Socket(host, port);
}
/**
* End a session.
*/
public void endSession()
throws IOException {
state = null;
// Close socket
socket.close();
}
// -------------------------------------------------------- Private Methods
/**
* Reads the input stream, one line at a time. Reads bytes into an array,
* until it reads a certain number of bytes or reaches a newline character,
* which it reads into the array as well.
*
* @param input Input stream on which the bytes are read
* @return The line that was read, or <code>null</code> if end-of-file
* was encountered
* @exception IOException if an input or output exception has occurred
*/
private String readLine(InputStream input)
throws IOException {
StringBuffer sb = new StringBuffer();
while (true) {
int ch = input.read();
if (ch < 0) {
if (sb.length() == 0) {
return (null);
} else {
break;
}
} else if (ch == '\r') {
continue;
} else if (ch == '\n') {
break;
}
sb.append((char) ch);
}
return (sb.toString());
}
/**
* Parse status line.
*
* @param statusLine String representing the HTTP status line
* @param method Webdav method
*/
private void parseStatusLine(String statusLine, WebdavMethod method)
throws IOException, WebdavException {
StringTokenizer st = new StringTokenizer(statusLine);
String protocol = null;
try {
protocol = st.nextToken();
} catch (NoSuchElementException e) {
}
if ((protocol == null) || (!protocol.equals("HTTP/1.1")))
throw new WebdavException("Incorrect server protocol : "
+ protocol);
int statusCode = -1;
try {
statusCode = Integer.parseInt(st.nextToken());
} catch (Exception e) {
}
if (statusCode == -1)
throw new WebdavException("Status not specified");
method.setStatusCode(statusCode);
String statusText = null;
try {
statusText = st.nextToken();
} catch (NoSuchElementException e) {
}
if (statusText != null)
method.setStatusText(statusText);
}
/**
* Parse headers.
*
* @param input Input stream on which the bytes are read
*/
private Hashtable parseHeaders(InputStream input)
throws IOException, WebdavException {
Hashtable result = new Hashtable();
while (true) {
// Read the next header line
String line = readLine(input);
if ((line == null) || (line.length() < 1))
break;
// Parse the header name and value
int colon = line.indexOf(":");
if (colon < 0)
throw new WebdavException("Incorrect headers");
String name = line.substring(0, colon).trim();
String match = name.toLowerCase();
String value = line.substring(colon + 1).trim();
Header header = new Header(match, value);
result.put(match, header);
}
return result;
}
}
1.1 \
jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/WebdavException.java
Index: WebdavException.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/WebdavException.java,v \
1.1 2000/06/19 07:31:07 remm Exp $
* $Revision: 1.1 $
* $Date: 2000/06/19 07:31:07 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.webdav.lib;
/**
* Webdav exception class.
*/
public class WebdavException
extends Exception {
// ----------------------------------------------------------- Constructors
/**
* Constructor.
*
* @param message Exception message
*/
public WebdavException(String message) {
super(message);
}
}
1.1 \
jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/WebdavStatus.java
Index: WebdavStatus.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/clients/webdav/src/org/apache/webdav/lib/WebdavStatus.java,v \
1.1 2000/06/19 07:31:08 remm Exp $
* $Revision: 1.1 $
* $Date: 2000/06/19 07:31:08 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.webdav.lib;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.NoSuchElementException;
/**
* Wraps the HttpServletResponse class to abstract the
* specific protocol used. To support other protocols
* we would only need to modify this class and the
* WebDavRetCode classes.
*
* @see WebDavRetCode
* @author Marc Eaddy
* @version 1.0, 16 Nov 1997
*/
public class WebdavStatus {
/**
* This Hashtable contains the mapping of HTTP and WebDAV
* status codes to descriptive text. This is a static
* variable.
*/
private static Hashtable mapStatusCodes = new Hashtable();
/**
* Adds a new status code -> status text mapping. This is a static
* method because the mapping is a static variable.
*
* @param nKey [IN] HTTP or WebDAV status code
* @param strVal [IN] HTTP status text
*/
private static void addStatusCodeMap(int nKey, String strVal) {
mapStatusCodes.put(new Integer(nKey), strVal);
}
/**
* Returns the HTTP status text for the HTTP or WebDav status code
* specified by looking it up in the static mapping. This is a
* static function.
*
* @param nHttpStatusCode [IN] HTTP or WebDAV status code
* @return A string with a short descriptive phrase for the
* HTTP status code (e.g., "OK").
*/
public static String getStatusText(int nHttpStatusCode) {
Integer intKey = new Integer(nHttpStatusCode);
if (!mapStatusCodes.containsKey(intKey)) {
// DANGER!!! - RECURSIVE!!!
return getStatusText(SC_INTERNAL_SERVER_ERROR);
} else {
return (String) mapStatusCodes.get(intKey);
}
}
/*
* HTTP 1.0 Server status codes; see RFC 1945.
*/
/**
* Status code (200) indicating the request succeeded normally.
*/
public static final int SC_OK = HttpServletResponse.SC_OK;
/**
* Status code (201) indicating the request succeeded and created
* a new resource on the server.
*/
public static final int SC_CREATED = HttpServletResponse.SC_CREATED;
/**
* Status code (202) indicating that a request was accepted for
* processing, but was not completed.
*/
public static final int SC_ACCEPTED = HttpServletResponse.SC_ACCEPTED;
/**
* Status code (204) indicating that the request succeeded but that
* there was no new information to return.
*/
public static final int SC_NO_CONTENT = HttpServletResponse.SC_NO_CONTENT;
/**
* Status code (301) indicating that the resource has permanently
* moved to a new location, and that future references should use a
* new URI with their requests.
*/
public static final int SC_MOVED_PERMANENTLY = \
HttpServletResponse.SC_MOVED_PERMANENTLY;
/**
* Status code (302) indicating that the resource has temporarily
* moved to another location, but that future references should
* still use the original URI to access the resource.
*/
public static final int SC_MOVED_TEMPORARILY = \
HttpServletResponse.SC_MOVED_TEMPORARILY;
/**
* Status code (304) indicating that a conditional GET operation
* found that the resource was available and not modified.
*/
public static final int SC_NOT_MODIFIED = HttpServletResponse.SC_NOT_MODIFIED;
/**
* Status code (400) indicating the request sent by the client was
* syntactically incorrect.
*/
public static final int SC_BAD_REQUEST = HttpServletResponse.SC_BAD_REQUEST;
/**
* Status code (401) indicating that the request requires HTTP
* authentication.
*/
public static final int SC_UNAUTHORIZED = HttpServletResponse.SC_UNAUTHORIZED;
/**
* Status code (403) indicating the server understood the request
* but refused to fulfill it.
*/
public static final int SC_FORBIDDEN = HttpServletResponse.SC_FORBIDDEN;
/**
* Status code (404) indicating that the requested resource is not
* available.
*/
public static final int SC_NOT_FOUND = HttpServletResponse.SC_NOT_FOUND;
/**
* Status code (500) indicating an error inside the HTTP service
* which prevented it from fulfilling the request.
*/
public static final int SC_INTERNAL_SERVER_ERROR = \
HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
/**
* Status code (501) indicating the HTTP service does not support
* the functionality needed to fulfill the request.
*/
public static final int SC_NOT_IMPLEMENTED = \
HttpServletResponse.SC_NOT_IMPLEMENTED;
/**
* Status code (502) indicating that the HTTP server received an
* invalid response from a server it consulted when acting as a
* proxy or gateway.
*/
public static final int SC_BAD_GATEWAY = HttpServletResponse.SC_BAD_GATEWAY;
/**
* Status code (503) indicating that the HTTP service is
* temporarily overloaded, and unable to handle the request.
*/
public static final int SC_SERVICE_UNAVAILABLE = \
HttpServletResponse.SC_SERVICE_UNAVAILABLE;
/*
* HTTP 1.1 Server status codes; see RFC 2048. When JWS supports HTTP 1.1 we
* will use the appropriate HttpServletRespones status codes.
*/
/**
* Status code (100) indicating the client may continue with
* its request. This interim response is used to inform the
* client that the initial part of the request has been
* received and has not yet been rejected by the server.
*/
public static final int SC_CONTINUE = 100;
/**
* Status code (405) indicating the method specified is not
* allowed for the resource.
*/
public static final int SC_METHOD_NOT_ALLOWED = 405;
/**
* Status code (409) indicating that the request could not be
* completed due to a conflict with the current state of the
* resource.
*/
public static final int SC_CONFLICT = 409;
/**
* Status code (412) indicating the precondition given in one
* or more of the request-header fields evaluated to false
* when it was tested on the server.
*/
public static final int SC_PRECONDITION_FAILED = 412;
/**
* Status code (413) indicating the server is refusing to
* process a request because the request entity is larger
* than the server is willing or able to process.
*/
public static final int SC_REQUEST_TOO_LONG = 413;
/**
* Status code (415) indicating the server is refusing to service
* the request because the entity of the request is in a format
* not supported by the requested resource for the requested
* method.
*/
public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
/*
* Extended WebDAV HTTP status codes; see <draft-ietf-webdav-protocol-05>.
*/
/**
* Status code (207) indicating that the response requires
* providing status for multiple independent operations.
*/
public static final int SC_MULTI_STATUS = 207;
// This one colides with HTTP 1.1
// "207 Parital Update OK"
/**
* Status code (418) indicating the entity body submitted with
* the PATCH method was not understood by the resource.
*/
public static final int SC_UNPROCESSABLE_ENTITY = 418;
// This one colides with HTTP 1.1
// "418 Reauthentication Required"
/**
* Status code (419) indicating that the resource does not have
* sufficient space to record the state of the resource after the
* execution of this method.
*/
public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419;
// This one colides with HTTP 1.1
// "419 Proxy Reauthentication Required"
/**
* Status code (420) indicating the method was not executed on
* a particular resource within its scope because some part of
* the method's execution failed causing the entire method to be
* aborted.
*/
public static final int SC_METHOD_FAILURE = 420;
/**
* Status code (423) indicating the destination resource of a
* method is locked, and either the request did not contain a
* valid Lock-Info header, or the Lock-Info header identifies
* a lock held by another principal.
*/
public static final int SC_LOCKED = 423;
static {
// HTTP 1.0 Server status codes -- see RFC 1945
addStatusCodeMap(SC_OK, "OK");
addStatusCodeMap(SC_CREATED, "Created");
addStatusCodeMap(SC_ACCEPTED, "Accepted");
addStatusCodeMap(SC_NO_CONTENT, "No Content");
addStatusCodeMap(SC_MOVED_PERMANENTLY, "Moved Permanently");
addStatusCodeMap(SC_MOVED_TEMPORARILY, "Moved Temporarily");
addStatusCodeMap(SC_NOT_MODIFIED, "Not Modified");
addStatusCodeMap(SC_BAD_REQUEST, "Bad Request");
addStatusCodeMap(SC_UNAUTHORIZED, "Unauthorized");
addStatusCodeMap(SC_FORBIDDEN, "Forbidden");
addStatusCodeMap(SC_NOT_FOUND, "Not Found");
addStatusCodeMap(SC_INTERNAL_SERVER_ERROR, "Internal Server Error");
addStatusCodeMap(SC_NOT_IMPLEMENTED, "Not Implemented");
addStatusCodeMap(SC_BAD_GATEWAY, "Bad Gateway");
addStatusCodeMap(SC_SERVICE_UNAVAILABLE, "Service Unavailable");
// HTTP 1.1 Server status codes -- see RFC 2048
addStatusCodeMap(SC_CONTINUE, "Continue");
addStatusCodeMap(SC_METHOD_NOT_ALLOWED, "Method Not Allowed");
addStatusCodeMap(SC_CONFLICT, "Conflict");
addStatusCodeMap(SC_PRECONDITION_FAILED, "Precondition Failed");
addStatusCodeMap(SC_REQUEST_TOO_LONG, "Request Too Long");
addStatusCodeMap(SC_UNSUPPOR
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic