server-side web development. refers to software development for applications in which the majority...

30
ITEL 302 WEB DEVELOPMENT 3 SERVER-SIDE WEB DEVELOPMENT

Upload: brandon-holmes

Post on 19-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

ITEL 302WEB DEVELOPMENT 3

SERVER-SIDE WEB DEVELOPMENT

Page 2: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Refers to software development for applications in which the majority of processing occurs on one or more servers (and not on the client’s machine).

What is Server-Side Web Development?

Page 3: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

is a technique used in website design which involves embedding scripts in an HTML source code which results in a user's (client's) request to the server website being handled by a script running on the server-side before the server responds to the client's request. Scripts can be written in any of a number of server-side scripting languages that are available. Server-side scripting differs from client-side scripting where embedded scripts, such as JavaScript, are run client-side in a web browser.

What is Server-Side Scripting?

Page 4: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Server-side scripting is usually used to provide an interface for the client and to limit client access to proprietary databases or other data sources. These scripts may assemble client characteristics for use in customizing the response based on those characteristics, the user's requirements, access rights, etc.

Server-side scripting also enables the website owner to reduce user access to the source code of server-side scripts which may be proprietary and valuable in it. The down-side to the use of server-side scripting is that the server website computer needs to provide most of the computing resources before sending a page to the client computer for display via its web browser.

Server-Side Scripting (continued)

Page 5: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Netscape introduced an implementation of JavaScript for server-side scripting with Netscape Enterprise Server, first released in December, 1994 (soon after releasing JavaScript for browsers).

Server-side scripting was later used in early 1995 by Fred DuFresne while developing the first web site for Boston, MA television station WCVB. The technology is described in US patent 5835712. The patent was issued in 1998 and is now owned by Open Invention Network (OIN). In 2010 OIN named Fred DuFresne a "Distinguished Inventor" for his work on server-side scripting.

History

Page 6: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Today, a variety of services use server-side scripting to deliver results back to a client as a paid or free service. An example would be WolframAlpha, which is a computational knowledge engine that computes results outside the client’s environment and returns the computed result back. A more commonly used service is Google's proprietary search engine, which searches millions of cached results related to the user specified keyword and returns an ordered list of links back to the client. Apple's Siri application also employs server-side scripting outside of a web application. The application takes an input, computes a result, and returns the result back to the client.

History (continued)

Page 7: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

In the earlier days of the web, server-side scripting was almost exclusively performed by using a combination of C programs, Perl scripts, and shell scripts using the Common Gateway Interface (CGI). Those scripts were executed by the operating system, and the results were served back by the web server. Many modern web servers can directly execute online scripting languages such as ASP and PHP either by the web server itself or via extension modules (e.g. mod_perl or mod_php) to the web server.

Explanation

Page 8: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Dynamic websites sometimes use custom web application servers, such as the Python "Base HTTP Server" library, although some may not consider this to be server-side scripting. When designing using dynamic web-based scripting techniques, like classic ASP or PHP, developers must have a keen understanding of the logical, temporal, and physical separation between the client and the server. For a user's action to trigger the execution of server-side code, for example, a developer working with classic ASP must explicitly cause the user's browser to make a request back to the web server. Creating such interactions can easily consume much development time and lead to unreadable code.

Explanation (continued)

Page 9: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Server-side scripts are completely processed by the servers instead of clients. When clients request a page containing server side scripts, the applicable server processes the scripts and returns an HTML page to the client. For example, an ASP page is not processed by the browser; instead it is interpreted by the server which can process ASP scripts and return an HTML page to the client.

Explanation (continued)

Page 10: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Most web pages that you view are not static HTML pages.

Instead they are output from programs that run on servers.

(these programs can interact with server resources like database and XML Web services.)

Static vs Dynamic Web Pages

Page 11: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Static & Dynamic Web Content

Page 12: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

There are quite a number of different technologies for dynamically generating Web content on servers.◦ ASP.NET◦ ASP◦ CGI◦ ColdFusion◦ JSP◦ PHP◦ Ruby on Rails

Dynamic Web Technologies

Page 13: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

All of these technologies share one thing in common:◦ Using programming logic, they generate

HTML+CSS+Javascript on the server and send it back to the requesting browser.

Dynamic Web Technologies

Page 14: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Dynamic Web Technologies (again)

Page 15: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Normal Javascript is NOT a dynamic server technology.◦ Javascript is a simple programming language that

is executed by the browser, not the server.◦ It is embedded within the HTML that is sent to the

browser.◦ It can interact with a server, but it executes after

the page is received by the browser.

What is NOT a Dynamic Server Technology?

Page 16: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Flash is NOT a dynamic server technology.◦ Flash refers the shockwave Flash file (SWF) that is

sent to the browser.◦ Your browser, via the Flash Player plug-in, is able

to run and display SWF file. Typically used for advertisement banners, games, or richer user

interfaces than are possible with HTML

◦ It can interact with a server, but it executes after the page is received by the browser.

