Java Doc for HttpURLConnection.java in  » Apache-Harmony-Java-SE » java-package » java » net » 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 » java package » java.net 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.net.URLConnection
      java.net.HttpURLConnection

HttpURLConnection
abstract public class HttpURLConnection extends URLConnection (Code)
This abstract subclass of URLConnection defines method for managing HTTP connection according to the description given by RFC 2068
See Also:   ContentHandler
See Also:   URL
See Also:   URLConnection
See Also:   URLStreamHandler


Field Summary
final public static  intHTTP_ACCEPTED
    
final public static  intHTTP_BAD_GATEWAY
    
final public static  intHTTP_BAD_METHOD
    
final public static  intHTTP_BAD_REQUEST
    
final public static  intHTTP_CLIENT_TIMEOUT
    
final public static  intHTTP_CONFLICT
    
final public static  intHTTP_CREATED
    
final public static  intHTTP_ENTITY_TOO_LARGE
    
final public static  intHTTP_FORBIDDEN
    
final public static  intHTTP_GATEWAY_TIMEOUT
    
final public static  intHTTP_GONE
    
final public static  intHTTP_INTERNAL_ERROR
    
final public static  intHTTP_LENGTH_REQUIRED
    
final public static  intHTTP_MOVED_PERM
    
final public static  intHTTP_MOVED_TEMP
    
final public static  intHTTP_MULT_CHOICE
    
final public static  intHTTP_NOT_ACCEPTABLE
    
final public static  intHTTP_NOT_AUTHORITATIVE
    
final public static  intHTTP_NOT_FOUND
    
final public static  intHTTP_NOT_IMPLEMENTED
    
final public static  intHTTP_NOT_MODIFIED
    
final public static  intHTTP_NO_CONTENT
    
final public static  intHTTP_OK
    
final public static  intHTTP_PARTIAL
    
final public static  intHTTP_PAYMENT_REQUIRED
    
final public static  intHTTP_PRECON_FAILED
    
final public static  intHTTP_PROXY_AUTH
    
final public static  intHTTP_REQ_TOO_LONG
    
final public static  intHTTP_RESET
    
final public static  intHTTP_SEE_OTHER
    
final public static  intHTTP_SERVER_ERROR
    
final public static  intHTTP_UNAUTHORIZED
    
final public static  intHTTP_UNAVAILABLE
    
final public static  intHTTP_UNSUPPORTED_TYPE
    
final public static  intHTTP_USE_PROXY
    
final public static  intHTTP_VERSION
    
protected  intchunkLength
    
protected  intfixedContentLength
    
protected  booleaninstanceFollowRedirects
    
protected  Stringmethod
    
protected  intresponseCode
    
protected  StringresponseMessage
    

Constructor Summary
protected  HttpURLConnection(URL url)
     Constructs a HttpURLConnection pointing to the resource specified by the URL.

Method Summary
abstract public  voiddisconnect()
    
public  java.io.InputStreamgetErrorStream()
     Answers a 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.
public static  booleangetFollowRedirects()
     Answers the value of followRedirects which indicates if this connection will follows a different URL redirected by the server.
public  longgetHeaderFieldDate(String field, long defaultValue)
     Answers the date value in the form of milliseconds since epoch corresponding to the field field.
public  booleangetInstanceFollowRedirects()
     Answers if this connection follows redirects.
public  java.security.PermissiongetPermission()
     Answers the permission object (in this case, SocketPermission) with the host and the port number as the target name and "resolve, connect" as the action list.
public  StringgetRequestMethod()
     Answers the request method which will be used to make the request to the remote HTTP server.
public  intgetResponseCode()
    
public  StringgetResponseMessage()
     Answers the response message returned the remote HTTP server the response message.
public  voidsetChunkedStreamingMode(int chunklen)
     If length of a HTTP request body is NOT known ahead, enable chunked transfer encoding to enable streaming without buffering.
public  voidsetFixedLengthStreamingMode(int contentLength)
     If length of a HTTP request body is known ahead, sets fixed length to enable streaming without buffering.
