Web Applications - Basics. Introduction to Web Web features Clent/Server HyperText Transfer Protocol HyperText Markup Language URL addresses Web server.

Slides:



Advertisements
Similar presentations
JSP and web applications
Advertisements

An architecture for webb applications, J2EE
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
An introduction to Java Servlet Programming
1 Running Web Applications with Tomcat CS , Winter 2007/8.
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
J2EE Java 2 Enterprise Edition. Relevant Topics in The Java Tutorial Topic Web Page JDBC orial/jdbc
Java Server Team 8. Overview What is a Java Server? History Architecture Advantages Disadvantages Current Technologies Conclusion.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
Session-01. What is a Servlet? Servlet can be described in many ways, depending on the context: 1.Servlet is a technology i.e. used to create web application.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Java Servlets and JSP.
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
Quick Tour of the Web Technologies: The BIG picture LECTURE A bird’s eye view of the different web technologies that we shall explore and study.
Understanding and Managing WebSphere V5
Distributed System Using Java 2 Enterprise Edition (J2EE)
UNIT-V The MVC architecture and Struts Framework.
Linux Operations and Administration
INTRODUCTION TO WEB DATABASE PROGRAMMING
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
EJB Overview Celsina Bignoli Distributed Business Applications Server DB Client DB Server DB.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Distributed Multitiered Applications The J2EE platform uses a multitiered distributed application model. Application logic is divided into components 1.
1 Web Server Concepts Dr. Awad Khalil Computer Science Department AUC.
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
Chapter 4: Core Web Technologies
Notes of J2EE Tutorial Matt Tsai. 2 Outline Chapter 1: Overview Chapter 1: Overview Chapter 2: Understanding XML Chapter 2: Understanding XML Chapter.
CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 5_1 George Koutsogiannakis/ Summer
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
Introduction to J2EE Architecture Portions by Kunal Mehta.
JBoss at Work JAW Motors Application Chapter 1-3 Jeff Schmitt October 9, 2006.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 21 - Web Servers (IIS, PWS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3.
第十四章 J2EE 入门 Introduction What is J2EE ?
J2EE Structure & Definitions Catie Welsh CSE 432
Enterprise Java v120131Intro to JavaEE1 Java EE 5 TM Introduction.
® IBM Software Group © 2007 IBM Corporation J2EE Web Component Introduction
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
Source: Peter Eeles, Kelli Houston, and Wojtek Kozaczynsky, Building J2EE Applicationa with the Rational Unified Process, Addison Wesley, 2003 Prepared.
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
Java Servlets & Java Server Pages Lecture July 2013.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
A seminar on j2ee by saritha. s. What is J2EE J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing.
Copyright © 2002 ProsoftTraining. All rights reserved. Java Servlets.
Assignment of JAVA id : BSSE-F10-M-10-JAVA1 Overview of J2EE/Session 2/Slide 1 of 38.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Introduction and Principles Web Server Scripting.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
Modern Programming Language. Web Container & Web Applications Web applications are server side applications The most essential requirement.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Topics to be covered (ni) Client side validation JSF (free tools as well) Webservices Tell Resources e.g. sites Packaging and deploying web applications.
1 Web Programming with Servlets & JSPs WEB APPLICATIONS – AN OVERVIEW.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
J2EE Platform Overview (Application Architecture)
Java Servlets By: Tejashri Udavant..
MSIS 655 Advanced Business Applications Programming
Distributed System Using Java 2 Enterprise Edition (J2EE)
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
J2EE Lecture 1:Servlet and JSP
Web Servers (IIS and Apache)
Java Chapter 7 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

Web Applications - Basics

Introduction to Web Web features Clent/Server HyperText Transfer Protocol HyperText Markup Language URL addresses Web server - a computer program that is responsible for accepting HTTP requests from clients and serving them HTTP responses Web application - a dynamic extension of a web or application server

Web (HTTP) servers A Web server handles the HTTP protocol To process a HTTP request, a Web server may respond with a static HTML page or image send a redirect delegate the dynamic response generation to some other program such as CGI scripts JSPs (JavaServer Pages), servlets server-side JavaScripts or some other server-side technology

Web server diagram

Web server features In practice many web servers implement the following features: Authentication Handling of static and dynamic content HTTPS support (by SSL or TLS) Content compression (i.e. by gzip encoding) Virtual hosting Large file support Bandwidth throttling

Web server statistics Web server software vendors statistics Totals for Active Sites Across All Domains:

Web server statistics Web server software vendors statistics

Application servers Application server is responsible for handling the business logic of the system Separation of business logic from the presentation logic and the database logic: 3-tier architecture

Application server diagram Application servers extend web servers to support dynamic content

Application server features The application server manages its own resources and may provide features such as: Security Transaction management Database connection pooling Clustering support Messaging Most application servers also contain a Web server

Web Applications & Components Web application is a dynamic extension of a web or application server Two types of web applications: Presentation-oriented (HTML, XML pages) Service-oriented (Web services) Web components provide the dynamic extension capabilities for a web server: Java servlets JSP pages Web service endpoints

Web Application Interaction [client] sends an HTTP request to the web server [web server] HTTP request  HTTPServletRequest This object is delivered to a web component, which can interact with JavaBeans or a DB to generate dynamic content [web component] generates an HTTPServletResponse or pass the request to another web component [web server] HTTPServletResponse  HTTP response [web server] returns HTTP response to the client

Web Application Interaction

Java Enterprise Edition Java EE is a comprehensive platform for multi- user, enterprise-wide applications It is based on Java SE and adds APIs for Internet-based server-side computing

Java EE architecture Java EE defines an architecture for implementing services through the use of a Java EE server as multi-tier applications that deliver the scalability, accessibility, and manageability needed by enterprise-level applications The business and presentation logic has to be implemented by the developer The standard system services are provided by the Java EE platform

Java EE versions J2EE 1.2 (December 12, 1999) Java EE 5 (May 11, 2006) Java EE 6 (Dec 10, 2009) Java EE 7 (May 28, 2013)

Java EE 7 technologies Web Application Technologies Java Servlet 3.1 JavaServer Pages 2.3 JavaServer Faces 2.2 Web Services Technologies JAX-RS 2.0, JAX-WS 2.2, JAXB 2.2, StAX … Enterprise Application Technologies EJB 3.2, JMS 2.0, JPA 2.1, JTA 1.2, JavaMail 1.5…

Java EE components Java EE applications are made up of components A Java EE component is a self-contained functional software unit that is assembled into a Java EE application with its related classes and files and that communicates with other components

Java EE components Components are compiled in the same way as any program in the Java language Components are assembled into a Java EE application, are verified to be in compliance with the Java EE specification, and are deployed to production, where they are run and managed by a Java EE server

Java Web Application Technologies Java Servlet technology is the foundation of all the web application technologies

Servlets and JSPs Servlets - Java classes that dynamically process requests and construct responses JSP pages - text-based documents that execute as servlets, but allow a more natural approach to creating static content Appropriate usage Servlets - service-oriented applications, control functions JSP - generating text-based markup (HTML, SVG, WML, XML)

Web Containers Web components are supported by the services of a runtime platform called a web container In Java EE, a web container "implements the web component contract of the Java EE architecture“ Web container services: request dispatching security concurrency life-cycle management naming, transactions, APIs

Web Container Examples Non-commercial Apache Tomcat Jetty Commertial Sun Java System Application Server BEA WebLogic Server Oracle Application Server WebSphere Open source JBoss

Deployment Web components have to be installed or deployed to the web container Aspects of web application behaviour can be configured during application deployment The configuration information is maintained in a XML file called a web application deployment descriptor

Web Application Development A web application consists of: Web components Static resource files (such as images, css) Helper classes and libraries The process for creating and running a web application is different from that of traditional stand-alone Java classes

Development Cycle 1.Develop the web component code 2.Develop the web application deployment descriptor 3.Compile the web application components and helper classes referenced by the components 4.Optionally package the application into a deployable unit 5.Deploy the application into a web container 6.Access a URL that references the web application

Web Modules According to Java EE architecture and Java Servlet Specification: Web components and static web content files such as images are called web resources A web module is the smallest deployable and usable unit of web resources Web module corresponds to a web application A web module has a specific structure

Web Module Structure The top-level directory of a web module is the document root of the application The document root contains: JSP pages client-side classes client-side archives static web resources

Web Module Structure The document root contains a subdirectory /WEB-INF/ web.xml: web application deployment descriptor lib: JAR archives of libraries called by server-side classes

Web Module Structure classes: server-side classes: servlets utility classes JavaBeans components tags: tag files, which are implementations of tag libraries

Configuring Web Applications Web applications are configured via (optional) deployment descriptor /WEB-INF/web.xml file Configuration options: Map URLs to web components Set initialization parameters Map errors to error screens Declare welcome files Declare resource references

Mapping URLs to Web Components When a request is received by the web container it must determine which web component should handle the request Need to add a servlet definition and a servlet mapping for each servlet to web.xml file ServletName ServletClass ServletName /path

Initialization Parameters It's possible to pass initialization parameters to the context or to a web component Context parameters: name value Servlet parameters (within servlet definition): name value

Handling Errors Web container generates default error page You can specify custom default page to be displayed instead Steps to handle errors Create appropriate error HTML pages for error conditions Modify the web.xml accordingly

Example: Setting Error Pages exception.BookNotFoundException /errorpage1.html exception.BooksNotFoundException /errorpage2.html exception.OrderException /errorpage3.html

Example: web.xml <web-app xmlns=" xmlns:xsi=" xsi:schemaLocation=" version="3.0"> Your team project name Team N servlets name_of_context_initialization_parameter value_of_context_initializtion_parameter MyServlet com.web.demo.MyServlet MyServlet /servlet

WAR Files A web module can be deployed as an unpacked file structure or can be packaged in a JAR file known as a Web Archive File WAR file can be created by: executing jar command using Ant target using IDE (Eclipse for instance) using Maven

Setting a Context Root A context root identifies a web application in a Java EE server The server is responsible for mapping URL’s that start with a specific prefix to the location of a web application Usually this is done with a web server configuration file

Using Maven & Jetty A convenient way to develop, build, deploy and run Web application is by using: Maven build tool Jetty web server

Creating Directory Structure Maven supports the notion of creating a complete project template with a simple command To create Web project template need to use maven-archetype-webapp archetype type in a single line: mvn archetype:create -DgroupId=com.maven2example -DartifactId=maven2example_webapp -DarchetypeArtifactId=maven-archetype-webapp

Maven Web Directory Structure /src/main/webapp/ - directory structure for a WAR

Packaging Executing the command mvn package creates a WAR file

Running with Jetty It’s easy to run application by using Jetty plugin for Maven Jetty is an open-source, standards-based, full- featured web server implemented entirely in Java First created in 1995 Stable release: /

Jetty Maven Plugin Useful for rapid development and testing You can add it to any webapp project that is structured according to the usual Maven defaults The plugin can then periodically scan your project for changes and automatically redeploy the webapp if any are found maven-plugin.html

Running with Jetty Add the Jetty plugin to the pom.xml maven2example_webapp org.mortbay.jetty jetty-maven-plugin v

Running with Jetty Execute mvn jetty:run command >mvn jetty:run [INFO] Scanning for projects [INFO] --- jetty-maven-plugin: v :run servlet-jpa-app --- [INFO] Configuring Jetty for project: servlet-jpa-app [INFO] webAppSourceDirectory not set. Defaulting to C:\tmp\servlet-jpa-app\src\main\webapp [INFO] Reload Mechanic: automatic [INFO] Classes = C:\tmp\servlet-jpa-app\target\classes [INFO] Context path = /servlet-jpa-app [INFO] Tmp directory = C:\tmp\servlet-jpa-app\target\tmp [INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml [INFO] Web overrides = none [INFO] web.xml file = file:/C:/tmp/servlet-jpa-app/src/main/webapp/WEB-INF/web.xml [INFO] Webapp directory = C:\tmp\servlet-jpa-app\src\main\webapp... [INFO] Started Jetty Server Stop by Ctrl+C

Opening the Application Open your web browser to

Context Path Configuration maven2example_webapp org.mortbay.jetty jetty-maven-plugin v /my-super-app Now valid URL is:

Opening the Application Open your web browser to

Resources Introduction to Java Platform, Enterprise Edition 7 whitepaper pdf whitepaper pdf The Java EE 7 Tutorial Article “App server, Web server: What's the difference?” appvswebserver.html

Resources Building Web Applications with Maven 2 applications-with-maven-2.html applications-with-maven-2.html Jetty Maven Plugin maven-plugin.html