Get response code : HttpURLConnection « Network « Java Tutorial [PDF]

Get response code : HttpURLConnection « Network « Java Tutorial.

3 downloads 25 Views 45KB Size

Recommend Stories


Java Tutorial
Live as if you were to die tomorrow. Learn as if you were to live forever. Mahatma Gandhi

Java Tutorial
I tried to make sense of the Four Books, until love arrived, and it all became a single syllable. Yunus

Java Network Programming Pdf
Suffering is a gift. In it is hidden mercy. Rumi

PDF The Java EE 7 Tutorial
Suffering is a gift. In it is hidden mercy. Rumi

Java tutorial: J2SE
Respond to every call that excites your spirit. Rumi

Java 3D Einstiegs-Tutorial Teil 1 (PDF)
Learning never exhausts the mind. Leonardo da Vinci

Review PDF The Java EE 7 Tutorial
This being human is a guest house. Every morning is a new arrival. A joy, a depression, a meanness,

Tutorial: The Siesta Code
Keep your face always toward the sunshine - and shadows will fall behind you. Walt Whitman

Java Code Test Brochure
The greatest of richness is the richness of the soul. Prophet Muhammad (Peace be upon him)

Java Code Conventions
Don't ruin a good today by thinking about a bad yesterday. Let it go. Anonymous

Idea Transcript


