Servlets Flashcards
What is TCP/IP?
- Stands for Transmission Control Protocol/Internet Protocol.
- It is a communication protocol used to interconnect network devices on the internet.
- It is a suite that encompasses a number of different protocols for different purpose and needs
What are the different content types?
- Content types is also known MIME (Multipurpose Internet Mail Extension) Type
- Commonly used content types:
- text/html
- text/plain
- application/jar
- application/pdf
- images/jpeg
- images/png
- images/gif
- audio/mp3
- video/mp4
What is a servlet?
Servlet is a technology used to create web applications; it is used to respond to incoming requests.
What is the Lifecycle of a Servlet?
- Servlet class is loaded
- Loaded when the first request for the servlet is
received by the web container - Load on startup
- Loaded when the first request for the servlet is
- Servlet instance is created
- Created after the servlet class is loaded.
- Created only once in the servlet life cycle.
- Init method is invoked
- Web container calls the init method once after
creating the servlet instance. - Used to initialize the servlet.
- Web container calls the init method once after
- Service method is invoked
- Called every time a request is received for the
servlet
- Called every time a request is received for the
- Destroy method is invoked
- Called before removing the servlet instance from
the service. - Used to clean up any resources
- Called before removing the servlet instance from
App Server vs Web Server
- A Web server exclusively handles HTTP requests, whereas an application server serves business logic to application programs through any number of protocols.
- Web server is responsible for serving static content over HTTP while Application server is responsible for serving dynamic content, managing EJB, lookup over JNDI, and application security.
What is XML?
Stands for extensible markup language
It defines set of rules for encoding documents in a format that is both human-readable and machine readable
What is Well-Formed XML?
- Refers to an XML document that satisfies certain rules specified by the W3C - documents with correct syntax - A Well-Formed XML requires that: - Content be defined - Content be delimited with beginning and end tag - Content be properly nested - There can be only one root tag
Element vs Attribute
Elements can be viewed as containers that stores text, elements, etc…
Attributes defines the property of an element
What is DTD?
- DTD stands for Document Type Definition.
- This defines the elements that may be included in the document, what attributes the elements have, and the ordering and nesting of the elements.
- Documents validated against DTD is considered to be “Well-Formed” and “Valid”
What is an XML Schema?
- Describe the structure of an XML document
- Provides a more powerful alternative to DTD
What is XSL?
- Stands for Extensible Stylesheet Language
- Describes how XML elements should be displayed
- Consist of three parts:
- XSLT - language for transforming XML documents
- XPath - language for navigating in XML documents
- XSL-FO - Used for formatting XML documents
What is XSLT?
- Stands for Extensible Stylesheet Language Transformations
- Used for transforming XML documents into other XML documents
- Ex: HTML to XHTML
What is XPath?
- Stands for XML Path Language
- Used to navigate through elements and attributes in an
XML document - Core component of XSLT
- Defines part of the XML document
- Provides powerful “path expressions”
- Used to select node or list of nodes from an XML
document - Provides library of standard functions for manipulating
string, numbers, etc.
What is JAXB?
- Stands for Java Architecture for XML Binding
- It is used to convert Java Object to XML and XML to Java Objects
What are the different types of XML parsing?
- DOM parser
- SAX parser
- JDOM parser
- StAX parser
- XPath parser
- DOM4J parser
What is Marshalling?
The process of transforming the memory representation of an object to a data format suitable for storage or transmission.