Submitted by heartin on Sat, 03/21/2015 - 10:24
Deployment Descriptor is an XML document saved in a file called web.xml and placed in the folder WEB-INF in a web application archive. The DD is used to tell the component about the deployed components and is designed to decouple the resources and components in the application from their installation and configuration. Deployment Descriptor is mainly used to declare servlets, their initialization parameters, specify mappings between URLs and their target components, provide declarative security, specifying MIME types and configuring JSP pages and documents, etc.
Submitted by heartin on Sat, 03/21/2015 - 09:21
We can configure a set of default file names to be loaded when request is made to a directory path using the DDs <welcome-file-list> element. Each file can be put inside a <welcome-file> element. The file can be a servlet mapping path, a jsp or even a static html file.
Submitted by heartin on Fri, 03/20/2015 - 13:33
ServletResponse Interface
ServletResponse encapsulates basic properties of a response independent of protocol and provide output streams to write content to client, independent of protocol.
There are two response streams
-
Java.io.OutputStream for binary data
-
Java.io.writer for character data
Note:
Submitted by heartin on Fri, 03/20/2015 - 13:23
ServletRequest Interface
Below methods work with the metadata properties carried by requests:
-
String getCharacterEncoding()
-
Int getContentLength()
-
String getContentType()
-
Enumeration getLocales()
-
Locale getLocale()
-
String getProtocol () E.g. HTTP/1.1
-
String getScheme() E.g.: http, https, ftp etc.
Submitted by heartin on Fri, 03/20/2015 - 13:14
There are four main entities involved in the HTTP request-response model:
- Client
- Web container
- Request
- Response
We will learn about request and response here.
Container provides us with two objects corresponding to request and response, encapsulating the request details and an empty response object when a request is received. These object interfaces also contain many convenience methods. These are passed through the service method of the servlet, which will then pass to us through the doXXX methods.
Pages