Home (http://www.java2s.com) Java Tutorial (/Tutorial/Java/CatalogJava.htm) Language (/Tutorial/Java/0020__Language/ Catalog0020__Language.htm) Data Type (/Tutorial/Java/0040__DataType/Catalog0040__DataType.htm) Operators (/Tutorial/Java/0060__Operators/ Catalog0060__Operators.htm) Statement Control (/Tutorial/Java/0080__StatementControl/Catalog0080__StatementControl.htm) Class Definition (/Tutorial/Java/0100__ClassDefinition/Catalog0100__ClassDefinition.htm) Development (/Tutorial/Java/0120__Developme nt/Catalog0120__Development.ht m) Reflection (/Tutorial/Java/0125__Reflection/C atalog0125__Reflection.htm) Regular Expressions (/Tutorial/Java/0130__RegularExpressions/Catalog0130__Regul ar-Expressions.htm) Collections (/Tutorial/Java/0140__Collections/ Catalog0140__Collections.htm) Thread (/Tutorial/Java/0160__Thread/Cat alog0160__Thread.htm) File (/Tutorial/Java/0180__File/Catalog 0180__File.htm) Generics (/Tutorial/Java/0200__Generics/C atalog0200__Generics.htm) I18N (/Tutorial/Java/0220__I18N/Catalo g0220__I18N.htm) Swing (/Tutorial/Java/0240__Swing/Catal og0240__Swing.htm) Swing Event (/Tutorial/Java/0260__SwingEvent/Catalog0260__SwingEvent.htm) 2D Graphics (/Tutorial/Java/0261__2DGraphics/Catalog0261__2DGraphics.htm) SWT (/Tutorial/Java/0280__SWT/Catalo g0280__SWT.htm) SWT 2D Graphics (/Tutorial/Java/0300__SWT-2DGraphics/Catalog0300__SWT-2DGraphics.htm) Network () Database (/Tutorial/Java/0340__Database/C atalog0340__Database.htm) Hibernate (/Tutorial/Java/0350__Hibernate/C atalog0350__Hibernate.htm) JPA (/Tutorial/Java/0355__JPA/Catalo g0355__JPA.htm) JSP (/Tutorial/Java/0360__JSP/Catalo g0360__JSP.htm) JSTL (/Tutorial/Java/0380__JSTL/Catal og0380__JSTL.htm) Servlet (/Tutorial/Java/0400__Servlet/Cat alog0400__Servlet.htm) Web Services SOA (/Tutorial/Java/0410__WebServicesSOA/Catalog0410__WebServices-SOA.htm) EJB3 (/Tutorial/Java/0415__EJB3/Catal og0415__EJB3.htm) Spring (/Tutorial/Java/0417__Spring/Cata log0417__Spring.htm) PDF (/Tutorial/Java/0419__PDF/Catalo g0419__PDF.htm) Email

Get response code : HttpURLConnection « Network « Java Tutorial

Search

Java Tutorial (/Tutorial/Java/CatalogJava.htm) / Network (/Tutorial/Java/0320__Network/Catalog0320__Network.htm) / HttpURLConnection (/Tutorial/Java/0320__Network/0050__HttpURLConnection.htm) /

import java.net.HttpURLConnection; import java.net.URL; import java.util.Date; public class Main{ public static void main(String args[]) throws Exception { URL url = new URL("http://www.google.com"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();

System.out.println("Response code is " + httpCon.getResponseCode()); } }

19.6.HttpURLConnection 19.6.1.

Get the date of a url connection (/Tutorial/Java/0320__Network/Getthedateofaurlconnection.htm)

19.6.2.

Get the document expiration date (/Tutorial/Java/0320__Network/Getthedocumentexpirationdate.htm)

19.6.3.

Get the document Last-modified date (/Tutorial/Java/0320__Network/GetthedocumentLastmodifieddate.htm)

19.6.4.

Show the content type (/Tutorial/Java/0320__Network/Showthecontenttype.htm)

19.6.5.

Show the content length (/Tutorial/Java/0320__Network/Showthecontentlength.htm)

19.6.6.

Display request method (/Tutorial/Java/0320__Network/Displayrequestmethod.htm)

19.6.7.

Get response code

19.6.8.

Display response message (/Tutorial/Java/0320__Network/Displayresponsemessage.htm)

19.6.9.

Display header information (/Tutorial/Java/0320__Network/Displayheaderinformation.htm)

19.6.10.

Download and display the content (/Tutorial/Java/0320__Network/Downloadanddisplaythecontent.htm)

19.6.11.

A Web Page Source Viewer (/Tutorial/Java/0320__Network/AWebPageSourceViewer.htm)

19.6.12.

Reading from a URLConnection (/Tutorial/Java/0320__Network/ReadingfromaURLConnection.htm)

19.6.13.

Use BufferedReader to read content from a URL (/Tutorial/Java/0320__Network/UseBufferedReadertoreadcontentfromaURL.htm)

19.6.14.

Check if a page exists (/Tutorial/Java/0320__Network/Checkifapageexists.htm)

19.6.15.

Identify ourself to a proxy (/Tutorial/Java/0320__Network/Identifyourselftoaproxy.htm)

19.6.16.

Connect through a Proxy (/Tutorial/Java/0320__Network/ConnectthroughaProxy.htm)

19.6.17.

java.net.Authenticator can be used to send the credentials when needed (/Tutorial/Java/0320__Network/javanetAuthenticatorcanbeusedtosendthecredentialswhenneeded.htm)

19.6.18.

Read data from a URL (/Tutorial/Java/0320__Network/ReaddatafromaURL.htm)

19.6.19.

Dump a page using the HTTPS protocol (/Tutorial/Java/0320__Network/DumpapageusingtheHTTPSprotocol.htm)

19.6.20.

Save URL contents to a file (/Tutorial/Java/0320__Network/SaveURLcontentstoafile.htm)

19.6.21.

Http connection Utilities (/Tutorial/Java/0320__Network/HttpconnectionUtilities.htm)

19.6.22.

Parsing and formatting HTTP dates as used in cookies and other headers. (/Tutorial/Java/0320__Network/ParsingandformattingHTTPdatesasusedincookiesandotherheaders.htm)

19.6.23.

Last Modified (/Tutorial/Java/0320__Network/LastModified.htm)

19.6.24.

URL connection and proxy (/Tutorial/Java/0320__Network/URLconnectionandproxy.htm)

19.6.25.

Http Constants (/Tutorial/Java/0320__Network/HttpConstants.htm)

19.6.26.

Http Header Helper (/Tutorial/Java/0320__Network/HttpHeaderHelper.htm)

(/Tutorial/Java/0420__Email/Catal og0420__Email.htm) J2ME (/Tutorial/Java/0430__J2ME/Catal og0430__J2ME.htm) J2EE Application (/Tutorial/Java/0440__J2EEApplication/Catalog0440__J2EEApplication.htm) XML (/Tutorial/Java/0440__XML/Catalo g0440__XML.htm) Design Pattern (/Tutorial/Java/0460__DesignPattern/Catalog0460__DesignPattern.htm) Log (/Tutorial/Java/0480__Log/Catalog 0480__Log.htm) Security (/Tutorial/Java/0490__Security/Cat alog0490__Security.htm) Apache Common (/Tutorial/Java/0500__ApacheCommon/Catalog0500__ApacheCommon.htm) Ant (/Tutorial/Java/0520__Ant/Catalog 0520__Ant.htm) JUnit (/Tutorial/Java/0540__JUnit/Catalo g0540__JUnit.htm)

19.6.27.

A utility class for parsing HTTP dates as used in cookies and other headers (/Tutorial/Java/0320__Network/AutilityclassforparsingHTTPdatesasusedincookiesandotherheaders.htm)

java2s.com (http://www.java2s.com/) | Email:info at java2s.com | © Demo Source and Support. All rights reserved.

Smile Life

When life gives you a hundred reasons to cry, show life that you have a thousand reasons to smile

Get in touch

© Copyright 2015 - 2024 PDFFOX.COM - All rights reserved.