COMP9321 Web Applications Engineering: Java Servlets

Size: px
Start display at page:

Download "COMP9321 Web Applications Engineering: Java Servlets"

Transcription

1 COMP9321 Web Applications Engineering: Java s Service Oriented Computing Group, CSE, UNSW Week 2 H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 1 / 1

2 Different Layers in an Application Different solutions for each layer Presentation Layer JSP, XSLT, CSS, HTML Business logic Java classes Data Access Layer Data Access Objects Data Store RDBMS, OODBMS, XML Database H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 2 / 1

3 MVC pattern Browser response request Container 1 (Controller) 4 2 JSP (View) 3 JavaBean (Model) 5 Data request Server H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 3 / 1

4 Java s A Java technology for generating dynamic content. Used to process HTTP request and generate HTTP response. s are executed by a servlet container containers are web server extensions (eg., Apache Tomcat) that provide servlet functionality. Web Server Web Browser HTTP Request (URL + data) request Container classes <FORM> <INPUT> parameters... </INPUT> </FORM> HTTP Response: HTML (+javascript) response (content produced from servlet) DB H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 4 / 1

5 Java s A Java technology for generating dynamic content. Used to process HTTP request and generate HTTP response. s are executed by a servlet container containers are web server extensions (eg., Apache Tomcat) that provide servlet functionality. Web Server Web Browser HTTP Request (URL + data) request Container classes <FORM> <INPUT> parameters... </INPUT> </FORM> HTTP Response: HTML (+javascript) response (content produced from servlet) DB H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 4 / 1

6 Java s A Java technology for generating dynamic content. Used to process HTTP request and generate HTTP response. s are executed by a servlet container containers are web server extensions (eg., Apache Tomcat) that provide servlet functionality. Web Server Web Browser HTTP Request (URL + data) request Container classes <FORM> <INPUT> parameters... </INPUT> </FORM> HTTP Response: HTML (+javascript) response (content produced from servlet) DB H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 4 / 1

7 Java s A Java technology for generating dynamic content. Used to process HTTP request and generate HTTP response. s are executed by a servlet container containers are web server extensions (eg., Apache Tomcat) that provide servlet functionality. Web Server Web Browser HTTP Request (URL + data) request Container classes <FORM> <INPUT> parameters... </INPUT> </FORM> HTTP Response: HTML (+javascript) response (content produced from servlet) DB H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 4 / 1

8 Java s A Java technology for generating dynamic content. Used to process HTTP request and generate HTTP response. s are executed by a servlet container containers are web server extensions (eg., Apache Tomcat) that provide servlet functionality. Web Server Web Browser HTTP Request (URL + data) request Container classes <FORM> <INPUT> parameters... </INPUT> </FORM> HTTP Response: HTML (+javascript) response (content produced from servlet) DB H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 4 / 1

9 Tomcat Web container structure bin (star/stop the server), common/lib (shared libraries, Tomcat-wide) conf (server configuration files) webapps (Web application base directory) The structure of a Web Application Archive (.war): simple.war\ index.html WEB-INF\ lib classes\myfirst.class web.xml To access the Web app: H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 5 / 1

10 Making servlets available in the Web container 1 Create the standard Web application directory structure 2 Write a servlet 3 Compile 4 Write a deployment descriptor (web.xml) 5 Package all up into an archive file and name it appname.war 6 Copy the war file into $CATALINA HOME/webapps 7 The server detects the application and makes it available to the users: There are tools developed designed to assist the programmers with the series of tasks involved in writing Web applications. e.g., Ant tasks for Tomcat, Eclipse Web Tools Platform (WTP) H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 6 / 1

11 How the Container handles a request ((HeadFirst) p.42) HTTP Request Container Client Web Server Machine Container HttpResponse Client HttpRequest Client Container request response thread H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 7 / 1

12 How the Container handles a request ((HeadFirst) p.42) Container request thread response service() Container response Generated Content thread service() doget() HTTP Response Generated Content Container request thread Client response H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 8 / 1

13 Your inherits lifecycle methods <<interface>> service(request, Response) init(config) destroy() getconfig() getinfo() javax.servlet.* javax.servlet.http.* Generic service(request, Response) init(config) destroy() getconfig() getinfo() getinitparameter(string) getinitparameternames() getcontext() log(string) Http service(request, Response) service(httprequest, HttpResponse) doget(httprequest, HttpResponse) dopost(httprequest, HttpResponse) dohead(httprequest, HttpResponse) doput(httprequest, HttpResponse) dooptions(httprequest, HttpResponse) My doget(httprequest,httpresponse) mybusinessmethod() H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 9 / 1

14 A typical looks like this package com.comp9321; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class One extends Http { public void doget (HttpRequest req, HttpResponse res) throws Exception, IOException { } } res.setcontenttype("text/html"); PrintWriter out = res.getwriter(); java.util.date today = new java.util.date(); out.println("<html><body><h1>one says it is now: "); out.println(today + "</H1></BODY></HTML>"); out.close(); Note: No main() - the container calls the servlet methods like doget() through service()... How does the container know which servlet to call? H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 10 / 1

15 Names A servlet may have three names Name that the client uses Name that used at deployment time Actual class name (i.e., One.class) All these names are declared and mapped in the deployment descriptor (web.xml) Mapping servlet names improves your app s flexibility and security in web.xml <web-app xmlns=" <servlet> <servlet-name>one</servlet-name> <servlet-class>com.comp9321.one</servlet-class> </servlet> <servlet-mapping> <servlet-name>one</servlet-name> <url-pattern>/oneservlet</url-pattern> </servlet-mapping>... URL to the servlet - H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 11 / 1

16 A Lifecycle of a The Web container controls the lifecycle of a servlet class Web Container Class Object Container load class Instantiate servlet init() service() initia lised handle client requests (doxx()) destroy() initia lised H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 12 / 1

17 s Life ((HeadFirst) p.99) lifecycle calls init() When it s called What it s for Override it? Container calls init() after the Gives you a chance to initialise No* servlet instance is created but your servlet before han- before the serlvet can service dling any requests client s requests service() When the first client request comes in, the container starts a new thread and calls service() method doxx() The service() method invokes appropriate doxx() This one looks at the request and determines the HTTP method and invokes the matching doxx() on the servlet This is where your code begins. This is the method that is responsible for whatever the servlet is supposed to be doing * Maybe... (e.g., getting a database connection), but not always No. Always H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 13 / 1

18 Why care about this initialisation details? (HeadFirst) p.104 Once the servlet is initialised, the servlet gets access to two important objects: A Config object: One Config object per servlet Use it to pass deploy-time information to the servlet (any info. that you do not want to hard-code into the servlet) Use it to access the Context Parameters are configured in the deployment descriptor A Context One Context per Web application (they should have named it AppContext) Use it to access parameters that are Web application-wide Use it as a kind of application bulletin-board, where you can put up info (called attributes) that other parts of the application can access Use it to get server info, including the name and version of the container, etc. H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 14 / 1

