URL Programming Mimi Opkins CECS277. What is a URL?  URL is an acronym for Uniform Resource Locator and is a reference (an address) to a resource on.

Slides:



Advertisements
Similar presentations
XP 1 Developing a Basic Web Site Tutorial 2: Web Site Structures & Links.
Advertisements

Web Technologies Uniform Resource Locators (URLs)
Programming TCP Clients Version InetAddress Class An IP address identifies uniquely a host in the internet, which consists of 4 numbers (1 byte.
Prepared By E. Musa Alyaman1 URLs, InetAddresses, and URLConnections Chapter 9.
XP Adding Hypertext Links to a Web Page. XP Objectives Create hypertext links between elements within a Web page Create hypertext links between Web pages.
Programming TCP Clients. InetAddress Class An IP address identifies uniquely a host in the internet, which consists of 4 numbers (1 byte each one) in.
1 Java Networking CS , Spring 2008/9. 2 Today’s Menu Networking Basics  TCP, UDP, Ports, DNS, Client-Server Model TCP/IP in Java Sockets URL 
Internet Programming In Java. References Java.sun.com Java552 Many of the programs shown.
Networking with Java 1: The Client Side. Introduction to Networking.
Projekt współfinansowany przez Unię Europejską w ramach Europejskiego Funduszu Społecznego „Networking”
Programming TCP Clients. InetAddress Class An IP address identifies uniquely a host in the internet, which consists of 4 numbers (1 byte each one) in.
28-Jun-15 Basic Protocols. 2 Sockets Sockets, or ports, are a very low level software construct that allows computers to talk to one another When you.
Networking Support In Java Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
Programming TCP Clients Version InetAddress Class An IP address identifies uniquely a host in the internet, which consists of 4 numbers (1 byte.
1 Java Networking – part I CS , Winter 2007/8.
Introduction 2: Internet, Intranet, and Extranet J394 – Perancangan Situs Web Program Sudi Manajemen Universitas Bina Nusantara.
13-Jul-15 Sockets and URLs. 2 Sockets A socket is a low-level software device for connecting two computers together Sockets can also be used to connect.
15-Jul-15 Basic Protocols. 2 Sockets Sockets, or ports, are a very low level software construct that allows computers to talk to one another When you.
Networking java.net package, which provides support for networking. Its creators have called Java “programming for the Internet.” Socket :- A network socket.
1 Networking with Java. 2 Introduction to Networking.
1 Java Networking CS , Spring Today’s Menu Networking Basics  TCP, UDP, Ports, DNS, Client-Server Model TCP/IP in Java Sockets URL  The.
Ryerson University CPS Distributing Computing with Java.
Appendix F: Network Programming in Java ©SoftMoore ConsultingSlide 1.
The Internet COM 366 Web Design & Production. Brief history Internet began as nationwide network for Department of Defense in 1960s –Expanded to universities.
Lectures and Practicals Mon 8-10 SC1222 TUE SC1222 Office: SC Website: mis.csit.sci.tsu.ac.th/kanida.
Application Protocols: HTTP CSNB534 Semester 2, 2007/2008 Asma Shakil.
ASHIMA KALRA IMPORTANT TERMS.  WWW WWW  URL URL  HTTP PROTOCOL HTTP PROTOCOL  PROXIES PROXIES.
Parts of a URL (Uniform Resource Locator). Let’s study more closely what the parts of this string indicate.
4-Oct-15 Basic Protocols. 2 Sockets Sockets, or ports, are a very low level software construct that allows computers to talk to one another When you send.
HOW WEB SERVER WORKS? By- PUSHPENDU MONDAL RAJAT CHAUHAN RAHUL YADAV RANJIT MEENA RAHUL TYAGI.
Import java.net.*; import java.io.*; public class LowPortScanner { public static void main(String[] args) { String host = "localhost"; if (args.length.
World Wide Web Raghunath M D BSNL Mobile Services, Ernakulam, Ph:
Adding Links Learning Web Design: Chapter 6. Lesson Overview Using the anchor tag Linking to other pages with relative or absolute pathnames Linking to.
Based on OOP with Java, by David J. Barnes Input-Output1 The java.io Package 4 Text files Reader and Writer classes 4 Byte stream files InputStream, FileInputStream,
Servlet Communication Other Servlets, HTML pages, objects shared among servlets on same server Servlets on another server with HTTP request of the other.
CS 11 java track: lecture 6 This week: networking basics Sockets Vectors parsing strings.
Lecture 9 Network programming. Manipulating URLs URL is an acronym for Uniform Resource Locator and is a reference (an address) to a resource on the Internet.
A DVANCED P ROGRAMMING USING J AVA N ETWORKING B ASICS Prepared by / Nael Alian University of Palestine 1.
NETWORK PROGRAMMING.
Networks Sockets and Streams. TCP/IP in action server ports …65535 lower port numbers ( ) are reserved port echo7 time13 ftp20 telnet23.
StreamTokenizer Break up a stream of text into pieces called tokens A token is the smallest unit recognized by a text parsing algorithm (words, symbols,
HTML BTEC National in Computing Section5. Create Information “HTML: defining HTML, discussing HTML uses and demonstrating HTML basics, HTML structure…..
CS 4244: Internet Programming Network Programming in Java 1.0.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Chapter 12: Accessing the Web URL (Uniform Resource Locator) class Applet methods –for audio clips –for images –context interface.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
Java Programming II Java Network (I) Java Programming II.
1 Lecture 9: Network programming. 2 Manipulating URLs URL is an acronym for Uniform Resource Locator and is a reference (an address) to a resource on.
Network Programming: Servers. Agenda l Steps for creating a server Create a ServerSocket object Create a Socket object from ServerSocket Create an input.
INTERNET AND . WHAT IS INTERNET The Internet can be defined as the wired or wireless mode of communication through which one can receive, transmit.
How Web Servers and The Internet Work The Basic Process.
Date of download: 5/28/2016 From: Medical Resources on the Internet Ann Intern Med. 1995;123(2): doi: / Components.
Working with URLs CSIE, National University of Tainan.
Surfing the Net. SURFING Surfing means to browse by going from place to place in search of something that interests you. On the internet, surfing means.
Network Programming in Java CS 1111 Ryan Layer May 3, 2010
ET710 What are Hyperlinks? A hyperlink, or hot link, is a selectable element in an electronic document that serves as an access point to.
Warm Handshake with Websites, Servers and Web Servers:
Network Programming Introduction
Network Programming Introduction
Sockets and URLs 17-Sep-18.
„Networking”.
Sockets and URLs 13-Nov-18.
Basic Protocols 24-Nov-18.
URL in Java C343 Lab (Week 13).
Networking.
Sockets and URLs 3-Dec-18.
Basic Protocols 19-Feb-19.
Uniform Resource Locator: URL
Programming TCP Clients
Presentation transcript:

URL Programming Mimi Opkins CECS277

What is a URL?  URL is an acronym for Uniform Resource Locator and is a reference (an address) to a resource on the Internet.  A URL has two main components: Protocol identifier: For the URL the protocol identifier is http. Resource name: For the URL the resource name is example.com.

Protocol Identifier  Note that the protocol identifier and the resource name are separated by a colon and two forward slashes.  The protocol identifier indicates the name of the protocol to be used to fetch the resource.  The example uses the Hypertext Transfer Protocol (HTTP), which is typically used to serve up hypertext documents. HTTP is just one of many different protocols used to access different types of resources on the net.  Other protocols include File Transfer Protocol (FTP), Gopher, File, and News.

Resource Name  The resource name is the complete address to the resource.  The format of the resource name depends entirely on the protocol used, but for many protocols, including HTTP, the resource name contains one or more of the following components: Host Name The name of the machine on which the resource lives. Filename The pathname to the file on the machine. Port Number The port number to which to connect (typically optional). Reference A reference to a named anchor within a resource that usually identifies a specific location within a file (typically optional).

Required Data  For many protocols, the host name and the filename are required, while the port number and reference are optional.  For example, the resource name for an HTTP URL must specify a server on the network (Host Name) and the path to the document on that machine (Filename).  It also can specify a port number and a reference.

Constructing a URL  The easiest way to create a URL object is from a String that represents the human- readable form of the URL address. This is typically the form that another person will use for a URL.  In your Java program, you can use a String containing this text to create a URL object: URL myURL = new URL("  The URL object created above represents an absolute URL. An absolute URL contains all of the information necessary to reach the resource in question.  You can also create URL objects from a relative URL address.  A relative URL contains only enough information to reach the resource relative to (or in the context of) another URL.

Parsing a URL The URL class provides several methods that let you query URL objects. You can get the protocol, authority, host name, port number, path, query, filename, and reference from a URL using these accessor methods: getProtocol Returns the protocol identifier component of the URL. getAuthority Returns the authority component of the URL. getHost Returns the host name component of the URL. getPort Returns the port number component of the URL. The getPort method returns an integer that is the port number. If the port is not set, getPort returns -1. getPath Returns the path component of this URL. getQuery Returns the query component of this URL. getFile Returns the filename component of the URL. The getFile method returns the same as getPath, plus the concatenation of the value of getQuery, if any. getRef Returns the reference component of the URL.

Reading From a URL import java.net.*; import java.io.*; public class URLReader { public static void main(String[] args) throws Exception { URL oracle = new URL(" BufferedReader in = new BufferedReader( new InputStreamReader(oracle.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); }