Manabu Nakamura. 128 JAVA Developer 2002/09. C:\>cd webapps\examples\web-inf\classes C:\>javac -classpath.;..\..\..\..\common\lib\servlet.



Similar documents
Pure server-side Web Applications with Java, JSP. Application Servers: the Essential Tool of Server-Side Programming. Install and Check Tomcat

Class Focus: Web Applications that provide Dynamic Content

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java

2.8. Session management

Java Servlet Tutorial. Java Servlet Tutorial

An introduction to web programming with Java

2. Follow the installation directions and install the server on ccc

Supplement IV.E: Tutorial for Tomcat. For Introduction to Java Programming By Y. Daniel Liang

Web Application Programmer's Guide

Creating Java EE Applications and Servlets with IntelliJ IDEA

PA165 - Lab session - Web Presentation Layer

GET /FB/index.html HTTP/1.1 Host: lmi32.cnam.fr

Addressing Application Layer Attacks with Mod Security

Tutorial c-treeace Web Service Using Java

Install & Configure Apache with PHP, JSP and MySQL on Windows XP Pro


In this chapter the concept of Servlets, not the entire Servlet specification, is

COMP9321 Web Applications Engineering: Java Servlets

Hypertext for Hyper Techs

Web Container Components Servlet JSP Tag Libraries

Running multiple Tomcat versions on the same host

Developing Applications With The Web Server Gateway Interface. James Gardner EuroPython 3 rd July

Principles and Techniques of DBMS 5 Servlet

Java Technologies. Lecture X. Valdas Rapševičius. Vilnius University Faculty of Mathematics and Informatics

Introduction to Web Technologies

reference: HTTP: The Definitive Guide by David Gourley and Brian Totty (O Reilly, 2002)

HTTP Response Splitting

THE PROXY SERVER 1 1 PURPOSE 3 2 USAGE EXAMPLES 4 3 STARTING THE PROXY SERVER 5 4 READING THE LOG 6

WebSphere and Message Driven Beans

SERVLETSTUTORIAL. Simply Easy Learning by tutorialspoint.com. tutorialspoint.com

Handling the Client Request: Form Data

Integrating Apache Web Server with Tomcat Application Server

No. Time Source Destination Protocol Info HTTP GET /ethereal-labs/http-ethereal-file1.html HTTP/1.

HTTP Caching & Cache-Busting for Content Publishers

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post

Configuring multiple Tomcat instances with a single Apache Load Balancer

JSP Java Server Pages

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

Building Web Applications with Servlets and JavaServer Pages

Introduction to J2EE Web Technologies

JSP. Common patterns

Developing an EJB3 Application. on WebSphere 6.1. using RAD 7.5

The Hyper-Text Transfer Protocol (HTTP)

Web Programming: Announcements. Sara Sprenkle August 3, August 3, Assignment 6 due today Project 2 due next Wednesday Review XML

Penetration from application down to OS

AN OVERVIEW OF SERVLET AND JSP TECHNOLOGY

URLs and HTTP. ICW Lecture 10 Tom Chothia

JAVA? Millest räägime. Servlet, JSP. Hello World JAVA. JAVA - Versions. JAVA - primary goals. JAVA Web Container Servlet JSP

Architecture of So-ware Systems HTTP Protocol. Mar8n Rehák

TCP/IP Networking An Example

Virtual Open-Source Labs for Web Security Education

Playing with Web Application Firewalls

Security-Assessment.com White Paper Leveraging XSRF with Apache Web Server Compatibility with older browser feature and Java Applet

CONTROLLING WEB APPLICATION BEHAVIOR WITH

Arnaud Becart ip- label 11/9/11

Headless Drupal. Buzzword or Next Big Thing? Drupal City Berlin

1945: 1989: ! Tim Berners-Lee (CERN) writes internal proposal to develop a. 1990:! Tim BL writes a graphical browser for Next machines.

Dataworks System Services Guide

Package httprequest. R topics documented: February 20, 2015

Research of Web Real-Time Communication Based on Web Socket

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,...

Outline Definition of Webserver HTTP Static is no fun Software SSL. Webserver. in a nutshell. Sebastian Hollizeck. June, the 4 th 2013

Introduction Les failles les plus courantes Les injections SQL. Failles Web. Maxime Arthaud. net7. Jeudi 03 avril 2014.

