Java Doc for HttpURLConnection.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » luni » internal » net » www » protocol » http » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » org package » org.apache.harmony.luni.internal.net.www.protocol.http 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.net.URLConnection
      java.net.HttpURLConnection
         org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection

HttpURLConnection
public class HttpURLConnection extends java.net.HttpURLConnection (Code)
This subclass extends HttpURLConnection which in turns extends URLConnection This is the actual class that "does the work", such as connecting, sending request and getting the content from the remote server.


Field Summary
protected  HttpConnectionconnection
    
 booleansendChunked
    

Constructor Summary
protected  HttpURLConnection(URL url)
     Creates an instance of the HttpURLConnection using default port 80.
protected  HttpURLConnection(URL url, int port)
    
protected  HttpURLConnection(URL url, int port, Proxy proxy)
    

Method Summary
public  voidaddRequestProperty(String field, String value)
    
public  voidconnect()
     Establishes the connection to the remote HTTP server Any methods that requires a valid connection to the resource will call this method implicitly.
public  voiddisconnect()
    
protected  voiddoRequest()
    
 voiddoRequestInternal()
    
protected  voidendRequest()
    
public static  StringgetDefaultRequestProperty(String field)
     Answers the default value for the field specified by field, null if there's no such a field.
public  InputStreamgetErrorStream()
     Answers an input stream from the server in the case of error such as the requested file (txt, htm, html) is not found on the remote server.
protected  HttpConnectiongetHTTPConnection(Proxy proxy)
     Returns connected socket to be used for this HTTP connection.
public  StringgetHeaderField(int pos)
     Answers the value of the field at position pos.
public  StringgetHeaderField(String key)
     Answers the value of the field corresponding to the key Answers null if there is no such field.
public  StringgetHeaderFieldKey(int pos)
    
public  Map<String, List<String>>getHeaderFields()
     Provides an unmodifiable map of the connection header values.
public  InputStreamgetInputStream()
    
public  OutputStreamgetOutputStream()
    
public  PermissiongetPermission()
    
public  Map<String, List<String>>getRequestProperties()
    
public  StringgetRequestProperty(String field)
    
public  intgetResponseCode()
    
 voidreadHeaders()
    
 voidreadServerResponse()
    
 Stringreadln()
     Answers a line read from the input stream.
protected  StringrequestString()
    
public static  voidsetDefaultRequestProperty(String field, String value)
     Sets the default request header fields to be sent to the remote server.
public  voidsetIfModifiedSince(long newValue)
     A slightly different implementation from this parent's setIfModifiedSince() Since this HTTP impl supports IfModifiedSince as one of the header field, the request header is updated with the new value.
public  voidsetRequestProperty(String field, String newValue)
    
protected  voidsetUpTransportIO(HttpConnection connection)
     Sets up the data streams used to send request[s] and read response[s].
public  booleanusingProxy()
    

Field Detail
connection
protected HttpConnection connection(Code)



sendChunked
boolean sendChunked(Code)




Constructor Detail
HttpURLConnection
protected HttpURLConnection(URL url)(Code)
Creates an instance of the HttpURLConnection using default port 80.
Parameters:
  url - URL The URL this connection is connecting



HttpURLConnection
protected HttpURLConnection(URL url, int port)(Code)
Creates an instance of the HttpURLConnection
Parameters:
  url - URL The URL this connection is connecting
Parameters:
  port - int The default connection port



HttpURLConnection
protected HttpURLConnection(URL url, int port, Proxy proxy)(Code)
Creates an instance of the HttpURLConnection
Parameters:
  url - URL The URL this connection is connecting
Parameters:
  port - int The default connection port
Parameters:
  proxy - Proxy The proxy which is used to make the connection




Method Detail
addRequestProperty
public void addRequestProperty(String field, String value)(Code)



connect
public void connect() throws IOException(Code)
Establishes the connection to the remote HTTP server Any methods that requires a valid connection to the resource will call this method implicitly. After the connection is established, connected is set to true.
See Also:   HttpURLConnection.connected
See Also:   java.io.IOException
See Also:   URLStreamHandler



