Web Server Assignment1 Reference (http://java.sun.com/products/jdk/1.3/docs/api/packages.html) Main class (for example : MyServer.java) –Initialization.

Slides:



Advertisements
Similar presentations
CGI & HTML forms CGI Common Gateway Interface  A web server is only a pipe between user-agents  and content – it does not generate content.
Advertisements

1/16 Steven Leung Introduction to HTML/CGI/JavaScript Intro to HTML/CGI/JavaScript How the Web Works HTML: Basic Concept CGI: Basic Concept JavaScript:
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
Prepared By E. Musa Alyaman1 URLs, InetAddresses, and URLConnections Chapter 9.
JavaScript Forms Form Validation Cookies CGI Programs.
Web Server Project More tips on How to. Getting started – think of what to do (1) Process configuration –Port –MaxThreads –ScriptAlias –Alias –DocumentRoot.
1 Web Search Interfaces. 2 Web Search Interface Web search engines of course need a web-based interface. Search page must accept a query string and submit.
CP476 Internet Computing Browser and Web Server 1 Web Browsers A client software program that allows you to access and view Web pages on the Internet –Examples.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Web Integration to an Appx Backend Server. Unix web servers + CGI Win2K web servers + ASP Win2K web servers + ODBC Processing requests Generating HTML.
Web Client/Server Communication A290/A590, Fall /09/2014.
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
Linux Operations and Administration
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Chapter 9 Using Perl for CGI Programming. Computation is required to support sophisticated web applications Computation can be done by the server or the.
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
Overview A plain HTML document is static A CGI program is executed in real-time, so that it can output dynamic information. CGI (Common Gateway Interface)
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
HTTP; The World Wide Web Protocol
Web Security Programming I Building Security in from the Start Except where otherwise noted all portions of this work are Copyright (c) 2007 Google and.
Apache Server The Apache Server Apache is a WWW server that implements the HTTP protocol. Apache runs as a daemon. This means that it is a resident.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Web Servers1-1 Web Servers Xingquan (Hill) Zhu
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Understand the components of a browser and a server Understand.
Application Protocols: HTTP CSNB534 Semester 2, 2007/2008 Asma Shakil.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 12 Communicating over.
USING PERL FOR CGI PROGRAMMING
CSE 190: Internet E-Commerce Lecture 5. Exam Material Lectures 1-4 (Presentation Tier) –3-tier architecture –HTML –Style sheets –Javascript –DOM –HTTP.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 7: HTTP and CGI Fundamentals of Web Programming.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
CS 11 java track: lecture 6 This week: networking basics Sockets Vectors parsing strings.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
Web Design & Development 1 Lec - 21 Umair Javed. Web Design & Development 2 Socket Programming.
Networks Sockets and Streams. TCP/IP in action server ports …65535 lower port numbers ( ) are reserved port echo7 time13 ftp20 telnet23.
7 1 User-Defined Functions CGI/Perl Programming By Diane Zak.
Lab 2 Primer Assignment 3 Structure File I/O More parsing and HTTP Formatting.
Form Data Encoding GET – URL encoded POST – URL encoded
Appendix E: Overview of HTTP ©SoftMoore ConsultingSlide 1.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
CITA 310 Section 2 HTTP (Selected Topics from Textbook Chapter 6)
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
ICM – API Server & Forms Gary Ratcliffe.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
CSC 2720 Building Web Applications Basic Frameworks for Building Dynamic Web Sites / Web Applications.
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
NMD202 Web Scripting Week2. Web site
CS 330 Class 8 Homework A pattern that contains a word with an optional period A pattern that contains Fred with a space (not Freddy) See regexp.txt guest4.htm.
Introduction to CGI PROG. CGI stands for Common Gateway Interface. CGI is a standard programming interface to Web servers that gives us a way to make.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Lesson 11. CGI CGI is the interface between a Web page or browser and a Web server that is running a certain program/script. The CGI (Common Gateway Interface)
CS 330 Class 7 Comments on Exam Programming plan for today:
z/Ware 2.0 Technical Overview
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Uniform Resource Locators
Uniform Resource Locators (URLs)
Lecture 5: Functions and Parameters
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Uniform Resource Locators
PHP PART 2.
Presentation transcript:

Web Server Assignment1 Reference ( Main class (for example : MyServer.java) –Initialization : Read in configuration files and make proper data structures (recommend to create a new class what separates the configuration part) httpd.conf : document root and aliases including ScriptAlias, port number and etc mime.conf : make a data structure that associates between extension and type Hints for Your Web Server Structure

Web Server Assignment2 Main class (continue) –Create Serversocket and socket and repeat waiting for connection & processing the request ServerSocket ding = new ServerSocket(Portnumber); Socket dong = null; while (true) { –wait for connection using dong = ding.accept(); –process request by »1. parse the request (create a HTTP message class) »2. apply the configurations such as Alias, DocumentRoot and etc »3. process the request »4. generate a response }

Web Server Assignment3 Java Classes –Use InputStream and OutputStream to communicate between Server and browser, between server and subprocess (for CGI) –Utilize InputStreamReader, BufferedReader to make your life easier InputStream input = clSock.getInputStream(); // Socket clSock; inReader = new InputStreamReader(inS); //InputStream inS; bf = new BufferedReader(inReader); String inStr = bf.readLine(); –Utilize StringTokenizer for parsing request message StringTokenizer st = new StringTokenizer(inStr, ": "); token = st.nextToken(); setHeaders(st, token); –Utilize Process, Runtime class for invoking a new process Process sub; Runtime r = Runtime.getRuntime(); // Setup the environment variables into ‘env’, the array of String sub = r.exec(cgifile, env); OutputStream clOs = clSock.getOutputStream(); BufferedInputStream bis = new BufferedInputStream(sub.getInputStream());

Web Server Assignment4 Read and Parse HTTP message Create a class that reads, parses the HTTP message and stores each processed value (QUERY_STRING, URL, etc). Read first line –If GET method is used, Extract URL, protocol. –Check if ‘?’ exists within URL if then, extract QUERY_STRING –Read following lines and process header and its value pairs –If Post method is used, process body (read in for passing it to sub process) Apply DocumentRoot, ScripAliase, or Aliase to generate an absolute path (or relative to the server program) of the requested document or script

Web Server Assignment5 Process the request –Check if the request is valid (available, readable, or executable) –Check if the request is text- read in html/plain file image - read in image file script - execute the script and retrieve the result –Generate a response with proper status, headers and attach the body Return the response