Vodia PBX RESTful API (v2.0)

Chapter 2: Interactive Web Applications

STREAMEZZO RICH MEDIA SERVER

CHAPTER 9: SERVLET AND JSP FILTERS

Configure a SOAScheduler for a composite in SOA Suite 11g. By Robert Baumgartner, Senior Solution Architect ORACLE

How to program Java Card3.0 platforms?

1. When will an IP process drop a datagram? 2. When will an IP process fragment a datagram? 3. When will a TCP process drop a segment?

HTTP Authentifizierung

Infor Web UI High Availability Deployment

Chapter 27 Hypertext Transfer Protocol

Server Setup and Configuration

People Data and the Web Forms and CGI. HTML forms. A user interface to CGI applications

Project #2. CSE 123b Communications Software. HTTP Messages. HTTP Basics. HTTP Request. HTTP Request. Spring Four parts

Visa Checkout September 2015

Polyglot: Automatic Extraction of Protocol Message Format using Dynamic Binary Analysis

Internet Technologies Internet Protocols and Services

Session Tracking Customized Java EE Training:

Java Server Pages Tutorial

Web Services April 21st, 2009 with Hunter Pitelka

Ch-03 Web Applications

People Data and the Web Forms and CGI CGI. Facilitating interactive web applications

Arjun V. Bala Page 20

Implementing the Shop with EJB

CA Workload Automation DE

HTTP Authentication. RFC 2617 obsoletes RFC 2069

JAHIA CMS AND PORTAL SERVER

Java Web Programming. Student Workbook

CHAPTER 5. Java Servlets

Web Programming. Robert M. Dondero, Ph.D. Princeton University

Cyber Security Workshop Ethical Web Hacking

Application layer Web 2.0

ServiceAPI to the WorldLingo System

HTTP Protocol. Bartosz Walter

Agenda. Summary of Previous Session. Application Servers G Session 3 - Main Theme Page-Based Application Servers (Part II)

Web Application Forensics:

Managing Data on the World Wide-Web

Web Application Security

Transcription:

