Apache Tomcat Representation and Management of Data on the Web.

Slides:



Advertisements
Similar presentations
May 13th, Lucek Consulting Basic Java Servlet/JSP Web Development David Lucek Lucek Consulting
Advertisements

Hyrax Installation and Customization ESIP ‘08 Summer Meeting Best Practices in Services and Data Interoperability Dan Holloway James Gallagher.
beas WEB App Installation
Web Application Server Apache Tomcat Downloading and Deployment Guide.
MC365 Application Servers: Servlets. Today We Will Cover: What a servlet is The HTTPServlet and some of its more important methods How to configure the.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
Installing JDK and Tomcat Vijayan Sugumaran Department of DIS Oakland University.
Tomcat Organization Deploying applications. Confusion Like a web server Root locations are from a defined directory location In addition… from that point.
Configuring web servers and web applications 1. 2 Server configuration vs. application configuration A web server may run several web application Server.
1 Running Web Applications with Tomcat CS , Winter 2007/8.
Jsp. JBoss Many servers (like JBoss and Glassfish) are Tomcat servers. The file structures and format for deployment are the same. Where (in what server.
DT211/3 Internet Application Development Web Servers.
XML-RPC The Quickest Way to Web Services. THE MOVES INSTITUTE XML-RPC XML-RPC is an attempt to implement conventional Remote Procedure Call (RPC) concepts.
Objectives:1. Investigate the Web application deployment descriptor 2. Install and deploy Tomcat and struts 3. Design and deploy a struts application Struts.
Tomcat Configuration A Very, Very, Very Brief Overview.
Building and Deploying a Simple Web Application. Tomcat and JSP Tomcat is an application server, commonly used to host JSP applications Applications are.
Creating a.war file W(eb) AR(chive). Creating a.war file The following article may contain actual software programs in source code form. This source code.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Julien Thibault / Phil Brewster / Kristina Doing-Harris
Java Servlets and JSP.
Softsmith Infotech Installing and Configuring Tomcat.
Configuring Apache tomcat Specifying the server port NOTE: Edit the install_dir/conf/server.xml and change the port attribute of the connector element.
WebServer & Tomcat By B. Venkateswarlu M.Tech Assoc Prof IT(Dept) Newton’s Institute of Engineering.
Tomcat Celsina Bignoli History of Tomcat Tomcat is the result of the integration of two groups of developers. – JServ, an open source.
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
Installing and Configuring Tomcat A quick guide to getting things set up on Windows.
Apache Tomcat Web Server SNU OOPSLA Lab. October 2005.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Apache Tomcat Representation and Management of Data on the Web.
Java Servlets CS-422. Application Mapping Your servlet application will be mapped to a directory structure: –“myapp” maps to some directory C:/docs/apps/myapp.
1 CS6320 – Deployment and Context L. Grewe 2 The Servlet Container Servlets run in a container sometimes called the Servlet engine. Servlets run in a.
Apache + Tomcat. Apache + Tomcat Download mod_webapp.so:
SchwartzGBIF Nodes III29 April 2003 DiGIR Portal Installation And Configuration.
Application Servers: Tomcat. What is an application server? Servlets are Java’s answer to server-side programming. Servlets are a special type of Java.
CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 5_1 George Koutsogiannakis/ Summer
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
111 Java Servlets Dynamic Web Pages (Program Files) Servlets versus Java Server Pages Implementing Servlets Example: F15 Warranty Registration Tomcat Configuration.
CS-4220 Dr. Mark L. Hornick1 Servlet configuration and deployment.
Installing Apache Axis Setting up your Tomcat server to use Web Services.
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 Lec 27. Creating a Simple Web Application in Tomcat.
C HAPTER 11 D EPLOYING YOUR WEB APP. WAR FILE A WAR file is simply a snapshot of your web app structure, in a nice portable, compressed form (it is really.
Topic Java EE installation (Eclipse, glassfish, etc.) Eclipse configuration for EE Creating a Java Web Dynamic Project Creating your first servlet.
Java Enterprise Edition Programming Page 1 of 9Configuring Servlets Web Application Context Name  In multiple web applications, a “context name” is used.
IPT – Getting Started June Online Resources Project Website Requirements Server Preparation Installation Running IPT Installation Demo Upgrade/Reinstall.
1 G52IWS: Example Web-services Chris Greenhalgh. 2 Contents Software requirements AXIS web service run-time components Getting started with Jetty & AXIS.
HTTP protocol Java Servlets. HTTP protocol Web system communicates with end-user via HTTP protocol HTTP protocol methods: GET, POST, HEAD, PUT, OPTIONS,
NJIT 1 Apache Tomcat (Version 6.0) THETOPPERSWAY.COM.
 2003 Prentice Hall, Inc. All rights reserved Deploying a Web Application ( may include.war )
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.
Google App Engine using Java 1. Outline Getting started Guestbook example Todo example Simplified Madlib 2.
Deploying Web Applications to Tomcat Server Chun Guo
APACHE TOMCAT WEB SERVER
Checking the Server.
Hyrax Configuration.
Tomcat Celsina Bignoli
Advanced Java Programming
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Developing the Tools Montreal 2004
Representation and Management of Data on the Web
Checking the Server.
Installing and Configuring Tomcat
Apache Tomcat Web Server
Introduction to JBoss application server
Representation and Management of Data on the Web
Java Servlets and JSP.
Installing Tomcat.
Introduction to Java Servlets
Presentation transcript:

Apache Tomcat Representation and Management of Data on the Web

What is Tomcat? A Web server is a program that receives HTTP requests and returns HTTP responses Tomcat is a Web Server created by Apache Tomcat supports Servlets!

Installing Tomcat Create a directory for installation (tomcat_home) Inside the directory, type "tomcat setup" The following directories will be created: –conf –lib –logs –my-webapps-template-dir –webapps

Running Tomcat Go to the installation directory Use the command "tomcat start" to start the server Use the command "tomcat stop" to stop the server You get to the server by requesting on a web browser :port/ –Host is the machine on which you started tomcat –Port is the port number according to the configuration (default = 8080)

Note: Examples of Servlets (and JSP) are available here Note: You may have to disable the proxies of your web browser in order for this to work

Important Note Tomcat runs in the background. Tomcat has started and you can try to access it after you see at your prompt something like: :02:29 - PoolTcpConnector: Starting HttpConnectionHandler on :02:31 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007

Extremely Important Note When you run tomcat, it causes many processes to be created By order of the system: Do not run tomcat on pita, mangal, inferno, etc. Do run tomcat on your local workstation Remember to stop tomcat before logging off!!!

Changing the Default Port Open the file server.xml in the directory conf of the tomcat installationserver.xml <Connector className= "org.apache.tomcat.service.PoolTcpConnector"> <Parameter name="handler" value="org.apache.tomcat.service. http.HttpConnectionHandler"/> <Parameter name="port" value="8080"/>

The Directory Structure of a Web Application (1) Web applications are located in the webapps directory Each web application has its own subdirectory. The web application subdirectory is built in a standard fashion Note: After creating the subdirectory you must restart Tomcat, for tomcat to recognize it!

The Directory Structure of a Web Application (2) /dbi: The root directory of the dbi web application. Store here HTML and JSP files /dbi/WEB-INF: All resources for the web application that are not in the root directory. Store here web.xml (which describes your servlets) /dbi/WEB-INF/classes: Servlet and utility classes /dbi/WEB-INF/lib: Utility JAR files

Referring to your Files in the Browser To open a page called a.html in the ROOT directory of the dbi web application: – : /dbi/a.html To open a servlet called HelloWorld.class of the dbi web application – : /dbi/servlet/HelloWorld Ugh! Do we really need to specify directory "servlet" in order to reference the servlet?

Configuring Servlet Information If you simply put the Servlet class file in the dbi/WEB-INF/classes directory, it will be known to Tomcat by its class name You can configure the tomcat name and other things in the web.xml file, which should go in the dbi/WEB-INF directory.

The web.xml File Use the web.xml file to: –configure the way the servlet is called in the browser –give it initialization parameters –set session timeout An example web.xml file can be found here and is on the following slides here

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" " 30 hi HelloWorld login snoopy HTTPServlet object will become invalid after 30 minutes of inactivity

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" " 30 hi HelloWorld login snoopy Name of HelloWorld servlet is hi. Can be accessed at: : /dbi/servlet/hi

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" " 30 hi HelloWorld login snoopy Initialize the parameter "login" with value "snoopy

hi /hi hi *.hi 404 /servlet/NotFound Associate Servlet hi with given url pattern. Can be accessed at: : /dbi/hi Associate Servlet hi with extension.hi Can be accessed at: : /dbi/a.hi : /dbi/b.hi etc.

hi /hi hi *.hi 404 /servlet/NotFound Associate the error code of 404 with the servlet NotFound

Deploying your Web Application Go to the root directory of your application (e.g., dbi) Archive the distribution: jar -cvf dbi.war Move the war file to tomcat_home/webapps Remove the directory dbi Restart Tomcat Note: When you run tomcat, the war file is unpacked, so the directory dbi will be created

Think About it? When you change the web.xml file you have to restart Tomcat. Why? Where do you put your.java files? How do you get your class files where they belong?

Working with Apache: A Recommendation

Recommendation Develop you java code outside of the tomcat directories Compile to the correct directories Use ant to organize the process

Setting up your Directories Choose a directory to work in (e.g., ~/dbi/project) Create the directory with the following subdirectories: –etc: will contain the file web.xml –src: will contain your source files (your *.java files) –lib: will contain any jar files you need –web: will contain HTML and JSP pages for your site

Build File: Properties Here is an ant build fileHere You need to change the values for the following properties: –

Build File: Targets The build file has 5 targets: 1.prepare: Creates the directory hierarchy in the webapps directory for the application + copies web.xml file 2.clean: Deletes the directory hierarchy created in prepare 3.compile: Compiles the files from src to the proper directory under tomcat (which directory?)

Build File: Targets 4.all: does clean, prepare and compile 5.dist: creates a war file from the web application and a jar file from the web application