anatomy & url

Upload: shahhoney

Post on 03-Jun-2018

235 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Anatomy & Url

    1/69

    Anatomy of web

    application and URL

  • 8/12/2019 Anatomy & Url

    2/69

  • 8/12/2019 Anatomy & Url

    3/69

    A web application with one of the

    busyiest networks

    It handles transactionsfor more than 1 Lakh

    customers a day

  • 8/12/2019 Anatomy & Url

    4/69

    History of Web

    Application

  • 8/12/2019 Anatomy & Url

    5/69

    Two tier architecture

  • 8/12/2019 Anatomy & Url

    6/69

    Example:

    Designing a software that students can use to

    find their current grade.

    Here database of grades resides on the server,

    and the application resides on the client (the

    computer the student is physically interactingwith).

  • 8/12/2019 Anatomy & Url

    7/69

    In this example of a 2-tier architecture. The two

    tiers are:

    1. Data server:

    The database serves up data based on SQLqueries submitted by the application.

    2. Client application:

    The application on the client computer consumes

    the data and presents it in a readable format to

    the student.

  • 8/12/2019 Anatomy & Url

    8/69

    Now, this architecture is fine, if you've got a

    school with 50 students. But suppose the school

    has 10,000 students. Here the problem arises.

    Because every time a student queries the client

    application, the data server has to serve up

    large queries for the client application to

    manipulate. This is an enormous drain onnetwork resources.

  • 8/12/2019 Anatomy & Url

    9/69

    Solution to the above problem:

    3-tier architecture:

    By inserting another program at the server

    level(server application).

    Now the client application no longer directly

    queries the database; it queries the serverapplication, which in turn queries the data

    server.

  • 8/12/2019 Anatomy & Url

    10/69

    Three tier arch itec tu re

  • 8/12/2019 Anatomy & Url

    11/69

    Languages used in Two tier

    architecture

    Initially , web applications use webdocuments written in a standard format such

    as HTML and more recently XHTML, which aresupported by a variety of web browsers.

    Each individual web page was delivered to the

    client as a static document, no operations couldbe performed on the web pages at the run time.

  • 8/12/2019 Anatomy & Url

    12/69

    Continued

    During the session, the web browser interprets

    and displays the pages.

    In 1995, Netscape introduced a client-sidescripting language called JavaScript, which

    allowed programmers to add some dynamic

    elements to the user interface that ran on the

    client side.

  • 8/12/2019 Anatomy & Url

    13/69

    Continued

    This calls for a web site developmentenvironment with coding techniques capable ofaccepting a clients request and processingthese requests.

    The result of the processing being passed backto the client via standard HTML pages.

    The need to return standard HTML pages ,that

    map to a users input , is due to the fact thatbrowsers use HTTP to communicate with a webserver and are designed to interpret and renderHTML on a clients machine.

  • 8/12/2019 Anatomy & Url

    14/69

    MODERN TECHNIQUES

  • 8/12/2019 Anatomy & Url

    15/69

    Some of the following led to the

    modernization of web applications:

    Three Tier architecture:

    In this architecture ,the client (applicationsoftware at client side) is made to link with an

    application program at the server (not the

    database).

    This application program at server side is thenconnected to the database.

  • 8/12/2019 Anatomy & Url

    16/69

    Continued

    The server in a three tier architecture

    contains data of all the application

    programs of the web application.

  • 8/12/2019 Anatomy & Url

    17/69

    Continued

    EG: J2EE :Java 2 Platform Enterprise

    Edition

    Aim : To provide developers a set of Application

    Program Interfaces while reducing time,application complexity, and improving

    application performance.

    It defines a multitier architecture for developing

    web products to answer the need from the

    industry.

  • 8/12/2019 Anatomy & Url

    18/69

    Continued

    It provides different components(API) which

    enables programmer to develop, deploy and run

    java based web application.

    Components : Application clients and applets

    are components that run on the client (where

    clients are web browsers in case of webapplications).

  • 8/12/2019 Anatomy & Url

    19/69

    Continued

    For example: Java Servlet ,Java Server Faces,Java Server Pages (JSP) technologycomponents are web components that run onthe server (here server is also a webapplication).

    It works on the principle of Write Once DeployAnywhere (WODA).

    A .Net application, Orkut can be deployed onlyon Windows therefore , it is

    not a J2EE web application.

  • 8/12/2019 Anatomy & Url

    20/69

  • 8/12/2019 Anatomy & Url

    21/69

    Types of Architectures

  • 8/12/2019 Anatomy & Url

    22/69

    Model-view-Controller

    (MVC Architcture):

    It separates the web application in three layersnamely:presentation layer,logic layer and datalayer

    It is considered a good practice as it modularizescode,promotes code reuse and allows multipleinterfaces to be applied

    Also using this system we can generate differentviews of the same web pages

    Eg:web pages for humans and web serviceinterfaces for remote applications

  • 8/12/2019 Anatomy & Url

    23/69

    Push based vs Pull based MVC

    Architecture

    These frameworks use actions that do the requiredprocessing, and then "push" the data to the view layer torender the results. Struts, Django, Ruby onRails and Spring MVC are good examples of this

    architecture An alternative to this is pull-based architecture,

    sometimes also called "component-based". Theseframeworks start with the view layer, which can then"pull" results from multiple controllers as needed.

    In this architecture, multiple controllers can be involvedwith a single view. Play, Struts2, Lift, Tapestry, JBossSeam, Wicket, Hibernate and Stripes are examples ofpull-based architectures.

  • 8/12/2019 Anatomy & Url

    24/69

    Three tier architecture

  • 8/12/2019 Anatomy & Url

    25/69

    Three-tier Architecture

    In Three Tier Architecture, applications are structuredaround three physical tiers: client, application, anddatabase.

    The Database is normally RDBMS

    The Application contains the business logic, running on aserver and communicates with the client using HTTP

    The client, on web applications is a web browser thatruns HTML generated by the application layer.

    The term must not be confused with MVC. Unlike inthree-tier architecture, it is considered a good practice tokeep business logic away from the controller, the "middlelayer" in MVC

  • 8/12/2019 Anatomy & Url

    26/69

    MVC ARCHITECTURE IN

    DETAIL

  • 8/12/2019 Anatomy & Url

    27/69

  • 8/12/2019 Anatomy & Url

    28/69

    Presentation Layer

    The Presentation Tier or User Interface is the portion theuser sees when they open a web page in the browser

    If you were to view the source code, you would only seecode such as HTML, Javascript, and Cascading Style

    Sheets. On some sites, you may see Java Applets andFlash

    Viewing source code on a web page, you would NOTsee database queries or loops or calls to classes or anybehind-the-scenes processing.

    You may also setup the site design using Themes,Skins, and Cascading Style Sheets.

    Languages used in this layer are typically HTML,DHTML, CSS and javascript.

  • 8/12/2019 Anatomy & Url

    29/69

    Business Logic Layer

    The Business Logic, Functional Process Logic, BusinessRules (all pertaining to the same thing), are kept in aseparate layer.

    This is where you define your classes and source code.

    This can be in the App_Code folder for your classes andmethods.

    Web languages typically used in ASP.net are VB and C#JAVA SERVLETS. You would not use HTML orJavascript in this layer

    In this layer you typically define your classes, functions,sub procedures, properties, etc.

  • 8/12/2019 Anatomy & Url

    30/69

    Data Access Tier

    The Data Access layer is where you define yourtyped datasets and tableadapters. It is whereyou define your queries or stored procedures

    The business tier may then make use of thisfunctionality. In your classes, rather thandefining ad hoc queries, you may use a

    TableAdapter to access the Data Access Layer(Dao Layer).

  • 8/12/2019 Anatomy & Url

    31/69

    USER IDENTIFICATION

    In web application development user

    identification is a very important aspect.

    It helps in making an intelligent server

    program,that responds to clients request smartlyHTTP is a connection less protocol that is,every request

    from client is treated as a new request,ie the network

    cannot identify the user

    To avoid user authentication again and again useridentification is implemented in web application itself.Eg

    a program of click count seen on websites is the result

    of this feature

  • 8/12/2019 Anatomy & Url

    32/69

    Continued

    It is mainly implemented using the following

    techniques

    URL REWRITING

    HIDDEN FIELDS

    CREATING SESSION OBJECTS

    SENDING COOKIES TO CLIENT COMPUTER

  • 8/12/2019 Anatomy & Url

    33/69

    Continued

    URL REWRITING

    You can append a token or identifier to the url

    of the next resource

    You can send parameter name/value pairsusing the following format

    url?name1=value1&name2=value2

    These values can be received by the server and thus

    the server can identify the user by these valuespassed as tokens

  • 8/12/2019 Anatomy & Url

    34/69

    Continued

    HIDDEN FIELDSHidden fields can be passed from the static html

    document

    This can simply be done using form

    ie

    values are passed to the server depending on thenature of request ie get or post

    for get request the url will be appendedwith(?a=10)

  • 8/12/2019 Anatomy & Url

    35/69

    Continued

    COOKIES

    These are certain class files that server sends

    to the client computerSo that it can identify the user by getting the

    cookies when the next time the user requests

    and reply intelligently

    Eg:to be spoken

  • 8/12/2019 Anatomy & Url

    36/69

    Continued

    SESSION OBJECTS

    This method creates the session object so that the

    server can remember past requests

    HttpSession class object is created and its timeoutis specified so that server can identify the user

    within a given timeout

    It is mainly used in authentication purposes

    As in such a condition a server may remember thatgiven user is already logged in and thus to not to

    treat its requests as new requests

  • 8/12/2019 Anatomy & Url

    37/69

    CLIENT AND SERVER

  • 8/12/2019 Anatomy & Url

    38/69

    CLIENT

    A client can be a human, a computer, a

    hardware device, a software that sends

    requests and receives response from a

    server.

    In case of web applications a client is a

    web browser.

    For example: Internet Explorer, Firefox,Opera.

  • 8/12/2019 Anatomy & Url

    39/69

    SERVER

    A server is a computer program running to

    serve the requests of other programs, the

    "clients".

    Thus, the "server" performs some

    computational task on behalf of "clients".

    The clients either run on the same

    computer or connect through the network.

    It is a software in case of web applications.

  • 8/12/2019 Anatomy & Url

    40/69

    J2EE specific server

    Container: It is a part of server where

    J2EE components execute.J2EE content runs on containers and not

    on Java Virtual Machine.

  • 8/12/2019 Anatomy & Url

    41/69

    Continued

    There are 2 types of servers:

    Web Servers: Contain only web

    containers. Servlets and JSP run on webcontainers.

    Example: Tomcat (APACHE)

  • 8/12/2019 Anatomy & Url

    42/69

    Application Servers: Contain both Web

    containers and EJB (Enterprise Java

    Bean) containers.

    o EJB container provides services related to datatransformation.

    o Example: Glassfish (Sun Microsystems ), Web

    Logic (BEA), JBOSS.

  • 8/12/2019 Anatomy & Url

    43/69

    How are requests and responses

  • 8/12/2019 Anatomy & Url

    44/69

    How are requests and responses

    haldled?

    HTTP is a request/response protocol, which

    means your computer sends a request for some

    file (e.g. 'home.html'), and the web server sends

    back a response ( followed by the file itself).

    That request which your computer sends to the

    web server contains all sorts of (potentially)

    interesting information

  • 8/12/2019 Anatomy & Url

    45/69

    This is passed as HttpRequest objects

    These objects may be convertedaccording to language used at server side

    Eg: This piece of information is converted

    into HttpServletRequest/HttpServletResponse object in servlets.

    Then using this ,we can access all the

    information regarding request andresponse

  • 8/12/2019 Anatomy & Url

    46/69

    The following HTTP request was received fromIP address 49.248.69.98 (port 18787) by IP

    address 81.187.237.83 (port 80):

    GET /dumprequest HTTP/1.1

    Host: djce.org.uk

    Connection: keep-alive

    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like

    Gecko) Chrome/14.0.835.187 Safari/535.1

    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

    Referer: http://www.google.co.in/search?gcx=c&ix=c2&sourceid=chrome&ie=UTF-

    8&q=www.google.+om#pq=web+application&hl=en&cp=8&gs_id=19&xhr=t&q=http+r

    equest&pf=p&sclient=psy-

    ab&source=hp&pbx=1&oq=http+req&aq=0&aqi=g4&aql=&gs_sm=&gs_upl=&bav=on.

    2,or.r_gc.r_pw.,cf.osb&fp=5d23229b5c1e7359&biw=1366&bih=662

    Accept-Encoding: gzip,deflate,sdch

    Accept-Language: en-US,en;q=0.8

    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

  • 8/12/2019 Anatomy & Url

    47/69

    INFORMATION CONTAINED IN HTTPREQUEST AND RESPONSE

    Source IP address, port and proxy

    Source IP address:

    49.248.69.98

    Source port:

    18787

    Via:not present

    X-Forwarded-For:

    not present

  • 8/12/2019 Anatomy & Url

    48/69

  • 8/12/2019 Anatomy & Url

    49/69

    Requested URIRequested URI:/dumprequest

    Together with the 'Host' header and the destination port

    number(above), this specifies the document which should be

    retrieved.

    Given all these values we can determine that the URL of the

    document which is being retrieved is: http://djce.org.uk/dumprequest

  • 8/12/2019 Anatomy & Url

    50/69

    TYPES OF RESPONSES

    http is a protocol that allows transfer of

    only html pages.

    Server programming languages are

    converted to html pages and then

    transferred through http.

    S f

  • 8/12/2019 Anatomy & Url

    51/69

    Server responses can be of two

    types:

    Static Response:

    This type of response does not changewith time

    Response of html and java script pages isan example of static response

    NOTE: Static response must not be

    confused with static pages.Java script is a dynamic page but its

    response is static

    C ti d

  • 8/12/2019 Anatomy & Url

    52/69

    Continued

    Dynamic Response:Dynamic response changes with time.

    Response depends upon the request of

    the client and also on the logic performedon the server by server side application.

    Server side application programming can

    be done through languages like Perl CGI,J2EE, .Net, etc.

    NOTE: response of static pages can also

    be dynamic

    Uniform Resource

  • 8/12/2019 Anatomy & Url

    53/69

    Uniform Resource

    Locator

  • 8/12/2019 Anatomy & Url

    54/69

    URL (Uniform Resource Locator)

    In computing, a Uniform Resource Locator orUniversal Resource Locator (URL) is a characterstring that specifies where a known resource is

    available on the Internet and the mechanism forretrieving it.

    A URL is technically a type of Uniform Resource

    Identifier (URI) but in many technical documentsand verbal discussions URL is often used as asynonym for URI.

  • 8/12/2019 Anatomy & Url

    55/69

  • 8/12/2019 Anatomy & Url

    56/69

  • 8/12/2019 Anatomy & Url

    57/69

    URL Standard syntax

    scheme://host.domain:port/path/filename

    scheme - defines the type of Internet service. The mostcommon type is http

    host - defines the domain host (the default host for http iswww)

    domain - defines the Internet domain name, likew3schools.com

  • 8/12/2019 Anatomy & Url

    58/69

    :port - defines the port number at the host(the default port number for http is 80)

    path - defines a path at the server (Ifomitted, the document must be stored atthe root directory of the web site)

    filename - defines the name of adocument/resource

    Diff t t f h i l d

  • 8/12/2019 Anatomy & Url

    59/69

    Different types of schemes include:

    URL E di

  • 8/12/2019 Anatomy & Url

    60/69

    URL Encoding

    URLs can only be sent over the Internet using

    the ASCII character-set.

    Since URLs often contain characters outside the

    ASCII set, the URL has to be converted into avalid ASCII format.

    URL encoding replaces non ASCII characters

    with a "%" followed by two hexadecimal digits.

    URLs cannot contain spaces. URL encoding

    normally replaces a space with a + sign.

  • 8/12/2019 Anatomy & Url

    61/69

    Types of URLs

    Absolute URL:

    Dictionary meaning of word absolute is : not dependent

    on any thing ie independent having its own existence,

    same is the meaning of absolute urls.

    An Absolute URL is, thus, something that is independentor free from any relationship from the rest. When you

    use an absolute URL, you point directly to the file you

    give exact location of the file.

    eg :sitename.com/images/welcome.gifis anabsolute url as it specifies that an image file welcome.gif

    located in the images directory, under your site name

    domain.

  • 8/12/2019 Anatomy & Url

    62/69

    Relative URLs :

    A relative URL points to a file/directory in relation to

    the present file/directory.

    They have short urls as they are referring to root

    directory/subdirectory.Relative urls helps webmaster

    to maintain the site without rewriting the whole pathagain and again if they had made any changes in

    directory.

    eg : . . / image/welcome.gifis a relative url (The initial

    two peroids (..) in the url instruct the server to move upone directory (which is the root directory), then enter

    images directory and finally point at welcome.gif file )

    URL and IP address

  • 8/12/2019 Anatomy & Url

    63/69

    URL and IP address

    IP address, or "internet protocol address", is a unique

    identifying number given to every single computer onthe internet. Like a car license plate, an IP address is

    a special serial number used for identification.

    A URL, as stated before, is a name, designed forpeople to remember (IE yahoo.com). A DNS server is

    used to convert that name to an IP address, which is

    some odd number IE 209.191.93.52. After all, who on

    earth who be able to remember websites as a seriesof numbers (that's why we, as "normal people", use

    URLs instead of IP addresses).

    For eg. 208.185.127.40=www.about.com

    74.125.236.52=www.google.com.

  • 8/12/2019 Anatomy & Url

    64/69

  • 8/12/2019 Anatomy & Url

    65/69

    Trivia point 3:it is possible to mask or digitally alter

    the appearance of your computer's IP address. Youwould do this for the sake of privacy or to avoid

    authorities tracking your online habits.

    Trivia point 4:as of May 2008, the internet uses IP

    addressing standard Version 4 (aka "IPv4"). There is a

    new generation of addresses being designed called

    IPv6. The biggest change is in the number of availableaddresses. Instead of 4.3 billion possible IP

    addresses, IPv6 will bring us

    34,000,000,000,000,000,000 billionpossible IP

    addresses.

  • 8/12/2019 Anatomy & Url

    66/69

    So, in short:

    The URL/"Domain Name" is something for you toremember

    The IP is for the computer to use to send the

    message

    The DNS is used to translate from the URL to IP

    address. At present, the Internet uses Domain

    Name System to convert a URL to an IP address.The DNS maintains a list of domain names and IP

    addresses which are distributed throughout the

    Internet in a hierarchical order.

  • 8/12/2019 Anatomy & Url

    67/69

    DNS (Domain Name Server)

    The Domain Name System(DNS) is a hierarchicaldistributed naming system for computers, services, or

    any resource connected to the Internet or a private

    network.

    It associates various information with domain

    names assigned to each of the participating entities.

    Most importantly, it translates domain names meaningful

    to humans into the numerical identifiers associated withnetworking equipment for the purpose of locating and

    addressing these devices worldwide.

  • 8/12/2019 Anatomy & Url

    68/69

    The Domain Name System makes it possible toassign domain names to groups of Internet resources

    and users in a meaningful way, independent of eachentity's physical location. Because of this,World WideWeb (WWW) hyperlinks and Internet contact informationcan remain consistent and constant even if the currentInternet routing arrangements change or the participantuses a mobile device.

    Internet domain names are easier to remember than IPaddresses such as 208.77.188.166 (IPv4)

    or 2001:db8:1f70::999:de8:7648:6e8 (IPv6). Users takeadvantage of this when they recite meaningful UniformResource Locators (URLs) and e-mail addresses withouthaving to know how the computer actually locates them.

  • 8/12/2019 Anatomy & Url

    69/69