Source code: javax/microedition/io/HttpConnection.java
1 /*
2 * MicroEmulator
3 * Copyright (C) 2001 Bartek Teodorczyk <barteo@it.pl>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20 package javax.microedition.io;
21
22 import java.io.IOException;
23
24
25 public interface HttpConnection extends ContentConnection
26 {
27
28 static final String HEAD = "HEAD";
29 static final String GET = "GET";
30 static final String POST = "POST";
31
32 static final int HTTP_OK = 200;
33 static final int HTTP_CREATED = 201;
34 static final int HTTP_ACCEPTED = 202;
35 static final int HTTP_NOT_AUTHORITATIVE = 203;
36 static final int HTTP_NO_CONTENT = 204;
37 static final int HTTP_RESET = 205;
38 static final int HTTP_PARTIAL = 206;
39
40 static final int HTTP_MULT_CHOICE = 300;
41 static final int HTTP_MOVED_PERM = 301;
42 static final int HTTP_MOVED_TEMP = 302;
43 static final int HTTP_SEE_OTHER = 303;
44 static final int HTTP_NOT_MODIFIED = 304;
45 static final int HTTP_USE_PROXY = 305;
46 static final int HTTP_TEMP_REDIRECT = 307;
47
48 static final int HTTP_BAD_REQUEST = 400;
49 static final int HTTP_UNAUTHORIZED = 401;
50 static final int HTTP_PAYMENT_REQUIRED = 402;
51 static final int HTTP_FORBIDDEN = 403;
52 static final int HTTP_NOT_FOUND = 404;
53 static final int HTTP_BAD_METHOD = 405;
54 static final int HTTP_NOT_ACCEPTABLE = 406;
55 static final int HTTP_PROXY_AUTH = 407;
56 static final int HTTP_CLIENT_TIMEOUT = 408;
57 static final int HTTP_CONFLICT = 409;
58 static final int HTTP_GONE = 410;
59 static final int HTTP_LENGTH_REQUIRED = 411;
60 static final int HTTP_PRECON_FAILED = 412;
61 static final int HTTP_ENTITY_TOO_LARGE = 413;
62 static final int HTTP_REQ_TOO_LONG = 414;
63 static final int HTTP_UNSUPPORTED_TYPE = 415;
64 static final int HTTP_UNSUPPORTED_RANGE = 416;
65 static final int HTTP_EXPECT_FAILED = 417;
66
67 static final int HTTP_INTERNAL_ERROR = 500;
68 static final int HTTP_NOT_IMPLEMENTED = 501;
69 static final int HTTP_BAD_GATEWAY = 502;
70 static final int HTTP_UNAVAILABLE = 503;
71 static final int HTTP_GATEWAY_TIMEOUT = 504;
72 static final int HTTP_VERSION = 505;
73
74
75 String getURL();
76
77 String getProtocol();
78
79 String getHost();
80
81 String getFile();
82
83 String getRef();
84
85 String getQuery();
86
87 int getPort();
88
89 String getRequestMethod();
90
91 void setRequestMethod(String method)
92 throws IOException;
93
94 String getRequestProperty(String key);
95
96 void setRequestProperty(String key, String value)
97 throws IOException;
98
99 int getResponseCode()
100 throws IOException;
101
102 String getResponseMessage()
103 throws IOException;
104
105 long getExpiration()
106 throws IOException;
107
108 long getDate()
109 throws IOException;
110
111 long getLastModified()
112 throws IOException;
113
114 String getHeaderField(String name)
115 throws IOException;
116
117 int getHeaderFieldInt(String name, int def)
118 throws IOException;
119
120 long getHeaderFieldDate(String name, long def)
121 throws IOException;
122
123 String getHeaderField(int n)
124 throws IOException;
125
126 String getHeaderFieldKey(int n)
127 throws IOException;
128
129 }