KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > microedition > io > HttpConnection


1
2 /*
3  * MicroEmulator
4  * Copyright (C) 2001 Bartek Teodorczyk <barteo@it.pl>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */

20  
21 package javax.microedition.io;
22
23 import java.io.IOException;
24
25
26 public interface HttpConnection extends ContentConnection
27 {
28
29     static final String HEAD = "HEAD";
30     static final String GET = "GET";
31     static final String POST = "POST";
32     
33     static final int HTTP_OK = 200;
34     static final int HTTP_CREATED = 201;
35     static final int HTTP_ACCEPTED = 202;
36     static final int HTTP_NOT_AUTHORITATIVE = 203;
37     static final int HTTP_NO_CONTENT = 204;
38     static final int HTTP_RESET = 205;
39     static final int HTTP_PARTIAL = 206;
40     
41     static final int HTTP_MULT_CHOICE = 300;
42     static final int HTTP_MOVED_PERM = 301;
43     static final int HTTP_MOVED_TEMP = 302;
44     static final int HTTP_SEE_OTHER = 303;
45     static final int HTTP_NOT_MODIFIED = 304;
46     static final int HTTP_USE_PROXY = 305;
47     static final int HTTP_TEMP_REDIRECT = 307;
48
49     static final int HTTP_BAD_REQUEST = 400;
50     static final int HTTP_UNAUTHORIZED = 401;
51     static final int HTTP_PAYMENT_REQUIRED = 402;
52     static final int HTTP_FORBIDDEN = 403;
53     static final int HTTP_NOT_FOUND = 404;
54     static final int HTTP_BAD_METHOD = 405;
55     static final int HTTP_NOT_ACCEPTABLE = 406;
56     static final int HTTP_PROXY_AUTH = 407;
57     static final int HTTP_CLIENT_TIMEOUT = 408;
58     static final int HTTP_CONFLICT = 409;
59     static final int HTTP_GONE = 410;
60     static final int HTTP_LENGTH_REQUIRED = 411;
61     static final int HTTP_PRECON_FAILED = 412;
62     static final int HTTP_ENTITY_TOO_LARGE = 413;
63     static final int HTTP_REQ_TOO_LONG = 414;
64     static final int HTTP_UNSUPPORTED_TYPE = 415;
65     static final int HTTP_UNSUPPORTED_RANGE = 416;
66     static final int HTTP_EXPECT_FAILED = 417;
67     
68     static final int HTTP_INTERNAL_ERROR = 500;
69     static final int HTTP_NOT_IMPLEMENTED = 501;
70     static final int HTTP_BAD_GATEWAY = 502;
71     static final int HTTP_UNAVAILABLE = 503;
72     static final int HTTP_GATEWAY_TIMEOUT = 504;
73     static final int HTTP_VERSION = 505;
74     
75     
76     String getURL();
77     
78     String getProtocol();
79     
80     String getHost();
81     
82     String getFile();
83     
84     String getRef();
85     
86     String getQuery();
87     
88     int getPort();
89     
90     String getRequestMethod();
91     
92     void setRequestMethod(String method)
93       throws IOException;
94       
95     String getRequestProperty(String key);
96     
97     void setRequestProperty(String key, String value)
98       throws IOException;
99   
100   int getResponseCode()
101       throws IOException;
102       
103     String getResponseMessage()
104       throws IOException;
105       
106     long getExpiration()
107       throws IOException;
108       
109     long getDate()
110       throws IOException;
111       
112   long getLastModified()
113       throws IOException;
114       
115   String getHeaderField(String name)
116       throws IOException;
117       
118   int getHeaderFieldInt(String name, int def)
119       throws IOException;
120       
121   long getHeaderFieldDate(String name, long def)
122       throws IOException;
123     
124     String getHeaderField(int n)
125       throws IOException;
126       
127   String getHeaderFieldKey(int n)
128       throws IOException;
129         
130 }
131
Popular Tags