disconnect
public void disconnect()(Code)
Closes the connection with the HTTP server
See Also:   URLConnection.connect



doRequest
protected void doRequest() throws IOException(Code)
Handles an HTTP request along with its redirects and authentication



doRequestInternal
void doRequestInternal() throws IOException(Code)



endRequest
protected void endRequest() throws IOException(Code)



getDefaultRequestProperty
public static String getDefaultRequestProperty(String field)(Code)
Answers the default value for the field specified by field, null if there's no such a field.



getErrorStream
public InputStream getErrorStream()(Code)
Answers an input stream from the server in the case of error such as the requested file (txt, htm, html) is not found on the remote server.

If the content type is not what stated above, FileNotFoundException is thrown. InputStream the error input stream returned by the server.




getHTTPConnection
protected HttpConnection getHTTPConnection(Proxy proxy) throws IOException(Code)
Returns connected socket to be used for this HTTP connection.



getHeaderField
public String getHeaderField(int pos)(Code)
Answers the value of the field at position pos. Answers null if there is fewer than pos fields in the response header. java.lang.String The value of the field
Parameters:
  pos - int the position of the field from the top
See Also:   HttpURLConnection.getHeaderField(String)
See Also:   HttpURLConnection.getHeaderFieldKey



getHeaderField
public String getHeaderField(String key)(Code)
Answers the value of the field corresponding to the key Answers null if there is no such field. If there are multiple fields with that key, the last field value is returned. java.lang.String The value of the header field
Parameters:
  key - java.lang.String the name of the header field
See Also:   HttpURLConnection.getHeaderField(int)
See Also:   HttpURLConnection.getHeaderFieldKey



getHeaderFieldKey
public String getHeaderFieldKey(int pos)(Code)



getHeaderFields
public Map<String, List<String>> getHeaderFields()(Code)
Provides an unmodifiable map of the connection header values. The map keys are the String header field names. Each map value is a list of the header field values associated with that key name. the mapping of header field names to values
since:
   1.4



getInputStream
public InputStream getInputStream() throws IOException(Code)



getOutputStream
public OutputStream getOutputStream() throws IOException(Code)



getPermission
public Permission getPermission() throws IOException(Code)



getRequestProperties
public Map<String, List<String>> getRequestProperties()(Code)



getRequestProperty
public String getRequestProperty(String field)(Code)



getResponseCode
public int getResponseCode() throws IOException(Code)



readHeaders
void readHeaders() throws IOException(Code)



readServerResponse
void readServerResponse() throws IOException(Code)



readln
String readln() throws IOException(Code)
Answers a line read from the input stream. Does not include the \n The line that was read.



requestString
protected String requestString()(Code)



setDefaultRequestProperty
public static void setDefaultRequestProperty(String field, String value)(Code)
Sets the default request header fields to be sent to the remote server. This does not affect the current URL Connection, only newly created ones.
Parameters:
  field - java.lang.String The name of the field to be changed
Parameters:
  value - java.lang.String The new value of the field



setIfModifiedSince
public void setIfModifiedSince(long newValue)(Code)
A slightly different implementation from this parent's setIfModifiedSince() Since this HTTP impl supports IfModifiedSince as one of the header field, the request header is updated with the new value.
Parameters:
  newValue - the number of millisecond since epoch
throws:
  IllegalStateException - if already connected.



setRequestProperty
public void setRequestProperty(String field, String newValue)(Code)



setUpTransportIO
protected void setUpTransportIO(HttpConnection connection) throws IOException(Code)
Sets up the data streams used to send request[s] and read response[s].
Parameters:
  connection - HttpConnection to be used



usingProxy
public boolean usingProxy()(Code)



