1 HTTP and some other odds and ends Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.

Slides:



Advertisements
Similar presentations
HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
Advertisements

HyperText Transfer Protocol (HTTP)
1 HTTP – HyperText Transfer Protocol Part 1. 2 Common Protocols In order for two remote machines to “ understand ” each other they should –‘‘ speak the.
CS320 Web and Internet Programming Generating HTTP Responses
16-Jun-15 HTTP Hypertext Transfer Protocol. 2 HTTP messages HTTP is the language that web clients and web servers use to talk to each other HTTP is largely.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
How the web works: HTTP and CGI explained
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Know how HTTP accesses data on the WWW Objectives.
Servlets and JSP Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July.
Web, HTTP and Web Caching
CS 142 Lecture Notes: HTTPSlide 1 HTTP Request GET /index.html HTTP/1.1 Host: User-Agent: Mozilla/5.0 Accept: text/html, */* Accept-Language:
HTTP Overview Vijayan Sugumaran School of Business Administration Oakland University.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
Client, Server, HTTP, IP Address, Domain Name. Client-Server Model Client Bob Yahoo Server yahoo.com/finance.html A text file named finance.html.
CSC 2720 Building Web Applications Servlet – Getting and Setting HTTP Headers.
PL-IV- Group A HTTP Request & Response Header
Definition Servlet: Servlet is a java class which extends the functionality of web server by dynamically generating web pages. Web server: It is a server.
Lecture 4: stateful inspection, advanced protocols Roei Ben-Harush 2015.
Rensselaer Polytechnic Institute CSC-432 – Operating Systems David Goldschmidt, Ph.D.
Web technologies and programming cse hypermedia and multimedia technology Fanis Tsandilas April 3, 2007.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Java Technology and Applications
SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery Web Services A web service is a software system that supports interaction (requesting data,
HTTP Protocol Specification
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Mail (smtp), VoIP (sip, rtp)
HyperText Transfer Protocol (HTTP).  HTTP is the protocol that supports communication between web browsers and web servers.  A “Web Server” is a HTTP.
CSC 2720 Building Web Applications Getting and Setting HTTP Headers (With PHP Examples)
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
2: Application Layer1 CS 4244: Internet Software Development Dr. Eli Tilevich.
Application Layer 2 Figures from Kurose and Ross
Rensselaer Polytechnic Institute Shivkumar Kalvanaraman, Biplab Sikdar 1 The Web: the http protocol http: hypertext transfer protocol Web’s application.
Week 11: Application Layer1 Web and HTTP First some jargon r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file,…
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
CS 190 Lecture Notes: Tweeter ProjectSlide 1 Uniform Resource Locators (URLs) Scheme Host.
WWW, HTTP, GET, POST, Cookies Svetlin Nakov Telerik Corporation
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 17 This presentation © 2004, MacAvon Media Productions Multimedia and Networks.
1 Introductory material. This module illustrates the interactions of the protocols of the TCP/IP protocol suite with the help of an example. The example.
Proxy Lab Recitation I Monday Nov 20, 2006.
1 HTTP EECS 325/425, Fall 2005 September Chapter 2: Application layer r 2.1 Principles of network applications m app architectures m app requirements.
HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.
Introduction to Java Network Programming and HTTP
Appendix E: Overview of HTTP ©SoftMoore ConsultingSlide 1.
Application Layer 2-1 Lecture 4: Web and HTTP. Web and HTTP First, a review… web page consists of objects object can be HTML file, JPEG image, Java applet,
2: Application Layer 1 Chapter 2: Application layer r 2.1 Principles of network applications  app architectures  app requirements r 2.2 Web and HTTP.
The Basics of HTTP Jason Dean
Advance Computer Networks Lecture#05 Instructor: Engr. Muhammad Mateen Yaqoob.
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/7/10.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 17 This presentation © 2004, MacAvon Media Productions Multimedia and Networks.
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
Summer 2007 Florida Atlantic University Department of Computer Science & Engineering COP 4814 – Web Services Dr. Roy Levow Part 1 – Introducing Ajax.
1 10/19/05CS360 Windows Programming ASP.NET. 2 10/19/05CS360 Windows Programming ASP.NET  ASP.NET works on top of the HTTP protocol  Takes advantage.
Overview of Servlets and JSP
HTTP protocol Java Servlets. HTTP protocol Web system communicates with end-user via HTTP protocol HTTP protocol methods: GET, POST, HEAD, PUT, OPTIONS,
LURP Details. LURP Lab Details  1.Given a GET … call a proxy CGI script in the same way you would for a normal CGI request  2.This UDP perl.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 7 Omar Meqdadi Department of Computer Science and Software Engineering University of.
EEC-484/584 Computer Networks Lecture 4 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
COMP2322 Lab 2 HTTP Steven Lee Jan. 29, HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):
Web Caching. Why Caching? Faster browsing experience for users Cache hit rate Traffic Prioritization Reduce network bandwidth requirements significantly.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Week 11: Application Layer 1 Web and HTTP r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file,… r Web page consists.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
Lecture 4: Stateful Inspection, Advanced Protocols.
Building Web Apps with Servlets
HTTP – An overview.
The Hypertext Transfer Protocol
Introduction to Client/Server Design
HTTP Request Method URL Protocol Version GET /index.html HTTP/1.1
Presentation transcript:

1 HTTP and some other odds and ends Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park

2 For your amusement Original 1991 HTTP spec barely one page As defined in

3 HTTP GET Request HTTP GET Request GET request HTTP/1.0 or GET request HTTP/1.1 Followed by any number of other HTTP request lines Followed by a blank line

4 Other sample headers Accept: */* Accept-Language: en Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/417.9 (KHTML, like Gecko) Safari/417.8 Connection: keep-alive Host: localhost:8888

