01: // DAVStatusURI.java
02: // $Id: DAVStatusURI.java,v 1.3 2000/09/21 15:55:40 bmahe Exp $
03: // (c) COPYRIGHT MIT, INRIA and Keio, 2000.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05: package org.w3c.www.webdav;
06:
07: import org.w3c.www.http.BasicValue;
08: import org.w3c.www.http.HttpInvalidValueException;
09:
10: /**
11: * @version $Revision: 1.3 $
12: * @author Benoît Mahé (bmahe@w3.org)
13: */
14: public class DAVStatusURI {
15:
16: int status = -1;
17: String url = null;
18:
19: public int getStatus() {
20: return status;
21: }
22:
23: public String getURI() {
24: return url;
25: }
26:
27: DAVStatusURI(byte raw[], int start, int end)
28: throws HttpInvalidValueException {
29: // 404 <http://www.foo.bar/resource1>
30: ParseState ps = new ParseState(start, end);
31: ps.separator = (byte) '<';
32: ps.spaceIsSep = false;
33: ParseState ps2 = new ParseState(0, 0);
34: ps2.separator = (byte) '>';
35: ps2.spaceIsSep = false;
36:
37: if (DAVParser.nextItem(raw, ps) >= 0) { // status
38: this .status = Integer.parseInt(ps.toString(raw).trim());
39: }
40: if (DAVParser.nextItem(raw, ps) >= 0) { // coded uri
41: ps2.prepare(ps);
42: if (DAVParser.nextItem(raw, ps2) >= 0) {
43: this .url = ps2.toString(raw).trim();
44: }
45: }
46: if ((status == -1) || (url == null)) {
47: throw new HttpInvalidValueException("Invalid Status-URI");
48: }
49: }
50:
51: public DAVStatusURI(int status, String url) {
52: this.status = status;
53: this.url = url;
54: }
55:
56: }
|