Fields inherited from java.net.HttpURLConnection
final public static int HTTP_ACCEPTED(Code)(Java Doc)
final public static int HTTP_BAD_GATEWAY(Code)(Java Doc)
final public static int HTTP_BAD_METHOD(Code)(Java Doc)
final public static int HTTP_BAD_REQUEST(Code)(Java Doc)
final public static int HTTP_CLIENT_TIMEOUT(Code)(Java Doc)
final public static int HTTP_CONFLICT(Code)(Java Doc)
final public static int HTTP_CREATED(Code)(Java Doc)
final public static int HTTP_ENTITY_TOO_LARGE(Code)(Java Doc)
final public static int HTTP_FORBIDDEN(Code)(Java Doc)
final public static int HTTP_GATEWAY_TIMEOUT(Code)(Java Doc)
final public static int HTTP_GONE(Code)(Java Doc)
final public static int HTTP_INTERNAL_ERROR(Code)(Java Doc)
final public static int HTTP_LENGTH_REQUIRED(Code)(Java Doc)
final public static int HTTP_MOVED_PERM(Code)(Java Doc)
final public static int HTTP_MOVED_TEMP(Code)(Java Doc)
final public static int HTTP_MULT_CHOICE(Code)(Java Doc)
final public static int HTTP_NOT_ACCEPTABLE(Code)(Java Doc)
final public static int HTTP_NOT_AUTHORITATIVE(Code)(Java Doc)
final public static int HTTP_NOT_FOUND(Code)(Java Doc)
final public static int HTTP_NOT_IMPLEMENTED(Code)(Java Doc)
final public static int HTTP_NOT_MODIFIED(Code)(Java Doc)
final public static int HTTP_NO_CONTENT(Code)(Java Doc)
final public static int HTTP_OK(Code)(Java Doc)
final public static int HTTP_PARTIAL(Code)(Java Doc)
final public static int HTTP_PAYMENT_REQUIRED(Code)(Java Doc)
final public static int HTTP_PRECON_FAILED(Code)(Java Doc)
final public static int HTTP_PROXY_AUTH(Code)(Java Doc)
final public static int HTTP_REQ_TOO_LONG(Code)(Java Doc)
final public static int HTTP_RESET(Code)(Java Doc)
final public static int HTTP_SEE_OTHER(Code)(Java Doc)
final public static int HTTP_SERVER_ERROR(Code)(Java Doc)
final public static int HTTP_UNAUTHORIZED(Code)(Java Doc)
final public static int HTTP_UNAVAILABLE(Code)(Java Doc)
final public static int HTTP_UNSUPPORTED_TYPE(Code)(Java Doc)
final public static int HTTP_USE_PROXY(Code)(Java Doc)
final public static int HTTP_VERSION(Code)(Java Doc)
protected int chunkLength(Code)(Java Doc)
protected int fixedContentLength(Code)(Java Doc)
protected boolean instanceFollowRedirects(Code)(Java Doc)
protected String method(Code)(Java Doc)
protected int responseCode(Code)(Java Doc)
protected String responseMessage(Code)(Java Doc)

Methods inherited from java.net.HttpURLConnection
abstract public void disconnect()(Code)(Java Doc)
public InputStream getErrorStream()(Code)(Java Doc)
public static boolean getFollowRedirects()(Code)(Java Doc)
public String getHeaderField(int n)(Code)(Java Doc)
public long getHeaderFieldDate(String name, long Default)(Code)(Java Doc)
public String getHeaderFieldKey(int n)(Code)(Java Doc)
public boolean getInstanceFollowRedirects()(Code)(Java Doc)
public Permission getPermission() throws IOException(Code)(Java Doc)
public String getRequestMethod()(Code)(Java Doc)
public int getResponseCode() throws IOException(Code)(Java Doc)
public String getResponseMessage() throws IOException(Code)(Java Doc)
public void setChunkedStreamingMode(int chunklen)(Code)(Java Doc)
public void setFixedLengthStreamingMode(int contentLength)(Code)(Java Doc)
public static void setFollowRedirects(boolean set)(Code)(Java Doc)
public void setInstanceFollowRedirects(boolean followRedirects)(Code)(Java Doc)
public void setRequestMethod(String method) throws ProtocolException(Code)(Java Doc)
abstract public boolean usingProxy()(Code)(Java Doc)