Manabu Nakamura C:\>cd webapps\examples\web-inf\classes C:\>javac -classpath.;..\..\..\..\common\lib\servlet. jar HelloServlet.java % cd webapps/examples/web-inf/classes % javac -classpath.\;../../../../common/lib/servlet. jar HelloServlet.java % cd webapps/examples/web-inf/classes % javac -classpath.:../../../../common/lib/servlet.jar HelloServlet.java 128 JAVA Developer 2002/09

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>hello</title> </head> <body> <font size="+2">hello, <%= request.getheader("user-agent") %>!</font> </body> </html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>expressions</title> </head> <body> <font size="+2">1 + 2 + 3 = <%= 1 + 2 + 3 %></font> <br> <font size="+2">the square root of 2 = <%= java.lang.math.sqrt2 %></font> </body> </html> public class HelloServlet extends javax.servlet.http.httpservlet { public void dogetjavax.servlet.http.httpservletrequest request, javax.servlet.http.httpservletresponse response throws javax.servlet.servletexception, java.io.ioexception { response.setcontenttype"text/html"; java.io.printwriter out = response.getwriter ; out.println"<!doctype HTML PUBLIC\r\n"; out.println"\"-//w3c//dtd HTML 4.01"; out.println"transitional//en\">"; out.println"<html>"; out.println"<head>"; out.println"<title>hello Servlet</title>"; out.println"</head>"; out.println"<body>"; out.println"<font size=\"+2\">hello,"; out.printrequest.getheader"user-agent"; out.println"!</font>"; out.println"</body>"; out.println"</html>"; 129

out.write"<!doctype HTML PUBLIC\r\n\"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n<html>\r\n"; out.write"<head>\r\n<title>hello</title>\r\n</head>\r\n<body>\r\n<font size=\"+2\">hello,\r\n"; out.printrequest.getheader"user-agent"; out.write"!</font>\r\n</body>\r\n</html>\r\n"; public class HelloServlet extends javax.servlet.http.httpservlet { public class HelloServlet { % telnet localhost 8080Enter GET /examples/servlet/helloservlet HTTP/1.0Enter User-Agent: everyoneenter Enter 130 JAVA Developer 2002/09

GET /examples/servlet/helloservlet HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 Windows; U; Win 9x 4.90; ja-jp; rv:1.0.0 Gecko/20020530 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/xmng,image/png,image/jpeg,image/gif;q=0.2,text/css,/;q=0.1 Accept-Language: ja, en-us;q=0.66, en;q=0.33 Accept-Encoding: gzip, deflate, compress;q=0.9 Accept-Charset: Shift_JIS, utf-8;q=0.66, ;q=0.66 Keep-Alive: 300 Connection: keep-alive Cache-Control: max-age=0 % telnet localhost 8080Enter Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /examples/servlet/helloservlet HTTP/1.0Enter User-Agent: everyoneenter Enter HTTP/1.1 200 OK Content-Type: text/html Connection: close Date: XXX, XX XXX 2002 XX:XX:XX GMT Server: Apache Tomcat/4.0.3 HTTP/1.1 Connector <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>hello Servlet</title> </head> <body> <font size="+2">hello, everyone!</font> </body> </html> Connection closed by foreign host. 131

public class HelloServlet extends javax.servlet.http.httpservlet { public void doget(javax.servlet.http.httpservletrequest request, javax.servlet.http.httpservletresponse response) throws javax.servlet.servletexception, java.io.ioexception { response.setcontenttype("text/html"); java.io.printwriter out = response.getwriter(); out.println("<!doctype HTML PUBLIC"); out.println("\"-//w3c//dtd HTML 4.01 Transitional//EN\">"); out.println("<html>"); out.println("<head>"); out.println("<title>hello (Servlet)</title>"); out.println("</head>"); out.println("<body>"); out.print("<font size=\"+2\">hello, "); out.print(request.getheader("user-agent")); out.println("!</font>"); out.println("</body>"); out.println("</html>"); 132 JAVA Developer 2002/09

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>confirmation</title> </head> <body> <font size="+2"><%= out.getclass %> extends javax.servlet.jsp.jspwriter.</font> </body> </html> java.io.printwriter javax.servlet.jsp.jspwriter 133

134 JAVA Developer 2002/09 $CATALINA_HOME/common/lib/servlet.jar javax.servlet.http.httpservletrequest javax.servlet.http.httpservletresponse

package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import org.apache.jasper.runtime.*; public class hello$jsp extends HttpJspBase { public void _jspservice(httpservletrequest request, HttpServletResponse response) throws java.io.ioexception, ServletException { JspFactory _jspxfactory = null; PageContext pagecontext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; _jspxfactory = JspFactory.getDefaultFactory(); response.setcontenttype("text/html;charset=iso-8859-1"); pagecontext = _jspxfactory.getpagecontext(this, request, response, "", true, 8192, true); application = pagecontext.getservletcontext(); config = pagecontext.getservletconfig(); session = pagecontext.getsession(); out = pagecontext.getout(); <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>get or POST</title> </head> <body> <form method="get" action="hello.jsp"> <input type="submit" value="get /examples/developer/hello.jsp"> </form> <form method="post" action="hello.jsp"> <input type="submit" value="post /examples/developer/hello.jsp"> </form> <form method="get" action="/examples/servlet/helloservlet"> <input type="submit" value="get /examples/servlet/helloservlet"> </form> <form method="post" action="/examples/servlet/helloservlet"> <input type="submit" value="post /examples/servlet/helloservlet"> </form> </body> </html>... C:\>jar tf servlet.jarc:\>jar xf jakarta-servletapi-4- src.zip 135

public void dopostjavax.servlet.http.httpservletrequest request, javax.servlet.http.httpservletresponse response throws javax.servlet.servletexception, java.io.ioexception { dogetrequest, response; 136 JAVA Developer 2002/09

LoadModule jk_module modules/mod_jk.so JkWorkersFile /usr/local/jakarta-tomcat-4.0.3-le-jdk14/conf/workers.properties JkLogFile /usr/local/jakarta-tomcat-4.0.3-le-jdk14/logs/mod_jk.log JkLogLevel warn JkMount /examples/ ajp13 workers.tomcat_home=/usr/local/jakarta-tomcat-4.0.3-le-jdk14 workers.java_home=/usr/j2se ps=/ worker.list=ajp13 worker.ajp13.port=8009 worker.ajp13.host=localhost worker.ajp13.type=ajp13 worker.ajp13.lbfactor=1 137