unit 1 programming web vtu

Upload: prasad-sachidananda

Post on 08-Aug-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/22/2019 Unit 1 Programming WEB VTU

    1/48

    Prasad B SAssistant Professor

    Dept. of CSE\ISESDMIT, Ujire

    8/20/2013 1

  • 8/22/2019 Unit 1 Programming WEB VTU

    2/48

    1960s- U.S Department of Defense (DoD) becameinterested in developing a new large scalecomputer network.

    The DoDs Advanced Research Projects Agency(ARPA) funded the construction of the first suchnetwork established at UCLA in 1969 . Hence it wasnamed as ARPAnet.

    Early use-simple text-based communicationsthrough e-mail.

    8/20/2013 2

  • 8/22/2019 Unit 1 Programming WEB VTU

    3/48

    Other Networks (1970s-80s) BITNET( Because its Time network) by City University of

    New York

    CSNET (Computer Science Network) connected Universityof Delware, Purdue University, University of Wisconsin,RAND Corporation etc. Provided E-mail service.

    NSEnet( National Science Foundation) in 1986 initially

    connected five universities later connected manyorganization and establishment and connected 1millioncomputers by 1992. In 1995 it became known asInternet.

    8/20/2013 3

  • 8/22/2019 Unit 1 Programming WEB VTU

    4/48

    The Internet is a global system of interconnectedcomputer networksthat use the standardInternet Protocol Suite (TCP/IP)

    Since 1982, all connections use TCP/IP- TCP/IP

    hides the differences among devices connectedto the Internet

    It consists of millions of private, public,academic, business, and government networks oflocal to global scope that are linked by a broadarray of electronic and optical networkingtechnologies.

    8/20/2013 4

  • 8/22/2019 Unit 1 Programming WEB VTU

    5/48

    All devices connected to the Internet areuniquely identified using IP address.

    The Internet Protocol (IP) address of amachine connected to the Internet is a unique32-bit number.

    IP addresses usually are written as four 8-bitnumbers, separated by periods.

    New standard IPv6 128 bits.http://www.ip-adress.com/whois/devilsproxy.com

    8/20/2013 5

    http://www.ip-adress.com/whois/devilsproxy.comhttp://www.ip-adress.com/whois/devilsproxy.comhttp://www.ip-adress.com/whois/devilsproxy.comhttp://www.ip-adress.com/whois/devilsproxy.com
  • 8/22/2019 Unit 1 Programming WEB VTU

    6/48

    Text based names to remember IP address technicallyknown as Domain Name System(DNS).

    These names begin with the names of the hostmachine, followed by progressively larger enclosingcollection of machines, called domains.

    There may be two, three or more domain names. DNSis of the formhostname.domainName.domainName .Example:vtu.ac.in First domain : Hostname

    Second domain and so on : Domain of which firstdomain is a part Last Domain : Type of organization. Ex: .com, .gov,

    .org, .in

    8/20/2013 6

  • 8/22/2019 Unit 1 Programming WEB VTU

    7/48

    The DNS has to be converted to IP address beforedestination is reached because computer understands only

    numbers.

    The conversion is done with the help of name server.

    As soon as domain name is provided, it will be sent acrossthe internet to contact name servers.

    This name server is responsible for converting domain

    name to IP, If one of the name servers is not able to convert

    DNS to IP, it contacts other name server.

    This process continues until IP address is generated. Oncethe IP address is generated, the host can be accessed.

    The hostname and all domain names form what is known as

    FULLY QUALIFIED DOMAIN NAME.

    8/20/2013 7

  • 8/22/2019 Unit 1 Programming WEB VTU

    8/488/20/2013 8

  • 8/22/2019 Unit 1 Programming WEB VTU

    9/48

    In 1980s, different protocols on TCP\IP hadbeen developed to developed to support avariety of Internet uses. FTP To transfer files over Internet

    Telenet- Remote login

    Usenet Electronic bulletin board

    mailto message over Internet

    Drawback: User had to learn interfaces of all

    the different protocols.

    Solution: World Wide Web (WWW)

    8/20/2013 9

  • 8/22/2019 Unit 1 Programming WEB VTU

    10/48

    1989: Tim Berners Lee and his group proposed a new

    protocol for the Internet whose intention was to allowdocuments exchange.

    The proposed new system was designed to allow auser anywhere on the Internet to search for andretrieve documents from the databases on anynumber of different document-serving computers.

    The system used hypertext, which is text withembedded links to text in other documents to allownon-sequential browsing of textual material.

    8/20/2013 10

  • 8/22/2019 Unit 1 Programming WEB VTU

    11/48

    Units of Web information: Pages Documents Resources

    Documents are texts with embedded links toother documents, they mal also have images,sound recordings or other media. In suchcase it is called hypermedia.

    These documents can be accessed by webbrowsers and are provided by web servers.

    8/20/2013 11

  • 8/22/2019 Unit 1 Programming WEB VTU

    12/48

    It is important to understand that the Internetand the Web is not the same thing.

    The Internet is a collection of computers and otherdevices connected by equipment that allows themto communicate with each other.

    The Web is a collection of software and protocolsthat has been installed on most, if not all, of thecomputers on the Internet

    8/20/2013 12

  • 8/22/2019 Unit 1 Programming WEB VTU

    13/48

    Client: Request for Information. Server: Provides service by providing

    requested information.

    Most application on WEB operates in thisclient\server configuration.

    Client: Web Browser

    Server: Web Server

    8/20/2013 13

  • 8/22/2019 Unit 1 Programming WEB VTU

    14/48

    8/20/2013 14

    Documents provided by servers on the Web are

    requested by browsers, which are programsrunning on client machines.

    First browsers were text based, not capable ofdisplaying graphics, images, interface.

    1993, Mosaic, first graphical interface browser,developed by NCSA ( National center for supercomputer application)

    Resulted in explosive growth of web usage.

  • 8/22/2019 Unit 1 Programming WEB VTU

    15/48

    8/20/2013 15

  • 8/22/2019 Unit 1 Programming WEB VTU

    16/48

    8/20/2013 16

  • 8/22/2019 Unit 1 Programming WEB VTU

    17/48

    Programs that provide documents to requestingbrowsers ( clients).

    First two servers: Server at CERN in Europe Server at NCSA at university of Illinois

    Commonly Used web servers: Apache Microsoft Internet Information Server (IIS)

    Web browser specifies a address of a data file onserver or a program stored in the server that theclient wants executed, with the output of theprogram returned to the client.

    8/20/2013 17

  • 8/22/2019 Unit 1 Programming WEB VTU

    18/48

    All the communications between a web client and a web serveruses the standard protocol HTTP

    When a web server begins execution, It informs the OS under which it is running & it runs as a background

    process

    A web client or browser,

    1. Opens a network connection to a web server,2. Sends information requests and possibly data to the server,3. Receives information from the server and4. closes the connection.

    The primary task of web server is to1. Monitor a communication port on host machine,2. Accept HTTP commands through that port and3. Perform the operations specified by the commands.

    When the URL is received, it is translated into either a filename ora program name.

    8/20/2013 18

  • 8/22/2019 Unit 1 Programming WEB VTU

    19/48

    Common characteristics of web servers

    Web servers have two main directories: 1. Document root (servable documents) 2. Server root (server system software)

    The files stored directly in the document root are those availableto clients through top level URLs

    The secondary areas from which documents can be served arecalled virtual document trees.

    Many servers can support more than one site on a computer,potentially reducing the cost of each site and making theirmaintenance more convenient. Such secondary hosts are called

    virtual hosts.

    Some servers can serve documents that are in the document rootof other machines on the web; in this case they are called asproxy servers.

    8/20/2013 19

  • 8/22/2019 Unit 1 Programming WEB VTU

    20/48

    Apache: Began as the NCSA server httpd Most widely used web server. Fast and Reliable Open source software and free Best available server for UNIX based systems

    which is preferred for servers. Contains three configuration files:

    Httpd.conf Srm.conf Access.conf

    8/20/2013 20

  • 8/22/2019 Unit 1 Programming WEB VTU

    21/48

    Supplied with Microsoft windows serversystems.

    Provides similar service to that of Apache.

    IIS Snap-in is a window based (GUI)management program to configure the serverunlike configuration file of Apache.

    8/20/2013 21

  • 8/22/2019 Unit 1 Programming WEB VTU

    22/48

    Uniform Resource Locators (URLs) are used to identify different kinds of

    resources on Internet. If the web browser wants some document from web server, just giving

    domain name is not sufficient because domain name can only be usedfor locating the server.

    It does not have information about which document client needs.

    Therefore, URL should be provided. The general format of URL is:

    scheme: object-address

    Example: http: www.vtu.ac.in/results.php The scheme indicates protocols being used. (http, ftp, telnet...) In case of http, the full form of the object address of a URL is as follows: http://fully-qualified-domain-name/path-to-document

    8/20/2013 22

  • 8/22/2019 Unit 1 Programming WEB VTU

    23/48

    URLs can never have embedded spaces. It cannot use special characters like semicolons,

    ampersands and colons The path to the document for http protocol is a sequence

    of directory names and a filename, all separated bywhatever special character the OS uses. (forward orbackward slashes)

    A path that includes all directories along the way is calleda complete path.

    Example: http://www.vtu.ac.in/index.html

    In most cases, the path to the document is relative tosome base path that is specified in the configuration filesof the server. Such paths are called partial paths.

    Example: http://www.vtu.ac.in/

    8/20/2013 23

  • 8/22/2019 Unit 1 Programming WEB VTU

    24/48

    A browser determines the format of adocument it receives by the help of MIME.

    A web server attaches MIME formatspecification to the beginning of thedocument provided to browser.

    When browser receives the document, it usesthe MIME specification to determine qwhat to

    do. MIME specification have the following format:

    type/subtype

    8/20/2013 24

  • 8/22/2019 Unit 1 Programming WEB VTU

    25/48

    The most common types of MIME are texts,image and video.

    Common text subtypes are plain and html.

    Common image subtype gif and jpeg.

    Common video subtype mpeg and quicktime.

    Server determines the file type by usingfilenames extension.

    8/20/2013 25

  • 8/22/2019 Unit 1 Programming WEB VTU

    26/48

    Name of experimental type begins with x. Ex: video/-x msvideo

    Web provider can add an experimentalsubtype by having its name added to the listof MIME specification in web providersserver.

    Web browser must supply a support program

    called helper applications or plug-ins.

    8/20/2013 26

  • 8/22/2019 Unit 1 Programming WEB VTU

    27/48

    All web communications and transactionsuses the same protocol HTTP.

    Current version is HTTP1.1- stable, formallydefines as RFC 2616.

    Two phases : Request Response

    Each communication consists of two parts, a

    header and a body. Header- Information about communication Body Data of the communication if any

    8/20/2013 27

  • 8/22/2019 Unit 1 Programming WEB VTU

    28/48

    General form of an http request is as follows:1. HTTP method Domain part of the URL HTTP version

    2. Header fields

    3. Blank line

    4. Message body Example:

    GET /cs.uccp.edu/degrees.html HTTP/1.1

    8/20/2013 28

  • 8/22/2019 Unit 1 Programming WEB VTU

    29/48

    Commonly used HTTP request methods

    8/20/2013 29

  • 8/22/2019 Unit 1 Programming WEB VTU

    30/48

    Optional Header fields have four categories: General: For general information such as date Request: Included in the request headers Response: For response headers Entity: Used in both request and response headers.

    - Common request fields: Accept: text/plain Accept: text/* If-Modified_since: date

    - Common response fields: Content-length: 488 Content-type: text/html

    8/20/2013 30

  • 8/22/2019 Unit 1 Programming WEB VTU

    31/48

    Host: hostname request field gives the nameof the host.

    If the request has a body length of the bodymust given with a content-length field.

    Header of a request must be followed by ablank line, which is used to separate theheader from the body.

    GET , HEAD, DELETE methods do not havebodies.

    8/20/2013 31

  • 8/22/2019 Unit 1 Programming WEB VTU

    32/48

    GET http://www.tiggerwigger.com/ HTTP/1.0

    Proxy-Connection: Keep-Alive

    User-Agent: Mozilla/5.0 [en] (X11; I; Linux 2.2.3 i686)

    Host: www.tiggerwigger.com

    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,

    image/png, */ *

    Accept-Encoding: gzip

    Accept-Language: en

    Accept-Charset: iso-8859-1, *, utf-8

    8/20/2013 32

  • 8/22/2019 Unit 1 Programming WEB VTU

    33/48

    The general form of an HTTP response phase1. Status line

    2. Response header fields

    3. Blank line

    4. Response body Status line

    HTTP version three digit status code status code explain

    HTTP/1.1 200 OK

    8/20/2013 33

  • 8/22/2019 Unit 1 Programming WEB VTU

    34/48

    Common status codes: 404 not found

    200- OK 500- Server encountered problem

    8/20/2013 34

  • 8/22/2019 Unit 1 Programming WEB VTU

    35/48

    Several lines of information about theresponse header.

    Content-type : only essential field.HTTP/1.1 200 OK

    Date: Sat, 25 July 2009 20:15:11 GMTServer: Apache /2.2.3 (CentOS)

    Last-modified: Tues, 18 May 2004 16:38:38 GMT

    Etag: "1b48098-16a-3dab592dc9f80"

    Accept-ranges: bytes

    Content-length: 364

    Connection: close

    Content-type: text/html, charset=UTF-8

    8/20/2013 35

  • 8/22/2019 Unit 1 Programming WEB VTU

    36/48

    Fertile ground for security problems. Transmit data without any interception and

    corruption.

    Security issues for a communication betweena browser and a server:

    1. Privacy

    2. Integrity

    3. Authentication4. Nonrepudiation

    8/20/2013 36

  • 8/22/2019 Unit 1 Programming WEB VTU

    37/48

    Encryption:Basic tool to support privacy andintegrity.

    Symmetric and Asymmetric

    Private-Key encryption and Public keyencryption

    Public key encryption in 1976 by WhitfieldDiffie and Martin Hellman.

    Most widely used public key encryption is RSAalgorithm -1977- by Ron Rivest, Adi Shamirand Leonard Adelman of MIT.

    8/20/2013 37

  • 8/22/2019 Unit 1 Programming WEB VTU

    38/48

    Viruses, Zombies, worms, hacking .. Solution is to use Anti Virus software's and

    keeping it up to date.

    Virus examples: ILOVEYOU 2000

    CodeRedvirus 2001

    Blaster Worm 2003

    8/20/2013 38

  • 8/22/2019 Unit 1 Programming WEB VTU

    39/48

    Most common tools used in the Webprogramming.

    XHMTL, XML, Javascript, Java, Perl, PHP, Ruby,AJAX, Rails

    8/20/2013 39

  • 8/22/2019 Unit 1 Programming WEB VTU

    40/48

    To describe the general form and layout of documents

    An XHTML document is a mix of content and controls

    Controls are tags and their attributes

    Tags often delimit content and specify something about how the content should be

    arranged in the document Attributes provide additional information about the content of a tag

    Tools for creating XHTML documents

    XHTML editors - make document creation easier, Shortcuts to typing tag names,

    spell-checker,

    WYSIWYG XHTML editors- Need not know XHTML to create XHTML documents

    8/20/2013 40

  • 8/22/2019 Unit 1 Programming WEB VTU

    41/48

    Plug ins

    Integrated into tools like word processors, effectively converting them to WYSIWYG

    XHTML editors

    Filters

    Convert documents in other formats to XHTML

    Advantages of both filters and plug-ins:

    Existing documents produced with other tools can be converted to XHTML documents

    Use a tool you already know to produce XHTML

    Disadvantages of both filters and plug-ins:

    XHTML output of both is not perfect - must be fine tuned

    XHTML may be non-standard

    You have two versions of the document, which are difficult to synchronize

    8/20/2013 41

  • 8/22/2019 Unit 1 Programming WEB VTU

    42/48

    XML

    A meta-markup language

    Used to create a new markup language for a particular purpose or area

    Because the tags are designed for a specific area, they can be meaningful

    No presentation details

    A simple and universal way of representing and transmitting data of any textual kind

    JavaScript

    A client-side XHTML-embedded scripting language

    Only related to Java through syntax

    Dynamically typed and not object-oriented

    Provides a way to access elements of XHTML documents and dynamically change

    them

    8/20/2013 42

  • 8/22/2019 Unit 1 Programming WEB VTU

    43/48

    Flash

    A system for building and displaying text, graphics, sound, interactivity,

    and animation (movies)

    Two parts:

    Authoring environment

    Player

    Supports both motion and shape animation

    Interactivity is supported with ActionScript

    PHP

    A server-side scripting language

    Similar to JavaScript

    Great for form processing and database access through the Web

    8/20/2013 43

  • 8/22/2019 Unit 1 Programming WEB VTU

    44/48

    Ajax

    Asynchronous JavaScript + XML

    No new technologies or languages

    Much faster for Web applications that have extensive user/server interactions

    Uses asynchronous requests to the server Requests and receives small parts of documents, resulting in much faster responses

    Java Web Software

    Servlets server-side Java classes

    JavaServer Pages(JSP) a Java-based approach to server-side scripting, an alternative

    to servlets

    JavaServer Faces adds an event-driven interface model on JSP

    8/20/2013 44

  • 8/22/2019 Unit 1 Programming WEB VTU

    45/48

    ASP.NET

    Does what JSP and JSF do, but in the .NET environment

    Allows any .NET language to be used as a server-side scripting language

    ASP.NET documents are compiled into classes

    Ruby

    A pure object-oriented interpreted scripting language

    Every data value is an object, and all operations are via method calls

    Most operators can be redefined by the user

    Both classes and objects are dynamic

    Variables are all type-less references to objects

    8/20/2013 45

  • 8/22/2019 Unit 1 Programming WEB VTU

    46/48

    A development framework for Web-based

    applications

    Particularly useful for Web applications that

    access databases

    Written in Ruby and uses Ruby as its primary

    user language Based on the Model-View-Controller architecture

    8/20/2013 46

  • 8/22/2019 Unit 1 Programming WEB VTU

    47/48

    8/20/2013 47

  • 8/22/2019 Unit 1 Programming WEB VTU

    48/48