Fields inherited from java.net.URLConnection
protected boolean allowUserInteraction(Code)(Java Doc)
protected boolean connected(Code)(Java Doc)
protected boolean doInput(Code)(Java Doc)
protected boolean doOutput(Code)(Java Doc)
protected long ifModifiedSince(Code)(Java Doc)
protected URL url(Code)(Java Doc)
protected boolean useCaches(Code)(Java Doc)

Methods inherited from java.net.URLConnection
public void addRequestProperty(String key, String value)(Code)(Java Doc)
abstract public void connect() throws IOException(Code)(Java Doc)
public boolean getAllowUserInteraction()(Code)(Java Doc)
public int getConnectTimeout()(Code)(Java Doc)
public Object getContent() throws IOException(Code)(Java Doc)
public Object getContent(Class[] classes) throws IOException(Code)(Java Doc)
public String getContentEncoding()(Code)(Java Doc)
public int getContentLength()(Code)(Java Doc)
public String getContentType()(Code)(Java Doc)
public long getDate()(Code)(Java Doc)
public static boolean getDefaultAllowUserInteraction()(Code)(Java Doc)
public static String getDefaultRequestProperty(String key)(Code)(Java Doc)
public boolean getDefaultUseCaches()(Code)(Java Doc)
public boolean getDoInput()(Code)(Java Doc)
public boolean getDoOutput()(Code)(Java Doc)
public long getExpiration()(Code)(Java Doc)
public static synchronized FileNameMap getFileNameMap()(Code)(Java Doc)
public String getHeaderField(String name)(Code)(Java Doc)
public String getHeaderField(int n)(Code)(Java Doc)
public long getHeaderFieldDate(String name, long Default)(Code)(Java Doc)
public int getHeaderFieldInt(String name, int Default)(Code)(Java Doc)
public String getHeaderFieldKey(int n)(Code)(Java Doc)
public Map<String, List<String>> getHeaderFields()(Code)(Java Doc)
public long getIfModifiedSince()(Code)(Java Doc)
public InputStream getInputStream() throws IOException(Code)(Java Doc)
public long getLastModified()(Code)(Java Doc)
public OutputStream getOutputStream() throws IOException(Code)(Java Doc)
public Permission getPermission() throws IOException(Code)(Java Doc)
public int getReadTimeout()(Code)(Java Doc)
public Map<String, List<String>> getRequestProperties()(Code)(Java Doc)
public String getRequestProperty(String key)(Code)(Java Doc)
public URL getURL()(Code)(Java Doc)
public boolean getUseCaches()(Code)(Java Doc)
public static String guessContentTypeFromName(String fname)(Code)(Java Doc)
public static String guessContentTypeFromStream(InputStream is) throws IOException(Code)(Java Doc)
public void setAllowUserInteraction(boolean allowuserinteraction)(Code)(Java Doc)
public void setConnectTimeout(int timeout)(Code)(Java Doc)
public static synchronized void setContentHandlerFactory(ContentHandlerFactory fac)(Code)(Java Doc)
public static void setDefaultAllowUserInteraction(boolean defaultallowuserinteraction)(Code)(Java Doc)
public static void setDefaultRequestProperty(String key, String value)(Code)(Java Doc)
public void setDefaultUseCaches(boolean defaultusecaches)(Code)(Java Doc)
public void setDoInput(boolean doinput)(Code)(Java Doc)
public void setDoOutput(boolean dooutput)(Code)(Java Doc)
public static void setFileNameMap(FileNameMap map)(Code)(Java Doc)
public void setIfModifiedSince(long ifmodifiedsince)(Code)(Java Doc)
public void setReadTimeout(int timeout)(Code)(Java Doc)
public void setRequestProperty(String key, String value)(Code)(Java Doc)
public void setUseCaches(boolean usecaches)(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

w___ww_.ja_v___a2__s___.__c_o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.