public static  voidsetFollowRedirects(boolean auto)
     Sets the flag of whether this connection will follow redirects returned by the remote server.
public  voidsetInstanceFollowRedirects(boolean followRedirects)
     Sets if this connection follows redirects.
public  voidsetRequestMethod(String method)
     Sets the request command which will be sent to the remote HTTP server.
abstract public  booleanusingProxy()
     Answers if this connection uses proxy.

Field Detail
HTTP_ACCEPTED
final public static int HTTP_ACCEPTED(Code)
Numeric status code, 202: Accepted



HTTP_BAD_GATEWAY
final public static int HTTP_BAD_GATEWAY(Code)
Numeric status code, 502: Bad Gateway



HTTP_BAD_METHOD
final public static int HTTP_BAD_METHOD(Code)
Numeric status code, 405: Bad Method



HTTP_BAD_REQUEST
final public static int HTTP_BAD_REQUEST(Code)
Numeric status code, 400: Bad Request



HTTP_CLIENT_TIMEOUT
final public static int HTTP_CLIENT_TIMEOUT(Code)
Numeric status code, 408: Client Timeout



HTTP_CONFLICT
final public static int HTTP_CONFLICT(Code)
Numeric status code, 409: Conflict



HTTP_CREATED
final public static int HTTP_CREATED(Code)
Numeric status code, 201: Created



HTTP_ENTITY_TOO_LARGE
final public static int HTTP_ENTITY_TOO_LARGE(Code)
Numeric status code, 413: Entity too large



HTTP_FORBIDDEN
final public static int HTTP_FORBIDDEN(Code)
Numeric status code, 403: Forbidden



HTTP_GATEWAY_TIMEOUT
final public static int HTTP_GATEWAY_TIMEOUT(Code)
Numeric status code, 504: Gateway timeout



HTTP_GONE
final public static int HTTP_GONE(Code)
Numeric status code, 410: Gone



HTTP_INTERNAL_ERROR
final public static int HTTP_INTERNAL_ERROR(Code)
Numeric status code, 500: Internal error



HTTP_LENGTH_REQUIRED
final public static int HTTP_LENGTH_REQUIRED(Code)
Numeric status code, 411: Length required



HTTP_MOVED_PERM
final public static int HTTP_MOVED_PERM(Code)
Numeric status code, 301 Moved permanently



HTTP_MOVED_TEMP
final public static int HTTP_MOVED_TEMP(Code)
Numeric status code, 302: Moved temporarily



HTTP_MULT_CHOICE
final public static int HTTP_MULT_CHOICE(Code)
Numeric status code, 300: Multiple choices



HTTP_NOT_ACCEPTABLE
final public static int HTTP_NOT_ACCEPTABLE(Code)
Numeric status code, 406: Not acceptable



HTTP_NOT_AUTHORITATIVE
final public static int HTTP_NOT_AUTHORITATIVE(Code)
Numeric status code, 203: Not authoritative



HTTP_NOT_FOUND
final public static int HTTP_NOT_FOUND(Code)
Numeric status code, 404: Not found



HTTP_NOT_IMPLEMENTED
final public static int HTTP_NOT_IMPLEMENTED(Code)
Numeric status code, 501: Not implemented



HTTP_NOT_MODIFIED
final public static int HTTP_NOT_MODIFIED(Code)
Numeric status code, 304: Not modified



HTTP_NO_CONTENT
final public static int HTTP_NO_CONTENT(Code)
Numeric status code, 204: No content



HTTP_OK
final public static int HTTP_OK(Code)
Numeric status code, 200: OK



HTTP_PARTIAL
final public static int HTTP_PARTIAL(Code)
Numeric status code, 206: Partial



HTTP_PAYMENT_REQUIRED
final public static int HTTP_PAYMENT_REQUIRED(Code)
Numeric status code, 402: Payment required



HTTP_PRECON_FAILED
final public static int HTTP_PRECON_FAILED(Code)
Numeric status code, 412: Precondition failed