19 Why care about this initialisation details? (HeadFirst) p.104 does not exist Context App.-Wide params constructor init(config) destroy() JSP A service() (initialised) A B C By the time servlet is running doxx(), it's got a Config Config Config Config -Wide params Config H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 15 / 1

20 Config: Passing servlet configuration information The Web container can pass some configuration information (eg., initial parameters) for individual servlets... in web.xml: <web-app> <servlet> <servlet-name>demo</servlet-name> <servlet-class>com.comp9321.configdemo</servlet-class> <init-param> <param-name>webmaster</param-name> <param-value>helen Paik</param-value> </init-param> <init-param> <param-name>webmaster </param-name> </init-param> </servlet> <servlet> <servlet-name>seconddemo</servlet-name> <servlet-class>com.comp9321.nextdemo</servlet-class> <init-param> <param-name>language</param-name> <param-value>italian</param-value> </init-param> </servlet> </web-app> H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 16 / 1

21 Who s responsible for what? Container or Creates the request and response objects? Calls the service() method? Adds HTML content to the response object? Has a name that matches the <servlet-class> element in the DD? Has a reference to the response objects? Finds the URLs in the DD? Starts a new thread to handle requests? Setting the content type of the response? H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 22 / 1

22 The difference between GET and POST GET /myapp/selectbeertaste.do?colour=dark&taste=malty HTTP/1.1 HOST: User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-us Accept: text/xml, application/xml, application/xhtml+xml, text/html, video/x-mng, image/png Accept-Language: en-us Connection: Keep-alive POST /myapp/selectbeertaste.do HTTP/1.1 HOST: User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-us Accept: text/xml, application/xml, application/xhtml+xml, text/html, video/x-mng, image/png Accept-Language: en-us Connection: Keep-alive colour=dark&taste=malty BODY (payload) New Empty Line H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 23 / 1

23 The difference between GET and POST Sensitive data should NOT be used with GET GET s parameter data shows up in the browser s input bar POST cannot be bookmarked If you want to let users specify search parameters and save it for later, cannot use POST GET is supposed to be used for getting things - information retrieval POST is supposed to be used for sending data to be processed - update or change something on the server GET Sends back a response with a generated HTML page POST uses the POST data to update the database Sends back a response with a generated HTML page DB H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 24 / 1

24 What determines whether the browser sends GET/POST GET (HeadFirst) p.117 POST GET <A HREF=" here</a> <form method="post" action="selectbeer.do"> Select Beer<p> <option>light <option>amber <option>dark </select> <center> <input type="submit"> </center> </form> <form action="selectbeer.do"> Select Beer<p> <option>light <option>amber <option>dark </select> <center> <input type="submit"> </center> </form> What if I want to support both GET and POST? public void dopost(...) throws { doget(request, response) } H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 25 / 1

25 Request & Response Interfaces <<interface>> javax.servlet.request getattribute(string) getcontentlength() getparameternames() getparameter() // Many more methods... <<interface>> Response getbutffersize() setcontenttype() getwriter() // Many more methods... <<interface>> javax.servlet.http.httprequest getcontextpath() getcookies() getheader(string) getquerystring() getsession() //Many more methods <<interface>> javax.servlet.http.httpresponse addcookies() addheader() encoderedirecturl() senderror()... //Many more methods The container implements HttpRequest and HttpRequest All you should care about is when servlet is called the service() passes two objects that implements the two to your servlet H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 26 / 1

