+ All Categories
Home > Documents > 10/20/2015 ©2006 Scott Miller, University of Victoria 1 Alternative Content Distribution Methods...

10/20/2015 ©2006 Scott Miller, University of Victoria 1 Alternative Content Distribution Methods...

Date post: 02-Jan-2016
Category:
Upload: kelley-marsh
View: 215 times
Download: 1 times
Share this document with a friend
Popular Tags:
25
03/22/22 ©2006 Scott Miller, University of Victoria 1 Alternative Content Alternative Content Distribution Methods Distribution Methods Non-CGI/SSI Content Serving
Transcript

04/20/23©2006 Scott Miller, University of Victoria1

Alternative Content Alternative Content Distribution MethodsDistribution Methods

Non-CGI/SSI Content Serving

04/20/23©2006 Scott Miller, University of Victoria2

CGI, SSI Building Blocks CGI, SSI Building Blocks

All alternative content serving methods use principles of CGI and SSI

CGI SSI

ISAPI/NSAPI Servlets

FastCGI

JSP

ASP.NetC#

ASP

ColdFusion

PHP

04/20/23©2006 Scott Miller, University of Victoria3

Alternatives - #1Alternatives - #1

Give programmers an API to build custom plug-ins and extensions to the web server– MS ISS: ISAPI DLLs

– Netscape: NSAPI library/DLL Pros: Extremely efficient Cons:

– API is difficult to learn

– Only portable to specific server software

– Extensions can compromise stability of server

04/20/23©2006 Scott Miller, University of Victoria4

Alternatives - #2Alternatives - #2

Keep CGI program running and send it multiple requests rather than starting/terminating a process each request– Fast CGI

Pros: Helps compensate for inefficiencies of CGI

Cons: Still has other issues with CGI– Poor content/presentation separation– Better scaling, but still not great

04/20/23©2006 Scott Miller, University of Victoria5

Alternatives - #3Alternatives - #3 Add extra features into SSI

– Conditionals– Iterations– Native Database support

Cold Fusion .cfm Active Server Pages (ASP) .asp PHP .php

Pros: – Dynamic content generated with minimal programming. – Scripting languages easy to learn

Cons:– Programs are embedded in HTML and tend to be very

procedural (not OOP); hard to re-use code– Not very efficient (~20 concurrent users)

04/20/23©2006 Scott Miller, University of Victoria6

Summary – So Far…Summary – So Far…

Motivation– We want to improve the efficiency of CGI/SSI– We want better separation of content and

presentationIdeas:

– #1: API to the web server– #2: Keep CGI process running– #3: Improve SSI by adding procedural

capabilities

04/20/23©2006 Scott Miller, University of Victoria7

Summary – So Far…Summary – So Far…

These solutions don’t solve everything!– Content vs. Presentation still an issue in most

of these solutions– API has security, stability and steep learning

curve– Efficiency still isn’t very high for SSI based

attempts

04/20/23©2006 Scott Miller, University of Victoria8

Alternatives - #4Alternatives - #4

Use an object-oriented, multi-threaded, portable language with a standard library for web applications

JAVA! – javax.servlet package; servlet ≡ server-side applet

Servlets run in a java process which connects to the web server via a “servlet engine”– E.g. Apache Tomcat

http://www.foo.org/servlet/Login?user=me

04/20/23©2006 Scott Miller, University of Victoria9

Alternatives - #4Alternatives - #4

WebServer

ServletEngine

Java classesimplementing

javax.servlet API

C1 C2Plug-in for various web servers• Tomcat, IBM WebSphere, etc.

Each servlet is an instance of a Java class

04/20/23©2006 Scott Miller, University of Victoria10

Servlet ApproachServlet Approach

Pros: – Scalable (multithreaded)– Reusable (OOP)– Internalization (working with different locales inputs

– currency, character sets, encodings, etc.)– Very clean, elegant coding model (Java)– Tables in relational databases can be abstracted by

Java objects (direct manipulation through Java) Cons:

– Still write HTML as output

04/20/23©2006 Scott Miller, University of Victoria11

Alternatives - #5Alternatives - #5

Embed powerful programming language into HTML like SSI– Java Server Pages (JSP) .jsp

Use special tags to embed java into HTML so advanced programming can be used

JSPs are compiled into servlets– First compilation: slow– Subsequent executions without needing re-

compilations: extremely fast

04/20/23©2006 Scott Miller, University of Victoria12

What now?What now?

Now we know the basics to dynamic web applications– Web server creates the HTTP request context and

passes it to another program– External program generates dynamic HTML as output