HTTP_PROXY_AUTH
final public static int HTTP_PROXY_AUTH(Code)
Numeric status code, 407: Proxy authentication required



HTTP_REQ_TOO_LONG
final public static int HTTP_REQ_TOO_LONG(Code)
Numeric status code, 414: Request too long



HTTP_RESET
final public static int HTTP_RESET(Code)
Numeric status code, 205: Reset



HTTP_SEE_OTHER
final public static int HTTP_SEE_OTHER(Code)
Numeric status code, 303: See other



HTTP_SERVER_ERROR
final public static int HTTP_SERVER_ERROR(Code)



HTTP_UNAUTHORIZED
final public static int HTTP_UNAUTHORIZED(Code)
Numeric status code, 401: Unauthorized



HTTP_UNAVAILABLE
final public static int HTTP_UNAVAILABLE(Code)
Numeric status code, 503: Unavailable



HTTP_UNSUPPORTED_TYPE
final public static int HTTP_UNSUPPORTED_TYPE(Code)
Numeric status code, 415: Unsupported type



HTTP_USE_PROXY
final public static int HTTP_USE_PROXY(Code)
Numeric status code, 305: Use proxy



HTTP_VERSION
final public static int HTTP_VERSION(Code)
Numeric status code, 505: Version not supported



chunkLength
protected int chunkLength(Code)



fixedContentLength
protected int fixedContentLength(Code)



instanceFollowRedirects
protected boolean instanceFollowRedirects(Code)



method
protected String method(Code)



responseCode
protected int responseCode(Code)



responseMessage
protected String responseMessage(Code)




Constructor Detail
HttpURLConnection
protected HttpURLConnection(URL url)(Code)
Constructs a HttpURLConnection pointing to the resource specified by the URL.
Parameters:
  url - the URL of this connection
See Also:   URL
See Also:   URLConnection




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



getErrorStream
public java.io.InputStream getErrorStream()(Code)
Answers a 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. the error input stream returned by the server.




getFollowRedirects
public static boolean getFollowRedirects()(Code)
Answers the value of followRedirects which indicates if this connection will follows a different URL redirected by the server. It is enabled by default. The value of the flag
See Also:   HttpURLConnection.setFollowRedirects



getHeaderFieldDate
public long getHeaderFieldDate(String field, long defaultValue)(Code)
Answers the date value in the form of milliseconds since epoch corresponding to the field field. Answers defaultValue if no such field can be found in the response header.
Parameters:
  field - the field in question
Parameters:
  defaultValue - the default value if no field is found milliseconds since epoch



getInstanceFollowRedirects
public boolean getInstanceFollowRedirects()(Code)
Answers if this connection follows redirects. true if this connection follows redirects, false otherwise.



getPermission
public java.security.Permission getPermission() throws IOException(Code)
Answers the permission object (in this case, SocketPermission) with the host and the port number as the target name and "resolve, connect" as the action list. the permission object required for this connection
throws:
  IOException - if an IO exception occurs during the creation of thepermission object.



getRequestMethod
public String getRequestMethod()(Code)
Answers the request method which will be used to make the request to the remote HTTP server. All possible methods of this HTTP implementation is listed in the class definition. the request method string
See Also:   HttpURLConnection.method
See Also:   HttpURLConnection.setRequestMethod



getResponseCode
public int getResponseCode() throws IOException(Code)
Answers the response code returned by the remote HTTP server the response code, -1 if no valid response code
throws:
  IOException - if there is an IO error during the retrieval.
See Also:   HttpURLConnection.getResponseMessage



getResponseMessage
public String getResponseMessage() throws IOException(Code)
Answers the response message returned the remote HTTP server the response message. null if such response exists
throws:
  IOException - if there is an IO error during the retrieval.
See Also:   HttpURLConnection.getResponseCode()
See Also:   IOException