What is NOT a Dynamic Server Technology

Page 17: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

There are quite number of different technologies for dynamically generating web content on the server.

All of these technologies share one thing in common:◦ Using programming logic they generate HTML on the server and

send it back to the requesting browser.

We could categorize dynamic technology into three different types:◦ Direct Output◦ Page Scripting◦ Hybrid

Types of Dynamic Technology

Page 18: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

In such a case, programs running on the server directly output HTML back to the client.◦ CGI and Java Servlets are examples.

Advantage is fast execution time. Main drawback is that any change in the

design of a web page, no matter how minor, requires of intervention of programmer, who must compile the code (and perhaps turn off to server deploy).

Direct Output

Page 19: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

public class HelloWorld extends HttpServlet{

public void doGet(HttpServletRequest reques, HttpServletResponse response){response.setContentType(“text/html”);PrintWriter out = response.getWriter();out.print(“<html>”);out.print(“<body>”);out.print(“<head>”);out.print(“<title>Hello World!</title>”);out.print(“</head>”);out.print(“<h1>Hello World!</h1>”);out.print(“</body>”);out.print(“</html>”);}

}

Direct Output example

Page 20: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Due to the inefficiences and difficulties in creating direct output web applications, page scripting dynamic content systems have been developed.◦ That is, scripts embedded within HTML.◦ HTML for static elements, scripts for dynamic elements◦ Each page contains the scripts it needs.

ExamplesMicrosoft’s ASP, Allaire’s Coldfusion, PHP

All of these systems using scripting languages.◦ These languages are interpreted by the server rather than compile

using a compiler.

◦ Advantage: rapid development times for developers.◦ Disadvantage: slower execution speed.

Page Scripting

Page 21: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

<?php require_once (“utilites/header.php”); ?><?php$currentTime = date (“Fj, Y, g:i a”);$colors = array (‘white’,’black’,’green’,’blue’,’yellow’,’orange’);?><html><head></head><body><form>The time is now <?php echo $currentTime; ?> <br/>Choose a color:<select><?For ($i=0; $i<count($colors); $i++){

echo ‘<option>’;echo $colors[$i];echo ‘</option>;

}?></select></form></body></html>

Example PHP Script

Page 22: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Page scripting systems such as ASP and PHP are great for rapidly developing simple web sites.

They can, however,◦ be harder to use when creating large, complex

sites◦ be hard to maintain since the code created tends

not be object-oriented.

Page Scripting

Page 23: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

More recent technologies such as Microsoft’s ASP.NET and Sun’s JSP use a hybrid approach and combine the direct and page scripting models.

Disadvantage◦ Hard to learn compared to page scripting

Advantage◦ Can use modern software engineering best

practices thus making it easier to create large complex sites as well as easier to manage and maintain.

Hybrid

Page 24: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

AJAX◦ Asynchronous Javascript with XML in a new

technology that combines dynamic server technology, XML, and Javascript to create web applications or Flash interfaces in their interactivity abilities.

◦ E.g., Google Maps and Google Gmail.◦ Dynamic sever technology use to retrieve and

generate XML data back to browser.◦ Browser then temporarily store this XML data and

uses Javascript to create richer user interface and retrieve data from XML.

◦ If use changes XML data, it can be sent back to server for more processing.

New Approaches to Dynamic Technology

Page 25: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Web server hardware◦ A server is a computer that serves informaton to

other computers.◦ Obviously needs to be powerful enough to handle

the requests. Web server software

◦ Software whose purpose is to deliver web content to HTTP requestors.

What do you need for server development?

Page 26: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

Apache◦ Open source, often on

Linux/Unix OS IIS

◦ Microsoft on Windows

Web Server Software

Page 27: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

To test or run ASP.NET Web applications, web server software is necessary.

Microsofts’s production web server software is Internet Information Services (IIS).◦ In order to run IIS, your computer’s operating system

must be one of the following: Windows 2000 Windows XP Professional (not XP Home), Windows Vista Business or Ultimate (not Vista Home

Basic), Windows Server 2003 Windows Server 2008 Windows 7

ASP.NET Web Server Options

Page 28: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

One of the advantages of using Visual Studio for ASP.NET development is that your site can be run and tested with or without using IIS.◦ That is, Visual Studio comes with iits own web

server software so that you can test execute ASP.NET pages on the same computer. The Visual Studio web server can run locally on all

current versions of Windows. The Visual Studio Web server accepts only localhost

requests. It cannot serve pages to another computer, and is

therefore suitable only for testing pages locally.

Visual Studio File Server

Page 29: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and

With Visual Studio, we could say that your computer is a development server (available only to yourself).

Alternately,you might upload your work to a staging server running IIS for team testing.

Of course, if you want others to see this web application, it must eventually be uploaded to a production server (available to your Web application’s audience).

Web Server Options

Page 30: SERVER-SIDE WEB DEVELOPMENT.  Refers to software development for applications in which the majority of processing occurs on one or more servers (and