and sets cookies in HTML headers These principles can be used towards any web

application technology Many technologies use similar structures, so

once you learn one, you can use the other– JSP & ASP, etc.

04/20/23©2006 Scott Miller, University of Victoria13

Web BrowsersWeb BrowsersResponsibilitiesArchitecture

Rev 2.0

04/20/23©2006 Scott Miller, University of Victoria14

Web BrowsersWeb Browsers

One specific (most used) client for HTTPMany different “flavours”of browser

– Useful to keep in mind as “universal” applications don’t work the same on each browser platform

– Sent in “User-Agent” headerVery object-oriented design

04/20/23©2006 Scott Miller, University of Victoria15

How do we design a client?How do we design a client? Generate and send HTTP requests to web servers in

response to:– Typing a URL into the location field– Clicking on a Hyperlink– Clicking ‘refresh’– “SUBMIT” action on a form– <img src = “…/x.jpg”>

Embedded objects in the HTML Accept HTTP responses from servers and process the

headers Render the body of response in window

– Parse HTML– Parse additional content (.jpg, .gif, video, etc.)

04/20/23©2006 Scott Miller, University of Victoria16

Very High Level FlowVery High Level FlowUser Requests

Resource

Browser GeneratesRequest

User entersURL, etc.

GUI processesaction

Internal RequestModule

Server Processing

Server Processing Browser Receives

ResponseInternal Parsing

Modules

Object (HTML,.jpg) Rendering

Browser DisplaysResource

User seespretty page

04/20/23©2006 Scott Miller, University of Victoria17

More ResponsibilitiesMore Responsibilities

Caching– Do I keep a copy in local storage? Do I already have

it there? Authentication

– How do I prompt for a username and password? How do I store them for future use?

State Maintenance– How do I deal with cookies?

Embedded Objects– Do I request them automatically?

04/20/23©2006 Scott Miller, University of Victoria18

More ResponsibilitiesMore Responsibilities

HTTP Processing– Do I implement ALL status codes? Do I properly use

headers?

– Need to FULLY understand/implement full HTTP specifications

External Processing/Plug-ins– Can I support complex objects? Do I support plug-ins

for 3rd party media? Network Subsystem

– Do I know how to deal with TCP, errors, etc.?

04/20/23©2006 Scott Miller, University of Victoria19

System Level Look (Fig 5.3)System Level Look (Fig 5.3)

GUI

Caching AuthenticationCookies

Config

RequestGenerator

Networking

Get

FileSystem

Request

04/20/23©2006 Scott Miller, University of Victoria20

System Level Look (Fig 5.3)System Level Look (Fig 5.3)

GUI

Caching Cookies

Config

Networking

FileSystem

Response

RequestGenerator

ContentDecoders

HTMLRenderer

ResponseProcessor

Set

04/20/23©2006 Scott Miller, University of Victoria21

Items to ConsiderItems to Consider

Browser architecture is HIERARCHY– Remember “systems” – “A uses B”

MIME Types– Determines what “content rendering

mechanism” to useEach request/response is one full cycle.

Networking doesn’t take place in betweenFile System involved – there is data to

worry about saving to hard disk space

04/20/23©2006 Scott Miller, University of Victoria22

Persistent Data Rules (Table Persistent Data Rules (Table 5.1)5.1)

Decision Access Key Delete?

Caching Response Headers and User Settings

URL Expiry DateOR

Cache Full

Cookies User Settings Domain and Path

Expiry DateOR

End of Session

AuthorizationCredentials

Always store them

Server&

Realm

End of Session

04/20/23©2006 Scott Miller, University of Victoria23

Advanced IdeasAdvanced Ideas

POST method– Sends data (e.x. upload picture) through body

of request; multipart messages– Send remote code calls for remote

applications over HTTP; Remote Procedure Calls

04/20/23©2006 Scott Miller, University of Victoria24

Multipart Message ExampleMultipart Message Example…Content-Type: multipart/form-data;

boundary=“23tagDSFoj346189F2”

--23tagDSFoj346189F2Content-Type: application/x-www-form-urlencoded

&filename=….&param=value

--23tagDSFoj346189F2Content-Type: image/gifContent-Transfer-Encoding: base64

FsZCB23oYXfy432Faate223GdsgY …

04/20/23©2006 Scott Miller, University of Victoria25

Reading for Next ClassReading for Next Class

Get finished with Lab 2Decide on your Lab 3/4 project!

NEXT CLASS: EXAMPLES OF WEB LANGUAGES AND HTML


Recommended