setChunkedStreamingMode
public void setChunkedStreamingMode(int chunklen)(Code)
If length of a HTTP request body is NOT known ahead, enable chunked transfer encoding to enable streaming without buffering. Notice that not all http servers support this mode. Sets after connection will cause an exception.
See Also:    setFixedLengthStreamingMode
Parameters:
  chunklen - the length of a chunk
throws:
  IllegalStateException - if already connected or other mode already set



setFixedLengthStreamingMode
public void setFixedLengthStreamingMode(int contentLength)(Code)
If length of a HTTP request body is known ahead, sets fixed length to enable streaming without buffering. Sets after connection will cause an exception.
See Also:    setChunkedStreamingMode
Parameters:
  contentLength - the fixed length of the HTTP request body
throws:
  IllegalStateException - if already connected or other mode already set
throws:
  IllegalArgumentException - if contentLength is less than zero



setFollowRedirects
public static void setFollowRedirects(boolean auto)(Code)
Sets the flag of whether this connection will follow redirects returned by the remote server. This method can only be called with the permission from the security manager
Parameters:
  auto - The value to set
See Also:   java.lang.SecurityManager.checkSetFactory



setInstanceFollowRedirects
public void setInstanceFollowRedirects(boolean followRedirects)(Code)
Sets if this connection follows redirects.
Parameters:
  followRedirects - true if this connection should follows redirects, falseotherwise.



setRequestMethod
public void setRequestMethod(String method) throws ProtocolException(Code)
Sets the request command which will be sent to the remote HTTP server. This method can only be called before the connection is made.
Parameters:
  method - The non-null string representing the method
throws:
  ProtocolException - Thrown when this is called after connected, or the method isnot supported by this HTTP implementation.
See Also:   HttpURLConnection.getRequestMethod()
See Also:   HttpURLConnection.method



usingProxy
abstract public boolean usingProxy()(Code)
Answers if this connection uses proxy. true if this connection supports proxy, false otherwise.



Fields inherited from java.net.URLConnection
protected boolean allowUserInteraction(Code)(Java Doc)
protected boolean connected(Code)(Java Doc)
static Hashtable<String, Object> contentHandlers(Code)(Java Doc)
ContentHandler defaultHandler(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 field, String newValue)(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 java.io.IOException(Code)(Java Doc)
public Object getContent(Class[] types) 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 field)(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 FileNameMap getFileNameMap()(Code)(Java Doc)
public String getHeaderField(int pos)(Code)(Java Doc)
public String getHeaderField(String key)(Code)(Java Doc)
public long getHeaderFieldDate(String field, long defaultValue)(Code)(Java Doc)
public int getHeaderFieldInt(String field, int defaultValue)(Code)(Java Doc)
public String getHeaderFieldKey(int posn)(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 java.security.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 field)(Code)(Java Doc)
public URL getURL()(Code)(Java Doc)
public boolean getUseCaches()(Code)(Java Doc)
public static String guessContentTypeFromName(String url)(Code)(Java Doc)
public static String guessContentTypeFromStream(InputStream is) throws IOException(Code)(Java Doc)
public void setAllowUserInteraction(boolean newValue)(Code)(Java Doc)
public void setConnectTimeout(int timeout)(Code)(Java Doc)
public static synchronized void setContentHandlerFactory(ContentHandlerFactory contentFactory)(Code)(Java Doc)
public static void setDefaultAllowUserInteraction(boolean allows)(Code)(Java Doc)
public static void setDefaultRequestProperty(String field, String value)(Code)(Java Doc)
public void setDefaultUseCaches(boolean newValue)(Code)(Java Doc)
public void setDoInput(boolean newValue)(Code)(Java Doc)
public void setDoOutput(boolean newValue)(Code)(Java Doc)
public static void setFileNameMap(FileNameMap map)(Code)(Java Doc)
public void setIfModifiedSince(long newValue)(Code)(Java Doc)
public void setReadTimeout(int timeout)(Code)(Java Doc)
public void setRequestProperty(String field, String newValue)(Code)(Java Doc)
public void setUseCaches(boolean newValue)(Code)(Java Doc)
public String toString()(Code)(Java Doc)

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

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.