5 Other HTTP requests HEAD just requests information about a page (size, last time it was modified) body of page not sent POST should be used for any HTTP request that will modify state should always be OK to repeat a GET request, not so with POST parameters sent in body of request, after blank line, rather than in URL

6 Obscure HTTP requests The HTTP protocol defines some additional requests (e.g., DELETE) that almost nobody uses or supports

7 HTTP Response status line any number of response headers a blank line response data (binary format)

8 HTTP Response Status HTTP/ OK the http version the server is speaking a numeric status code a string description of the reason for the status

9 HTTP response headers Sample: Date: Wed, 01 Mar :27:02 GMT Server: Apache Accept-Ranges: bytes Connection: close Content-Type: text/html; charset=ISO Content-Type is the only one that is really required

10 HTTP body Body needs to be treated as binary data If you open a JPEG file as a text file, read lines of text from it and print them to a writer wrapped around the socket output stream it will not work So, how do you handle this?

11 Mixed text/binary output OutputStream Network PrintWriter w.println(“HTTP/ OK”); PrintWriter w = new PrintWriter(out); // PrintWriter autoflushes w.println(“Content-Type: text/html”); // just one byte of data for this example out.write(data); // PrintWriter autoflushes again w.println(); out.close(); Text bytes

12 One more thing... Reflection The ability of Java programs to look at what classes, methods and fields are defined and manipulate/invoke/access classes/methods/fields specified by strings rather than by compiled code Among other things allows your code to load/invoke code written after your code was compiled and shipped has to have access to new code has to get names of code to invoke

13 Class objects For each class in Java, there is a Class object associated with that class Use x.getClass() to get Class object associated with object referenced by x Use, for example, String.class to get Class object associated with class String Use Class.forName(s) to get the class named by the String s

14 newInstance() Given a Class object, you can create an instance of that class by invoking newInstance() on the Class object you will usually want to cast the result to some type Creates the instance using the void constructor for the class. Runtime error if there is no accessible void constructor