The document provides an overview of servlet scopes including request, session, application, and page scope. Request scope lasts for the duration of a single request, session scope spans multiple requests from the same client, application scope lasts for the entire duration the web application is running, and page scope is only applicable to JSP and lasts on a single page. The document also discusses the differences between servlet parameters and attributes, with parameters being read-only strings and attributes being read-write objects that can be added to different scopes.
Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
In this session, you will learn:
1. Deployment Descriptor
2. Configuring and Mapping a Servlet
3. The flow of the demo web apps
4. JDBC Best practices
5. Design Patterns
In this session, you will learn:
1. Hibernate
2. Advantages of Hibernate
3. Hibernate Architecture – High Level
4. Hibernate – Detailed Architecture
5. Hibernate Architecture – Important Levels
6. Hibernate jar files
7. Hibernate tools download
8. CRUD Operations
9. Hibernate with Annotations
10. Design Patterns in Java
Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
In this session, you will learn:
1. Deployment Descriptor
2. Configuring and Mapping a Servlet
3. The flow of the demo web apps
4. JDBC Best practices
5. Design Patterns
In this session, you will learn:
1. Hibernate
2. Advantages of Hibernate
3. Hibernate Architecture – High Level
4. Hibernate – Detailed Architecture
5. Hibernate Architecture – Important Levels
6. Hibernate jar files
7. Hibernate tools download
8. CRUD Operations
9. Hibernate with Annotations
10. Design Patterns in Java
In this session, you will learn:
1. Generator Class in Hibernate
2. SQL Dialects
3. Collection Mapping
4. One-to-one Mapping
5. Cascade Types
6. Many to one / One to many
7. Hibernate Lazy Loading
8. Transaction Management
9. HQL – Hibernate Query Language
10. HCQL – Hibernate Criteria Query Language
11. Hibernate Caching
Building RESTfull Data Services with WebAPIGert Drapers
Data services are a major building block inside a service oriented architecture. Not only do they provide the abstraction and isolation between physical storage systems and the business layer, they can also provide the means for: authentication, authorization, transformation, projection, scale (through for example sharding) and caching. This session will walk you through implementing your RESTfull data service so that you can easily enable and integrate the described capabilities
In this session, you will learn:
1. Generator Class in Hibernate
2. SQL Dialects
3. Collection Mapping
4. One-to-one Mapping
5. Cascade Types
6. Many to one / One to many
7. Hibernate Lazy Loading
8. Transaction Management
9. HQL – Hibernate Query Language
10. HCQL – Hibernate Criteria Query Language
11. Hibernate Caching
Building RESTfull Data Services with WebAPIGert Drapers
Data services are a major building block inside a service oriented architecture. Not only do they provide the abstraction and isolation between physical storage systems and the business layer, they can also provide the means for: authentication, authorization, transformation, projection, scale (through for example sharding) and caching. This session will walk you through implementing your RESTfull data service so that you can easily enable and integrate the described capabilities
J2EE : Java servlet and its types, environmentjoearunraja2
The server-side extensions are nothing but the technologies that are used to create dynamic Web pages. Actually, to provide the facility of dynamic Web pages, Web pages need a container or Web server. To meet this requirement, independent Web server providers offer some proprietary solutions in the form of APIs (Application Programming Interface).
These APIs allow us to build programs that can run with a Web server. In this case, Java Servlet is also one of the component APIs of Java Platform Enterprise Edition (nowadays known as – ‘Jakarta EE’) which sets standards for creating dynamic Web applications in Java.
Today we all are aware of the need to create dynamic web pages i.e. the ones that can change the site contents according to the time or can generate the content according to the request received by the client. If you like coding in Java, then you will be happy to know that using Java there also exists a way to generate dynamic web pages and that way is Java Servlet. But before we move forward with our topic let’s first understand the need for server-side extensions.
Servlets are the Java programs that run on the Java-enabled web server or application server. They are used to handle the request obtained from the web server, process the request, produce the response, and then send a response back to the web server. Servlet is faster than CGI as it doesn’t involve the creation of a new process for every new request received.
Servlets, as written in Java, are platform independent.
Removes the overhead of creating a new process for each request as Servlet doesn’t run in a separate process. There is only a single instance that handles all requests concurrently. This also saves the memory and allows a Servlet to easily manage the client state.
It is a server-side component, so Servlet inherits the security provided by the Web server.
The API designed for Java Servlet automatically acquires the advantages of the Java platforms such as platform-independent and portability. In addition, it obviously can use the wide range of APIs created on Java platforms such as JDBC to access the database.
Many Web servers that are suitable for personal use or low-traffic websites are offered for free or at extremely cheap costs eg. Java servlet. However, the majority of commercial-grade Web servers are rather expensive, with the notable exception of Apache, which is free.
The Servlet Container
Servlet container, also known as Servlet engine, is an integrated set of objects that provide a run time environment for Java Servlet components. In simple words, it is a system that manages Java Servlet components on top of the Web server to handle the Web client requests.
Services provided by the Servlet container:
Network Services: Loads a Servlet class. The loading may be from a local file system, a remote file system or other network services. The Servlet container provides the network services over which the request and response are sent.
3.1 Identify the uses for and the interfaces (or classes) and methods to achieve the following features:
Servlet context init. Parameters
Servlet context listener
Servlet context attribute listener
Session attribute listeners
3.2 Identify the WebApp deployment descriptor element name that declares the following features:
Servlet context init. Parameters
Servlet context listener
Servlet context attribute listener
Session attribute listeners
JavaScript, often abbreviated as JS, is a programming language and core techn...MathivananP4
JavaScript, often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. As of 2024, 98.9% of websites use JavaScript on the client side for webpage behavior, often incorporating third-party libraries.
Server side programs can be written using different server-side technologies , such as Common Gateway Interface (CGI) , Active Server Pages (ASP) and Servlets.
CGI scripts are written in C , C++ or perl programming languages .
In case of an application server using CGI script to process client request , the server creates a separate instance of the CGI script to process the request.
As a result, the efficiency of the server is affected when there is large number of concurrent requests.
Http Server Programming in JAVA - Handling http requests and responsesbharathiv53
This ppt contains HTML forms and CGI; HTTP; Servlet Programming; The Life Cycle of a
Servlet; Using Tomcat for Servlet Development; A simple Servlet;
deployment of simple servlets, web server (Java web server / Tomcat/ Web
logic) The Servlet API; The Javax.servlet Package; Reading Servlet
Parameter; The Javax.servlet.http package; Handling HTTP Requests and
Responses, HTTP GET and POST methods, Using Cookies; Session
Tracking
In this session you will learn:
1. Spring framework
2. Inversion of Control
3. Dependency Injection – Two types
4. Defining beans using XML
5. Inheriting beans
6. Auto-wiring
7. Annotations based on a configuration
8. Java-based configuration
9. Spring AOP
Session 43 - Spring - Part 1 - IoC DI BeansPawanMM
In this session you will learn:
1.Spring Framework
2. Core Container
3. Data Access/Integration
4. Web Layer
5. Spring Setup
6. Key features
7. Spring Bean
8. Dependency Injection
9. Relation between DI and IoC
10. Spring IoC Containers
11. Spring DI
In this session you will learn:
1. Introduction to Struts Framework
2. Features
3. Evolution
4. Struts Demo
5. Declarative validation
6. Architecture
7. Validators
8. Interceptors
In this session you will learn:
1. Recap of Arrays, ArrayLists
2. Basically, there can be 2 operations that you would want to perform on Arrays/ArrayLists.. (and maybe, other collections)
3. Search: Override equals() and hashCode().
4. Sort: provide comparison logic – Two ways
4.1 Comparable interface
4.2 Comparator interface
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
4. Page 3Classification: Restricted
Web Server and Application Server
Presentation Tier:
JSP, Servlets
Run on Web Server
or container
JDBC on web server
or app server
Database
Client:
HTML JS CSS
(Run on client
machine on the
browser)
5. Page 4Classification: Restricted
Demo of complete Web app flow…
• Form which takes two fields… Student ID and Student Name…
• Output should show whether that row exists or not, and if it exists, how
many records in the table match the criteria (id, name)
• If match found, then print login successful, else login failed.
14. Page 13Classification: Restricted
Parameters vs Attributes
• Parameters may come into our application from the client request, or may be
configured through deployment descriptor (web.xml) elements or their
corresponding annotations. When you submit a form, form values are sent as
request parameters to a web application. In case of a GET request, these
parameters are exposed in the URL as name value pairs and in case of
POST, parameters are sent within the body of the request.
• Servlet init parameters and context init parameters are set through the deployment
descriptor (web.xml) or their corresponding annotations. All parameters are read-
only from the application code. We have methods in the Servlet API to retrieve
various parameters.
• Attributes are objects that are attached to various scopes and can be
modified, retrieved or removed. Attributes can be read, created, updated and
deleted by the web container as well as our application code. We have methods in
the Servlet API to add, modify, retrieve and remove attributes. When an object is
added to an attribute in any scope, it is called binding as the object is bound into a
scoped attribute with a given name.
15. Page 14Classification: Restricted
Parameters vs Attributes
• Parameters are read only Strings, attributes are read/write objects.
• Parameters are String objects, attributes can be objects of any type.
19. Page 18Classification: Restricted
ServletConfig vs ServletContext
• ServletConfig // Available for a specific servlet
• ServletConfig available in javax.servlet.*; package
• ServletConfig object is one per servlet class
• Object of ServletConfig will be created during initialization process of the servlet
• This Config object is public to a particular servlet only
• Scope: As long as a servlet is executing, ServletConfig object will be available, it will be
destroyed once the servlet execution is completed.
• We should give request explicitly, in order to create ServletConfig object for the first time
• In web.xml – <init-param> tag will be appear under <servlet-class> tag
• ServletContext // Available for whole application
• ServletContext available in javax.servlet.*; package
• ServletContext object is global to entire web application
• Object of ServletContext will be created at the time of web application deployment
• Scope: As long as web application is executing, ServletContext object will be available, and
it will be destroyed once the application is removed from the server.
• ServletContext object will be available even before giving the first request
• In web.xml – <context-param> tag will be appear under <web-app> tag
20. Page 19Classification: Restricted
How to get servletContext?
getServletConfig( ).getServletContext( );
request.getSession( ).getServletContext( );
getServletContext( );
request.getServletContext();
21. Page 20Classification: Restricted
Understanding scope of attributes
• Similar to scope and lifetime of variables in Java as you have seen in blocks
and methods in java, parameters and attributes in a Java EE web
application also have scope and lifetime in the context of the web
application.
• The scope of a parameter/attribute denotes the availability of that
parameter/attribute for use. A web application serves multiple requests
from clients when it is up and running. These requests can be from same
client or different clients. We have seen from the servlet life cycle that a
servlet’s service() method is called every time a request comes.
22. Page 21Classification: Restricted
Scoping in Servlets and JSP
• Request scope
• Session scope
• Application or context scope
• Page scope (only for JSP)
• CASE 1:
• HTTP Request is sent to Servlet1, Servlet1 forwards the same request to Servlet2 (request-
dispatcher). Request scope is enough.
• CASE 2:
• HTTP Request is sent to Servlet1 for login, Servlet1 responds to client with login successful.
Client sends another request for querying the database. This is a new request, but belongs to
the same session. Session scope
• CASE 3:
• You want to set an attribute which should be available across multiple sessions and/or
multiple users Context scope.
23. Page 22Classification: Restricted
Request Scope
• Request scope start from the moment an HTTP request hits a servlet in our web
container and end when the servlet is done with delivering the HTTP response.
• With respect to the servlet life cycle, the request scope begins on entry to a
servlet’s service() method and ends on the exit from that method.
• A ‘request’ scope parameter/attribute can be accessed from any of servlets or jsps
that are part of serving one request. For example, you call one servlet/jsp, it then
calls another servlet/jsp and so on, and finally the response is sent back to the
client.
• Request scope is denoted by javax.servlet.http.HttpServletRequest interface.
• Container passes the request object as an argument of type HttpServletRequest to
Servlet's service method.
• Request object is available in a JSP page as an implicit object called request. You
can set value for an attribute in request object from a servlet and get it from a JSP
within the same request using the implicit request object.
24. Page 23Classification: Restricted
Session scope
• A session scope starts when a client (e.g. browser window) establishes
connection with our web application till the point where the browser
window is closed.
• Session scope spans across multiple requests from the same client.
• A notable feature of tabbed browsing is that session is shared between the
tabs and hence you can requests from other tabs too during a session
without logging in again. For instance, you can load your Gmail inbox in
another tab without logging in again. This also means browsing an unknown
site and a secure site from different tabs from the same browser can
expose your secure session ID to malicious applications. So always open a
new browser window when you want to do secure transactions, especially
financial transactions.
• Session scope is denoted by javax.servlet.http.HttpSession interface.
• Session object is available in a JSP page as an implicit object called session.
• In a servlet, you can get Session object by calling request.getSession().
25. Page 24Classification: Restricted
Application or context scope
• Context scope or application scope starts from the point where a web
application is put into service (started) till it is removed from service
(shutdown) or the web application is reloaded.
Parameters/attributes within the application scope will be available to all
requests and sessions.
• Application scope is denoted by javax.servlet.ServletContext interface.
• Application object is available in a JSP page as an implicit
object called application.
• In a servlet, you can get application object by
calling getServletContext() from within the servlets code directly (the
servlet itself implements the ServletConfig interface that contains this
method) or by explicitly calling getServletConfig().getServletContext().
• The web container provides one ServletContext object per web application
per JVM.
26. Page 25Classification: Restricted
Page scope (Only for JSP, not for Servlets)
• The page scope restricts the scpoe and lifetime of attributes to the same
page where it was created.
• Page scope is denoted by javax.servlet.jsp.PageContext abstract class.
• It is available in a JSP page as an implicit object called pageScope
27. Page 26Classification: Restricted
Servlets – Scope at a glance
• Application scope
request.getServletContext();
request.getServletContext().setAttribute("attribute_name","value")
• Session scope
request.getSession(); //going to create the session if session is not exist.
request.getSession(false); // Not going to create the session.
session.getAttribute("attribute_name");
• Request scope
request.setAttribute("attribute_name","value");
request.getAttribute("attribute_name"); // return the Object you have to
cast it