26 HttpRequest, HttpResponse The service() method invokes appropriate doxxx() method when the servlet receives an HTTP request. Typically, your (http) servlet code would have the following structure: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class My extends Http { public void doget(httprequest req, HttpResponse res) throws IOException, Exception { // your code to generate response... } public void dopost(httprequest req, HttpResponse res) throws IOException, Exception { // your code to generate response... } HTTP request method determines whether doget() or dopost() runs. H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 27 / 1

27 A simple servlet that generates a text message import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class Static extends Http { public void doget(httprequest request, HttpResponse response) throws IOException, Exception { response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<body>"); out.println("<head>"); out.println("<title>static </TITLE>"); out.println("</head>"); out.println("<body>"); out.println("<center><h1>hello folks!</h1></center>"); out.println("</body>"); out.println("</html>"); } } H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 28 / 1

28 When you do not want to process the response yourself if (worksforme) { // handle the request } else { response.sendredirect(" } Redirection (sendredirect()) Type in a URL (HeadFirst) p new URL (status code 301 and location) The servlet decides that the request should go to a different URL Redirect The servlet calls sendredirect(astring) on the response Sends request for the new URL final response Another H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 35 / 1

29 Request Dispatching You may want to: include the output from another servlet delegate (forward) the request processing to another servlet include a static HTML content You can use methods in the RequestDispatcher interface: include: to include content from another resource public void include(httprequest req, HttpResponse res) forward: forward a request to another servlet public void forward(httprequest req, HttpResponse res) H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 36 / 1

30 Request Dispatching You may want to: include the output from another servlet delegate (forward) the request processing to another servlet include a static HTML content You can use methods in the RequestDispatcher interface: include: to include content from another resource public void include(httprequest req, HttpResponse res) forward: forward a request to another servlet public void forward(httprequest req, HttpResponse res) H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 36 / 1

31 Forwarding a request to another servlet Using include(): The called servlet can only alter the body of the response, and not the headers. The path information of the request also continues to reflect the original request location. Using forward(): no content may have been committed to the client (eg., flushbuffer()) the called servlet can adjust the headers as well as the body of the response (content produced up to the forward call is cleared from the buffer). The path information of the request is altered to reflect the location of the called servlet, and no further output can occur after returning from a forward call (the output is committed upon returning from the call). H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 41 / 1

32 Forwarding a request to another servlet Using include(): The called servlet can only alter the body of the response, and not the headers. The path information of the request also continues to reflect the original request location. Using forward(): no content may have been committed to the client (eg., flushbuffer()) the called servlet can adjust the headers as well as the body of the response (content produced up to the forward call is cleared from the buffer). The path information of the request is altered to reflect the location of the called servlet, and no further output can occur after returning from a forward call (the output is committed upon returning from the call). H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 41 / 1

33 Attributes and Sharing Attributes An attribute is an object bound to one of the following objects: Context (web-app wide object!) HttpRequest HttpSession an attribute is simply a name/value pair - name is a String and attribute is an Object. Think of it an object pinned onto a board. Somebody sticks it on the board so that others can get it... A Bulletin Board Attributes C B Customer Helen Course COMP9321 Choice DarkColour D H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 44 / 1

34 Who has access to the board and how long does it live? read read write Context Attributes DB Connection ConcurrentUsers 42 Admin read read (HeadFirst, p.187) JSP Everyone in the application has access Session Attributes read write Shopping Cart A UserName Helen read JSP Accessible to only those with access to a specific HttpSession write Request Attributes OptionChoice Dark Beer read JSP Accessible to only those with access to a specific (Http)Request H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 45 / 1

35 Attributes API (HeadFirst, p. 189) Context <<interface>> Context getinitparameters(string) getinitparameternames() getattribute(string) setattribute(string, Object) removeattribute(string) getattributenames() getmajorversion() getinfo() // Many more methods... Request <<interface>> Request getcontexttype() getparameter() getattribute(string) setattribute(string, Object) removeattribute(string) getattributenames() // Many more methods... Session <<interface>> HttpSession setmaxinactiveinterval() getlastaccessedtime() getattribute(string) setattribute(string, Object) removeattribute(string) getattributenames() // Many more methods... <<interface>> HttpRequest //Nothing related to attributes here... H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 46 / 1

36 Attributes are not parameters (HeadFirst, p. 186) Types Attributes Context (Web App.) Request, Session Parameters context init params request params, servlet init params Method to set setattribute(string name, In DD and via client input Object value)... Return type Object String Method to get getattribute(string name) getinitparameters(string name) no such thing as Session parameters Object returned from getattribute() has to be casted. H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 47 / 1

37 Request attributes and Request dispatching We use request attributes when you want some other component of the application take over all or part of your request. // code in doget() String postcode = getpostcode(request.parameter("suburb"); request.setattribute("pc", postcode); RequestDispatcher view = request.getrequestdispatcher("displaypostcode.jsp"); view.forward(request, response); // the JSP will use the attribute pc to access the postcode. There is no reason to use context or session attributes, since it only applies to this request (so request scope is enough). H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 48 / 1

38 Managing the user state In most web applications: The user needs to have continuous one-on-one interactions with the application. The user builds up data which may have to be shared across multiple pages in the application. eg., Think of a shopping cart or a flight booking... H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 49 / 1

39 Managing the user state A problem in HTTP request/response: Web applications need to maintain a user + his/her data. HTTP is a stateless protocol. A single request/response Nothing is remembered between requests from the same user It is a programmer s responsibility: The term session is used to represent the data associated with one user while s/he navigates around a Web applicaiton. A web application may concurrently host several sessions (i.e., multiple users). H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 50 / 1

40 Session Management request 1. Diane (HeadFirst) p.226 Request to recommend a Dark Beer response: What price range? Web container Beer Thread a response: What price range? Data for setattribute(): Diane Stores "Dark Beer" for Diane request 2. Diane request 1. Selects "Expensive" response: Guiness Web container Request to recommend a Wheat Beer Terri response: What price range? response: Guiness Beer Thread b response: What price range? Thread c Data for Diane Data for Terri H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 51 / 1

41 How does the container know who the client is? The client needs a unique Session ID request 1. request, dark new! - generate an ID ID#4123 Session Diane response, ID#4123 Web container setattribute(): Stores "Dark Beer" for Diane request 2. Diane request 1. request, Expensive, ID#4123 response, ID#4123 Terri request, wheat existing ID! request, ID#4123 HttpRequest new! - generate ID Web container response, ID#5555 ID#5555 Session ID#4123 Session setattribute(): Stores "Wheat Beer" for Terri H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 52 / 1

42 Session Management There are a number of ways to deal with sessions. The basic idea: When a user request comes in, besides sending the response, the container also sends an identifier the identifier is recorded by the server When the container receives a request with the same identifier, it can treat the request as belonging to the same user There are four techniques available: Without the container s help: URL rewriting HTML hidden fields Cookies With the container s help: HTTP Session objects H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 53 / 1

43 URL Rewriting In this method, you append a token or identifier of the session to the URL of the next servlet (or resource). (inside nextservlet) request.getparameter("userid"); You need to consider several things: URL cannot be longer than 2,000 characters Special characters such as &,? or spaces should be encoded The values you pass can be seen in the URL H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 54 / 1

44 HTML hidden fields A token or identifier is passed as the value for an HTML hidden field in a form. <FORM METHOD=POST ACTION="/nextservletl"> <INPUT TYPE="hidden" NAME="token" VALUE="990088"> <INPUT TYPE="hidden" NAME="allowed" VALUE="true"> <INPUT TYPE="submit" NAME="Continue"> (inside nextservlet) request.getparameter("token"); request.getparameter("allowed"); URL cannot be seen by the user but you still can read them from viewing the HTML source. an HTML form is always required in every page H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 55 / 1

45 Cookies A cookie is a small data item that was introduced to maintain HTTP state by Netscape around A cookie is created by the server and sent to a browser inside a header. It is subsequently used by the server The browser does not interpret cookies Cookies are kept in the browser s memory, or can be written to a file for future references Eg., Inside a cookie file Set-Cookie: username="joe"; path="/"; domain=" expires=" :00:00GMT"; version=0 H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 56 / 1

46 Cookies In servlet programming, a cookie is represented by the Cookie class in the javax.servlet.http package. Cookie c1 = new Cookie("myCookie", "secret"); You then can add the cookie to the HTTP response using the addcookie method of the HttpResponse interface: response.addcookie(c1); Note that because cookies are carried in the request and response headers, you must not add a cookie after an output has been written to the HttpResponse object. setdomain() getdomain() setmaxage() getmaxage() setpath() getpath() getname() setvalue() H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 57 / 1

47 HTTP Sessions with JSESSIONID cookie The most convenient way of managing sessions is through the Session object, represented by the javax.servlet.http.httpsession interface For each user, the container creates an HttpSession object to be associated with that user The HttpSession object acts like a Hashtable into which you can store any number of key/object pairs (called HttpSession Attributes) An HttpSession object relies on a cookie or URL rewriting to send a token to the client. The token is usually a unique number called the session identifier (JSESSIONID). This session identifier is used to associate a user with a Session object in the server. H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 60 / 1

48 HTTP Sessions Interface Request HTTP/ OK Set-Cookie: JSESSIONID=0AAB6C8DE415 Content-Type: text/html Content-Lengh: 397 Date: Wed, 19 Nov :25:40 GMT Server: Apache 1.1 Connection: close <html>... </html> Set Cookie Web container Next Request POST /select/beerpricerange HTTP/1.1 Host: User-Agent: Mozilla 5.0 Cookie: JSESSION=0AAB6C8DE415 Accept: next/xml,application/xml,application/xhtml Accept-Language: en-us Web container H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 61 / 1

49 An example of using HttpSession object: the scenario Issue Welcome Start Session Welcome Create a Journey object for the user Display Choices Menu Add Choice to Journey Show Journey so far Control Close Session Enough H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 62 / 1

50 The Journey Object In a Journey object, a record of the user s proposed travel destinations is maintained. import java.util.*; import java.io.serializable; public class Journey implements Serializable { private Vector Places; public Journey() { Places = new Vector(); } public Iterator getplaces() { return this.places.iterator(); } public boolean addplace(string place) { return Places.add(place); } } public String tostring() { return "Journey to "; } H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 63 / 1

51 Using a Journey Object The following segment of code: 1 initialises a new Journey object, 2 adds VIC then NSW then QLD to the journey, 3 then (iii) print out the all the places on the route. Journey jny = new Journey(); jny.addplace("vic"); jny.addplace("nsw"); jny.addplace("qld"); Iterator i = jny.getplaces(); while (i.hasnext()) System.out.println("- "+ i.next()); H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 64 / 1

52 How session tracking works... User request response Travel-Application Welcome request response (sessid=50) request (sessid=50) response (sessid=50) request (sessid=50) response Menu Control Enough (In the servlet container) SessionTable s25 user1 s29 user2 s36 user3 s50 user4 new entry for the new user SessionData id attribute address s25 s29 s36 s50 "JourneyFlag" "Queue" "Patron" "JourneyFlag" Memory jny2 obj jny obj SA WA H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 69 / 1

53 When Cookie is disabled by the client... The container uses URL rewriting as a fall back method. public class Menu extends Http { public void dopost (HttpRequest req, HttpResponse res) throws Exception, IOException { res.setcontenttype("text/html"); PrintWriter out = res.getwriter(); HttpSession session = req.getsession(); out.println("<html><body>"); out.println("<a HREF=" + response.encodeurl("/controler") + ">Next Page</A>"); out.println("</body></html>"); encodeurl() adds the extra sessionid info to the given URL (e.g., /Controler;JSESSIONID=AJKN88809) you need to use encodeurl for all URLs. H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 73 / 1

54 Getting rid of Sessions Three ways a session can die: It times out You can call invalidate() on the session object The application goes down (e.g., crashed or undeployed) Configuring session timeout in DD (in minutes) <web-app...> <servlet>... </servlet> <session-config> <session-timeout>15</session-timeout> </session-config> </web-app> Setting session timeout for a specific session (in seconds) session.setmaxinactiveinterval(20*60); H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 74 / 1

55 s... Web Server Web Browser HTTP Request (URL + data) request Container classes <FORM> <INPUT> parameters... </INPUT> </FORM> HTTP Response: HTML (+javascript) response (content produced from servlet) DB Is Java-based technology for generating dynamic HTTP content. A servlet lifecycle is managed by Container Follows the request/response paradigm Implements methods (eg., doget()) to process HTTP requests Session tracking using HttpSession objects H. Paik (CSE, UNSW) COMP9321, 13s2 Week 2 75 / 1

Usability. Usability

Usability. Usability Objectives Review Usability Web Application Characteristics Review Servlets Deployment Sessions, Cookies Usability Trunk Test Harder than you probably thought Your answers didn t always agree Important

More information

SSC - Web applications and development Introduction and Java Servlet (II)

SSC - Web applications and development Introduction and Java Servlet (II) SSC - Web applications and development Introduction and Java Servlet (II) Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics Servlet Configuration

More information

Ch-03 Web Applications

Ch-03 Web Applications Ch-03 Web Applications 1. What is ServletContext? a. ServletContext is an interface that defines a set of methods that helps us to communicate with the servlet container. There is one context per "web

More information

Java Servlet Tutorial. Java Servlet Tutorial

Java Servlet Tutorial. Java Servlet Tutorial Java Servlet Tutorial i Java Servlet Tutorial Java Servlet Tutorial ii Contents 1 Introduction 1 1.1 Servlet Process.................................................... 1 1.2 Merits.........................................................

More information

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

Web Programming: Announcements. Sara Sprenkle August 3, 2006. August 3, 2006. Assignment 6 due today Project 2 due next Wednesday Review XML Web Programming: Java Servlets and JSPs Sara Sprenkle Announcements Assignment 6 due today Project 2 due next Wednesday Review XML Sara Sprenkle - CISC370 2 1 Web Programming Client Network Server Web

More information

Web Container Components Servlet JSP Tag Libraries

Web Container Components Servlet JSP Tag Libraries Web Application Development, Best Practices by Jeff Zhuk, JavaSchool.com ITS, Inc. dean@javaschool.com Web Container Components Servlet JSP Tag Libraries Servlet Standard Java class to handle an HTTP request

More information

2.8. Session management

2.8. Session management 2.8. Session management Juan M. Gimeno, Josep M. Ribó January, 2008 Session management. Contents Motivation Hidden fields URL rewriting Cookies Session management with the Servlet/JSP API Examples Scopes

More information

Managing Data on the World Wide-Web

Managing Data on the World Wide-Web Managing Data on the World Wide-Web Sessions, Listeners, Filters, Shopping Cart Elad Kravi 1 Web Applications In the Java EE platform, web components provide the dynamic extension capabilities for a web

More information

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

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java Java EE Introduction, Content Component Architecture: Why and How Java EE: Enterprise Java The Three-Tier Model The three -tier architecture allows to maintain state information, to improve performance,

More information

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

Pure server-side Web Applications with Java, JSP. Application Servers: the Essential Tool of Server-Side Programming. Install and Check Tomcat Pure server-side Web Applications with Java, JSP Discussion of networklevel http requests and responses Using the Java programming language (Java servlets and JSPs) Key lesson: The role of application

More information

Introduction to J2EE Web Technologies

Introduction to J2EE Web Technologies Introduction to J2EE Web Technologies Kyle Brown Senior Technical Staff Member IBM WebSphere Services RTP, NC brownkyl@us.ibm.com Overview What is J2EE? What are Servlets? What are JSP's? How do you use

More information

Session Tracking Customized Java EE Training: http://courses.coreservlets.com/

Session Tracking Customized Java EE Training: http://courses.coreservlets.com/ 2012 Marty Hall Session Tracking Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/csajsp2.html 2 Customized Java EE Training: http://courses.coreservlets.com/

More information

ACM Crossroads Student Magazine The ACM's First Electronic Publication

ACM Crossroads Student Magazine The ACM's First Electronic Publication Page 1 of 8 ACM Crossroads Student Magazine The ACM's First Electronic Publication Crossroads Home Join the ACM! Search Crossroads crossroads@acm.org ACM / Crossroads / Columns / Connector / An Introduction

More information

Servlets. Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun

Servlets. Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun Servlets Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun 1 What is a Servlet? A Servlet is a Java program that extends the capabilities of servers. Inherently multi-threaded.

More information

Java 2 Web Developer Certification Study Guide Natalie Levi

Java 2 Web Developer Certification Study Guide Natalie Levi SYBEX Sample Chapter Java 2 Web Developer Certification Study Guide Natalie Levi Chapter 8: Thread-Safe Servlets Copyright 2002 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. World rights

More information

11.1 Web Server Operation

11.1 Web Server Operation 11.1 Web Server Operation - Client-server systems - When two computers are connected, either could be the client - The client initiates the communication, which the server accepts - Generally, clients

More information

Web Application Programmer's Guide

Web Application Programmer's Guide Web Application Programmer's Guide JOnAS Team ( Florent BENOIT) - March 2009 - Copyright OW2 consortium 2008-2009 This work is licensed under the Creative Commons Attribution-ShareAlike License. To view

More information

If you wanted multiple screens, there was no way for data to be accumulated or stored

If you wanted multiple screens, there was no way for data to be accumulated or stored Handling State in Web Applications Jeff Offutt http://www.cs.gmu.edu/~offutt/ SWE 642 Software Engineering for the World Wide Web sources: Professional Java Server Programming, Patzer, Wrox Web Technologies:

More information

Outline. Lecture 9: Java Servlet and JSP. Servlet API. HTTP Servlet Basics

Outline. Lecture 9: Java Servlet and JSP. Servlet API. HTTP Servlet Basics Lecture 9: Java Servlet and JSP Wendy Liu CSC309F Fall 2007 Outline HTTP Servlet Basics Servlet Lifecycle Request and Response Session Management JavaServer Pages (JSP) 1 2 HTTP Servlet Basics Current

More information

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004. Java Servlets

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004. Java Servlets CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004 Java Servlets I have presented a Java servlet example before to give you a sense of what a servlet looks like. From the example,

More information

Controlling Web Application Behavior

Controlling Web Application Behavior 2006 Marty Hall Controlling Web Application Behavior The Deployment Descriptor: web.xml JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com

More information

Principles and Techniques of DBMS 5 Servlet

Principles and Techniques of DBMS 5 Servlet Principles and Techniques of DBMS 5 Servlet Haopeng Chen REliable, INtelligentand Scalable Systems Group (REINS) Shanghai Jiao Tong University Shanghai, China http://reins.se.sjtu.edu.cn/~chenhp e- mail:

More information

Creating Java EE Applications and Servlets with IntelliJ IDEA

Creating Java EE Applications and Servlets with IntelliJ IDEA Creating Java EE Applications and Servlets with IntelliJ IDEA In this tutorial you will: 1. Create IntelliJ IDEA project for Java EE application 2. Create Servlet 3. Deploy the application to JBoss server

More information

INTRODUCTION TO WEB TECHNOLOGY

INTRODUCTION TO WEB TECHNOLOGY UNIT-I Introduction to Web Technologies: Introduction to web servers like Apache1.1, IIS, XAMPP (Bundle Server), WAMP Server(Bundle Server), handling HTTP Request and Response, installation of above servers

More information

Please send your comments to: KZrobok@Setfocus.com

Please send your comments to: KZrobok@Setfocus.com Sun Certified Web Component Developer Study Guide - v2 Sun Certified Web Component Developer Study Guide...1 Authors Note...2 Servlets...3 The Servlet Model...3 The Structure and Deployment of Modern Servlet

More information

chapter 3Chapter 3 Advanced Servlet Techniques Servlets and Web Sessions Store Information in a Session In This Chapter

chapter 3Chapter 3 Advanced Servlet Techniques Servlets and Web Sessions Store Information in a Session In This Chapter chapter 3Chapter 3 Advanced Servlet Techniques In This Chapter Using sessions and storing state Using cookies for long-term storage Filtering HTTP requests Understanding WebLogic Server deployment issues

More information

Java and Web. WebWork

Java and Web. WebWork Java and Web WebWork Client/Server server client request HTTP response Inside the Server (1) HTTP requests Functionality for communicating with clients using HTTP CSS Stat. page Dyn. page Dyn. page Our

More information

Web Applications. For live Java training, please see training courses at

Web Applications. For live Java training, please see training courses at 2009 Marty Hall Using and Deploying Web Applications Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/msajsp.html Customized Java EE Training: http://courses.coreservlets.com/

More information

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

In this chapter the concept of Servlets, not the entire Servlet specification, is falkner.ch2.qxd 8/21/03 4:57 PM Page 31 Chapter 2 Java Servlets In this chapter the concept of Servlets, not the entire Servlet specification, is explained; consider this an introduction to the Servlet

More information

CIS 455/555: Internet and Web Systems

CIS 455/555: Internet and Web Systems CIS 455/555: Internet and Web Systems Fall 2015 Assignment 1: Web and Application Server Milestone 1 due September 21, 2015, at 10:00pm EST Milestone 2 due October 6, 2015, at 10:00pm EST 1. Background

More information

Class Focus: Web Applications that provide Dynamic Content

Class Focus: Web Applications that provide Dynamic Content Class Focus: Web Applications that provide Dynamic Content We will learn how to build server-side applications that interact with their users and provide dynamic content Using the Java programming language

More information

www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk

www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 Which of the following is a general purpose container? JFrame Dialog JPanel JApplet Which of the following package needs to be import while handling

More information

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

Supplement IV.E: Tutorial for Tomcat. For Introduction to Java Programming By Y. Daniel Liang Supplement IV.E: Tutorial for Tomcat For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Obtaining and Installing Tomcat Starting and Stopping Tomcat Choosing

More information

In this chapter, we lay the foundation for all our further discussions. We start

In this chapter, we lay the foundation for all our further discussions. We start 01 Struts.qxd 7/30/02 10:23 PM Page 1 CHAPTER 1 Introducing the Jakarta Struts Project and Its Supporting Components In this chapter, we lay the foundation for all our further discussions. We start by

More information

15-415 Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System

15-415 Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System 15-415 Database Applications Recitation 10 Project 3: CMUQFlix CMUQ s Movies Recommendation System Project Objective 1. Set up a front-end website with PostgreSQL back-end 2. Allow users to login, like

More information

Servlet 3.0. Alexis Moussine-Pouchkine. mercredi 13 avril 2011

Servlet 3.0. Alexis Moussine-Pouchkine. mercredi 13 avril 2011 Servlet 3.0 Alexis Moussine-Pouchkine 1 Overview Java Servlet 3.0 API JSR 315 20 members Good mix of representation from major Java EE vendors, web container developers and web framework authors 2 Overview

More information

BAPI. Business Application Programming Interface. Compiled by Y R Nagesh 1

BAPI. Business Application Programming Interface. Compiled by Y R Nagesh 1 BAPI Business Application Programming Interface Compiled by Y R Nagesh 1 What is BAPI A Business Application Programming Interface is a precisely defined interface providing access process and data in

More information

Crawl Proxy Installation and Configuration Guide

Crawl Proxy Installation and Configuration Guide Crawl Proxy Installation and Configuration Guide Google Enterprise EMEA Google Search Appliance is able to natively crawl secure content coming from multiple sources using for instance the following main

More information

Introduction to Web Technologies

Introduction to Web Technologies Secure Web Development Teaching Modules 1 Introduction to Web Technologies Contents 1 Concepts... 1 1.1 Web Architecture... 2 1.2 Uniform Resource Locators (URL)... 3 1.3 HTML Basics... 4 1.4 HTTP Protocol...

More information

The HTTP Plug-in. Table of contents

The HTTP Plug-in. Table of contents Table of contents 1 What's it for?... 2 2 Controlling the HTTPPlugin... 2 2.1 Levels of Control... 2 2.2 Importing the HTTPPluginControl...3 2.3 Setting HTTPClient Authorization Module... 3 2.4 Setting

More information

Course Name: Course in JSP Course Code: P5

Course Name: Course in JSP Course Code: P5 Course Name: Course in JSP Course Code: P5 Address: Sh No BSH 1,2,3 Almedia residency, Xetia Waddo Duler Mapusa Goa E-mail Id: ITKP@3i-infotech.com Tel: (0832) 2465556 (0832) 6454066 Course Code: P5 3i

More information

Table of Contents. Open-Xchange Authentication & Session Handling. 1.Introduction...3

Table of Contents. Open-Xchange Authentication & Session Handling. 1.Introduction...3 Open-Xchange Authentication & Session Handling Table of Contents 1.Introduction...3 2.System overview/implementation...4 2.1.Overview... 4 2.1.1.Access to IMAP back end services...4 2.1.2.Basic Implementation

More information

PowerTier Web Development Tools 4

PowerTier Web Development Tools 4 4 PowerTier Web Development Tools 4 This chapter describes the process of developing J2EE applications with Web components, and introduces the PowerTier tools you use at each stage of the development process.

More information

Tomcat 5 New Features

Tomcat 5 New Features Tomcat 5 New Features ApacheCon US 2003 Session MO10 11/17/2003 16:00-17:00 Craig R. McClanahan Senior Staff Engineer Sun Microsystems, Inc. Slides: http://www.apache.org/~craigmcc/ Agenda Introduction

More information

CHAPTER 5. Java Servlets

CHAPTER 5. Java Servlets ,ch05.3555 Page 135 Tuesday, April 9, 2002 7:05 AM Chapter 5 CHAPTER 5 Over the last few years, Java has become the predominant language for server-side programming. This is due in no small part to the

More information

Announcements. Comments on project proposals will go out by email in next couple of days...

Announcements. Comments on project proposals will go out by email in next couple of days... Announcements Comments on project proposals will go out by email in next couple of days... 3-Tier Using TP Monitor client application TP monitor interface (API, presentation, authentication) transaction

More information

Web Development on the SOEN 6011 Server

Web Development on the SOEN 6011 Server Web Development on the SOEN 6011 Server Stephen Barret October 30, 2007 Introduction Systems structured around Fowler s patterns of Enterprise Application Architecture (EAA) require a multi-tiered environment

More information

HTTP Protocol. Bartosz Walter <Bartek.Walter@man.poznan.pl>

HTTP Protocol. Bartosz Walter <Bartek.Walter@man.poznan.pl> HTTP Protocol Bartosz Walter Agenda Basics Methods Headers Response Codes Cookies Authentication Advanced Features of HTTP 1.1 Internationalization HTTP Basics defined in

More information

An introduction to web programming with Java

An introduction to web programming with Java Chapter 1 An introduction to web programming with Java Objectives Knowledge Objectives (continued) The first page of a shopping cart application The second page of a shopping cart application Components

More information

CONTROLLING WEB APPLICATION BEHAVIOR WITH

CONTROLLING WEB APPLICATION BEHAVIOR WITH CONTROLLING WEB APPLICATION BEHAVIOR WITH WEB.XML Chapter Topics in This Chapter Customizing URLs Turning off default URLs Initializing servlets and JSP pages Preloading servlets and JSP pages Declaring

More information

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

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post Understanding Architecture and Framework of J2EE using Web Application Devadrita Dey Sarkar,Anavi jaiswal, Ankur Saxena Amity University,UTTAR PRADESH Sector-125, Noida, UP-201303, India Abstract: This

More information

Java Server Pages combined with servlets in action. Generals. Java Servlets

Java Server Pages combined with servlets in action. Generals. Java Servlets Java Server Pages combined with servlets in action We want to create a small web application (library), that illustrates the usage of JavaServer Pages combined with Java Servlets. We use the JavaServer

More information

Glassfish, JAVA EE, Servlets, JSP, EJB

Glassfish, JAVA EE, Servlets, JSP, EJB Glassfish, JAVA EE, Servlets, JSP, EJB Java platform A Java platform comprises the JVM together with supporting class libraries. Java 2 Standard Edition (J2SE) (1999) provides core libraries for data structures,

More information

Outline. CS 112 Introduction to Programming. Recap: HTML/CSS/Javascript. Admin. Outline

Outline. CS 112 Introduction to Programming. Recap: HTML/CSS/Javascript. Admin. Outline Outline CS 112 Introduction to Programming Web Programming: Backend (server side) Programming with Servlet, JSP q Admin and recap q Server-side web programming overview q Servlet programming q Java servlet

More information

Building a Multi-Threaded Web Server

Building a Multi-Threaded Web Server Building a Multi-Threaded Web Server In this lab we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous

More information

Java Servlet and JSP Programming. Structure and Deployment China Jiliang University

Java Servlet and JSP Programming. Structure and Deployment China Jiliang University Java Web Programming in Java Java Servlet and JSP Programming Structure and Deployment China Jiliang University Servlet/JSP Exercise - Rules On the following pages you will find the rules and conventions

More information

HttpUnit Laboratorio di Sistemi Software - A.A. 2003/2004

HttpUnit Laboratorio di Sistemi Software - A.A. 2003/2004 HttpUnit Laboratorio di Sistemi Software - A.A. 2003/2004 Introduction HttpUnit, available from http://www.httpunit.org, is an open source Java library for programmatically interacting with HTTP servers.

More information

Manual. Programmer's Guide for Java API

Manual. Programmer's Guide for Java API 2013-02-01 1 (15) Programmer's Guide for Java API Description This document describes how to develop Content Gateway services with Java API. TS1209243890 1.0 Company information TeliaSonera Finland Oyj

More information

Lecture 11 Web Application Security (part 1)

Lecture 11 Web Application Security (part 1) Lecture 11 Web Application Security (part 1) Computer and Network Security 4th of January 2016 Computer Science and Engineering Department CSE Dep, ACS, UPB Lecture 11, Web Application Security (part 1)

More information

DTS Web Developers Guide

DTS Web Developers Guide Apelon, Inc. Suite 202, 100 Danbury Road Ridgefield, CT 06877 Phone: (203) 431-2530 Fax: (203) 431-2523 www.apelon.com Apelon Distributed Terminology System (DTS) DTS Web Developers Guide Table of Contents

More information

Complete Java Web Development

Complete Java Web Development Complete Java Web Development JAVA-WD Rev 11.14 4 days Description Complete Java Web Development is a crash course in developing cutting edge Web applications using the latest Java EE 6 technologies from

More information

Web development... the server side (of the force)

Web development... the server side (of the force) Web development... the server side (of the force) Fabien POULARD Document under license Creative Commons Attribution Share Alike 2.5 http://www.creativecommons.org/learnmore Web development... the server

More information

Oracle WebLogic Server

Oracle WebLogic Server Oracle WebLogic Server Developing Web Applications, Servlets, and JSPs for Oracle WebLogic Server 10g Release 3 (10.3) July 2008 Oracle WebLogic Server Developing Web Applications, Servlets, and JSPs for

More information

Web Applications and Struts 2

Web Applications and Struts 2 Web Applications and Struts 2 Problem area Problem area Separation of application logic and markup Easier to change and maintain Easier to re use Less error prone Access to functionality to solve routine

More information

CHAPTER 9: SERVLET AND JSP FILTERS

CHAPTER 9: SERVLET AND JSP FILTERS Taken from More Servlets and JavaServer Pages by Marty Hall. Published by Prentice Hall PTR. For personal use only; do not redistribute. For a complete online version of the book, please see http://pdf.moreservlets.com/.

More information

Virtual Open-Source Labs for Web Security Education

Virtual Open-Source Labs for Web Security Education , October 20-22, 2010, San Francisco, USA Virtual Open-Source Labs for Web Security Education Lixin Tao, Li-Chiou Chen, and Chienting Lin Abstract Web security education depends heavily on hands-on labs

More information

Java 2 Web Developer Certification Study Guide Natalie Levi

Java 2 Web Developer Certification Study Guide Natalie Levi SYBEX Index Java 2 Web Developer Certification Study Guide Natalie Levi Index Copyright 2002 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. World rights reserved. No part of this publication

More information

Programming on the Web(CSC309F) Tutorial: Servlets && Tomcat TA:Wael Aboelsaadat

Programming on the Web(CSC309F) Tutorial: Servlets && Tomcat TA:Wael Aboelsaadat Programming on the Web(CSC309F) Tutorial: Servlets && Tomcat TA:Wael Aboelsaadat Acknowledgments : This tutorial is based on a series of articles written by James Goodwill about Tomcat && Servlets. 1 Tomcat

More information

PA165 - Lab session - Web Presentation Layer

PA165 - Lab session - Web Presentation Layer PA165 - Lab session - Web Presentation Layer Author: Martin Kuba Goal Experiment with basic building blocks of Java server side web technology servlets, filters, context listeners,

More information

HTTP. Internet Engineering. Fall 2015. Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

HTTP. Internet Engineering. Fall 2015. Bahador Bakhshi CE & IT Department, Amirkabir University of Technology HTTP Internet Engineering Fall 2015 Bahador Bakhshi CE & IT Department, Amirkabir University of Technology Questions Q1) How do web server and client browser talk to each other? Q1.1) What is the common

More information

Development of Web Applications

Development of Web Applications Development of Web Applications Principles and Practice Vincent Simonet, 2013-2014 Université Pierre et Marie Curie, Master Informatique, Spécialité STL 3 Server Technologies Vincent Simonet, 2013-2014

More information

Web Application Architecture (based J2EE 1.4 Tutorial)

Web Application Architecture (based J2EE 1.4 Tutorial) Web Application Architecture (based J2EE 1.4 Tutorial) 1 Disclaimer & Acknowledgments Even though Sang Shin is a full-time employee of Sun Microsystems, the contents here are created as his own personal

More information

Servlet and JSP Filters

Servlet and JSP Filters 2009 Marty Hall Servlet and JSP Filters Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/msajsp.html Customized Java EE Training: http://courses.coreservlets.com/

More information

Java Servlet 3.0. Rajiv Mordani Spec Lead

Java Servlet 3.0. Rajiv Mordani Spec Lead Java Servlet 3.0 Rajiv Mordani Spec Lead 1 Overview JCP Java Servlet 3.0 API JSR 315 20 members > Good mix of representation from major Java EE vendors, web container developers and web framework authors

More information

Implementing the Shop with EJB

Implementing the Shop with EJB Exercise 2 Implementing the Shop with EJB 2.1 Overview This exercise is a hands-on exercise in Enterprise JavaBeans (EJB). The exercise is as similar as possible to the other exercises (in other technologies).

More information

A detailed walk through a CAS authentication

A detailed walk through a CAS authentication Welcome! First of all, what is CAS? Web single sign on Uses federated authentication, where all authentication is done by the CAS server, instead of individual application servers The implementation is

More information

Network Technologies

Network Technologies Network Technologies Glenn Strong Department of Computer Science School of Computer Science and Statistics Trinity College, Dublin January 28, 2014 What Happens When Browser Contacts Server I Top view:

More information

How to program Java Card3.0 platforms?

How to program Java Card3.0 platforms? How to program Java Card3.0 platforms? Samia Bouzefrane CEDRIC Laboratory Conservatoire National des Arts et Métiers samia.bouzefrane@cnam.fr http://cedric.cnam.fr/~bouzefra Smart University Nice, Sophia

More information

Getting Started with Web Applications

Getting Started with Web Applications 3 Getting Started with Web Applications A web application is a dynamic extension of a web or application server. There are two types of web applications: Presentation-oriented: A presentation-oriented

More information

CS108, Stanford Handout #33 Young. HW5 Web

CS108, Stanford Handout #33 Young. HW5 Web CS108, Stanford Handout #33 Young HW5 Web In this assignment we ll build two separate web projects. This assignment is due the evening of Tuesday November 3 rd at Midnight. You cannot take late days on

More information

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

SERVLETSTUTORIAL. Simply Easy Learning by tutorialspoint.com. tutorialspoint.com Servlets Tutorial SERVLETSTUTORIAL by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Servlets Tutorial Servlets provide a component-based, platform-independent method for building Web-based

More information

Model-View-Controller. and. Struts 2

Model-View-Controller. and. Struts 2 Model-View-Controller and Struts 2 Problem area Mixing application logic and markup is bad practise Harder to change and maintain Error prone Harder to re-use public void doget( HttpServletRequest request,

More information

The Web: some jargon. User agent for Web is called a browser: Web page: Most Web pages consist of: Server for Web is called Web server:

The Web: some jargon. User agent for Web is called a browser: Web page: Most Web pages consist of: Server for Web is called Web server: The Web: some jargon Web page: consists of objects addressed by a URL Most Web pages consist of: base HTML page, and several referenced objects. URL has two components: host name and path name: User agent

More information

Piotr Nowicki's Homepage. Java EE 6 SCWCD Mock Exam. "Simplicity is the ultimate sophistication." Important!

Piotr Nowicki's Homepage. Java EE 6 SCWCD Mock Exam. Simplicity is the ultimate sophistication. Important! Piotr Nowicki's Homepage "Simplicity is the ultimate sophistication." Java EE 6 SCWCD Mock Exam Posted on March 27, 2011 by Piotr 47 Replies Edit This test might help to test your knowledge before taking

More information

Security Code Review- Identifying Web Vulnerabilities

Security Code Review- Identifying Web Vulnerabilities Security Code Review- Identifying Web Vulnerabilities Kiran Maraju, CISSP, CEH, ITIL, SCJP Email: Kiran_maraju@yahoo.com 1 1.1.1 Abstract Security Code Review- Identifying Web Vulnerabilities This paper

More information

CS640: Introduction to Computer Networks. Applications FTP: The File Transfer Protocol

CS640: Introduction to Computer Networks. Applications FTP: The File Transfer Protocol CS640: Introduction to Computer Networks Aditya Akella Lecture 4 - Application Protocols, Performance Applications FTP: The File Transfer Protocol user at host FTP FTP user client interface local file

More information

Development. with NetBeans 5.0. A Quick Start in Basic Web and Struts Applications. Geertjan Wielenga

Development. with NetBeans 5.0. A Quick Start in Basic Web and Struts Applications. Geertjan Wielenga Web Development with NetBeans 5.0 Quick Start in Basic Web and Struts pplications Geertjan Wielenga Web Development with NetBeans 5 This tutorial takes you through the basics of using NetBeans IDE 5.0

More information

Java Web Programming. Student Workbook

Java Web Programming. Student Workbook Student Workbook Java Web Programming Mike Naseef, Jamie Romero, and Rick Sussenbach Published by ITCourseware, LLC., 7245 South Havana Street, Suite 100, Centennial, CO 80112 Editors: Danielle Hopkins

More information

JBoss Portlet Container. User Guide. Release 2.0

JBoss Portlet Container. User Guide. Release 2.0 JBoss Portlet Container User Guide Release 2.0 1. Introduction.. 1 1.1. Motivation.. 1 1.2. Audience 1 1.3. Simple Portal: showcasing JBoss Portlet Container.. 1 1.4. Resources. 1 2. Installation. 3 2.1.

More information

Developing Web Applications using JavaServer Pages and Servlets

Developing Web Applications using JavaServer Pages and Servlets Redpaper Martin Keen Rafael Coutinho Sylvi Lippmann Salvatore Sollami Sundaragopal Venkatraman Steve Baber Henry Cui Craig Fleming Developing Web Applications using JavaServer Pages and Servlets This IBM

More information

JSP. Common patterns

JSP. Common patterns JSP Common patterns Common JSP patterns Page-centric (client-server) CLIENT JSP or Servlet CLIENT Enterprise JavaBeans SERVER DB Common JSP patterns Page-centric 1 (client-server) Page View request response

More information

Penetration from application down to OS

Penetration from application down to OS April 8, 2009 Penetration from application down to OS Getting OS access using IBM Websphere Application Server vulnerabilities Digitаl Security Research Group (DSecRG) Stanislav Svistunovich research@dsecrg.com

More information

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

2. Follow the installation directions and install the server on ccc Installing a Web Server 1. Install a sample web server, which supports Servlets/JSPs. A light weight web server is Apache Tomcat server. You can get the server from http://tomcat.apache.org/ 2. Follow

More information

Protocolo HTTP. Web and HTTP. HTTP overview. HTTP overview

Protocolo HTTP. Web and HTTP. HTTP overview. HTTP overview Web and HTTP Protocolo HTTP Web page consists of objects Object can be HTML file, JPEG image, Java applet, audio file, Web page consists of base HTML-file which includes several referenced objects Each

More information

Arjun V. Bala Page 20

Arjun V. Bala Page 20 12) Explain Servlet life cycle & importance of context object. (May-13,Jan-13,Jun-12,Nov-11) Servlet Life Cycle: Servlets follow a three-phase life cycle, namely initialization, service, and destruction.

More information

Web Frameworks and WebWork

Web Frameworks and WebWork Web Frameworks and WebWork Problem area Mixing application logic and markup is bad practise Harder to change and maintain Error prone Harder to re-use public void doget( HttpServletRequest request, HttpServletResponse

More information

COMP 112 Assignment 1: HTTP Servers

COMP 112 Assignment 1: HTTP Servers COMP 112 Assignment 1: HTTP Servers Lead TA: Jim Mao Based on an assignment from Alva Couch Tufts University Due 11:59 PM September 24, 2015 Introduction In this assignment, you will write a web server

More information

Web. Services. Web Technologies. Today. Web. Technologies. Internet WWW. Protocols TCP/IP HTTP. Apache. Next Time. Lecture #3 2008 3 Apache.

Web. Services. Web Technologies. Today. Web. Technologies. Internet WWW. Protocols TCP/IP HTTP. Apache. Next Time. Lecture #3 2008 3 Apache. JSP, and JSP, and JSP, and 1 2 Lecture #3 2008 3 JSP, and JSP, and Markup & presentation (HTML, XHTML, CSS etc) Data storage & access (JDBC, XML etc) Network & application protocols (, etc) Programming

More information

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

THE PROXY SERVER 1 1 PURPOSE 3 2 USAGE EXAMPLES 4 3 STARTING THE PROXY SERVER 5 4 READING THE LOG 6 The Proxy Server THE PROXY SERVER 1 1 PURPOSE 3 2 USAGE EXAMPLES 4 3 STARTING THE PROXY SERVER 5 4 READING THE LOG 6 2 1 Purpose The proxy server acts as an intermediate server that relays requests between

More information

Instant Chime for IBM Sametime Installation Guide for Apache Tomcat and Microsoft SQL

Instant Chime for IBM Sametime Installation Guide for Apache Tomcat and Microsoft SQL Instant Chime for IBM Sametime Installation Guide for Apache Tomcat and Microsoft SQL Spring 2015 Copyright and Disclaimer This document, as well as the software described in it, is furnished under license

More information