🗊Презентация Java 4 WEB

Нажмите для полного просмотра!
Java 4 WEB, слайд №1Java 4 WEB, слайд №2Java 4 WEB, слайд №3Java 4 WEB, слайд №4Java 4 WEB, слайд №5Java 4 WEB, слайд №6Java 4 WEB, слайд №7Java 4 WEB, слайд №8Java 4 WEB, слайд №9Java 4 WEB, слайд №10Java 4 WEB, слайд №11Java 4 WEB, слайд №12Java 4 WEB, слайд №13Java 4 WEB, слайд №14Java 4 WEB, слайд №15Java 4 WEB, слайд №16Java 4 WEB, слайд №17Java 4 WEB, слайд №18Java 4 WEB, слайд №19Java 4 WEB, слайд №20Java 4 WEB, слайд №21Java 4 WEB, слайд №22Java 4 WEB, слайд №23Java 4 WEB, слайд №24Java 4 WEB, слайд №25Java 4 WEB, слайд №26Java 4 WEB, слайд №27

Вы можете ознакомиться и скачать презентацию на тему Java 4 WEB. Доклад-сообщение содержит 27 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1





Java 4 WEB 
Lesson 12 – Servlet API
Описание слайда:
Java 4 WEB Lesson 12 – Servlet API

Слайд 2





Lesson goals
Client-Server
Static vs dynamic content
Java Servlet
Tomcat
Описание слайда:
Lesson goals Client-Server Static vs dynamic content Java Servlet Tomcat

Слайд 3





Client-Server architecture
A person enters a URL string into the browser.
The browser generates HTTP-request.
The server receives a request, processes, and sends an HTTP response.
The browser receives a response and displays it.
Описание слайда:
Client-Server architecture A person enters a URL string into the browser. The browser generates HTTP-request. The server receives a request, processes, and sends an HTTP response. The browser receives a response and displays it.

Слайд 4





Client-Server architecture
• Web-server for static content (popular): Apache, nginx, GWS, IIS, ...
• Software for dynamic content: CGI programs & modules, PHP AS, 
MS IIS AS, Java EE, ...
Описание слайда:
Client-Server architecture • Web-server for static content (popular): Apache, nginx, GWS, IIS, ... • Software for dynamic content: CGI programs & modules, PHP AS, MS IIS AS, Java EE, ...

Слайд 5





CGI - Common Gateway Interface
	Standard used to communicate of the web server with an external program for generating dynamic web content.
	CGI-script - a program that works on the CGI-interface. Web-server is configured to redirect certain URL requests for CGI scripts.
Описание слайда:
CGI - Common Gateway Interface Standard used to communicate of the web server with an external program for generating dynamic web content. CGI-script - a program that works on the CGI-interface. Web-server is configured to redirect certain URL requests for CGI scripts.

Слайд 6





CGI - Common Gateway Interface
Shortcomings of CGI technology:
● Start an OS process for each request 
● A lot of low-level coding
● No sharing resources across requests
● No session state
Описание слайда:
CGI - Common Gateway Interface Shortcomings of CGI technology: ● Start an OS process for each request ● A lot of low-level coding ● No sharing resources across requests ● No session state

Слайд 7





Http Servlet
service(HttpServletRequest, HttpServletResponse)
doGet(HttpServletRequest, HttpServletResponse)
doPost(HttpServletRequest, HttpServletResponse)
Описание слайда:
Http Servlet service(HttpServletRequest, HttpServletResponse) doGet(HttpServletRequest, HttpServletResponse) doPost(HttpServletRequest, HttpServletResponse)

Слайд 8





Java Servlet
@WebServlet(name = "helloServlet", urlPatterns = {"/hello"})
public class HelloServlet extends HttpServlet {
    public void doGet(
        HttpServletRequest request,
        HttpServletResponse response
    ) throws IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<h1>Hello World</h1>");
    }
}
Описание слайда:
Java Servlet @WebServlet(name = "helloServlet", urlPatterns = {"/hello"}) public class HelloServlet extends HttpServlet { public void doGet( HttpServletRequest request, HttpServletResponse response ) throws IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<h1>Hello World</h1>"); } }

Слайд 9





Java Servlet 4.0	
HTTP /2
Request/Response multiplexing
Stream Prioritization
Server Push
Upgrade from HTTP 1.1 
Описание слайда:
Java Servlet 4.0 HTTP /2 Request/Response multiplexing Stream Prioritization Server Push Upgrade from HTTP 1.1 

Слайд 10





Servlet Lifecycle
Loads the servlet class
Creates an instance of the servlet class
Initializes the servlet instance by calling the init() method
Does all work
When the container needs to remove the servlet, it calls the servlet’s destroy() method
Описание слайда:
Servlet Lifecycle Loads the servlet class Creates an instance of the servlet class Initializes the servlet instance by calling the init() method Does all work When the container needs to remove the servlet, it calls the servlet’s destroy() method

Слайд 11





HttpServletRequest
Container creates HttpServletRequest object and passes it as argument to Servlet's service methods (doGet, doPost, etc.)
HttpServletRequest provides client request info to Servlet.
Passed to the service(...) method, doGet (...), doPost (...), do ... ().
Описание слайда:
HttpServletRequest Container creates HttpServletRequest object and passes it as argument to Servlet's service methods (doGet, doPost, etc.) HttpServletRequest provides client request info to Servlet. Passed to the service(...) method, doGet (...), doPost (...), do ... ().

Слайд 12





HttpServletRequest
Methods:
  - getHeader (String)
  - getParameter (String)
  - getInputStream ()
  - getSession ()
  - getServletContext ()
  - etc
Описание слайда:
HttpServletRequest Methods:   - getHeader (String)   - getParameter (String)   - getInputStream ()   - getSession ()   - getServletContext () - etc

Слайд 13





HttpServletResponse
Container creates HttpServletResponse object and passes it to Servlet's service methods (doGet, doPost, etc.)
HttpServletResponse assists a servlet in sending a response to the client. 
As well as HttpServletRequest is passed in service(...) and do...(...)
Описание слайда:
HttpServletResponse Container creates HttpServletResponse object and passes it to Servlet's service methods (doGet, doPost, etc.) HttpServletResponse assists a servlet in sending a response to the client. As well as HttpServletRequest is passed in service(...) and do...(...)

Слайд 14





HttpServletResponse
Methods:
  - addHeader (String, String)
  - setStatus (int)
  - sendError (int)
  - sendRedirect (String)
  - setHeader (String, String)
  - getWriter ()
  - etc
Описание слайда:
HttpServletResponse Methods:   - addHeader (String, String)   - setStatus (int)   - sendError (int)   - sendRedirect (String)   - setHeader (String, String)   - getWriter ()   - etc

Слайд 15





HttpSession
HttpSession session = request.getSession();
Main methods:
  - invalidate ()
  - getAttributeNames ()
  - getAttribute (String)
  - removeAttribute (String)
  - setAttribute (String, Object)
  - etc
Описание слайда:
HttpSession HttpSession session = request.getSession(); Main methods:   - invalidate ()   - getAttributeNames ()   - getAttribute (String)   - removeAttribute (String)   - setAttribute (String, Object) - etc

Слайд 16





ServletContext
Servlet uses ServletContext to communicate with its servlet container, access the servlet container.
ServletContext sc = request.getServletContext();
Main methods:
  - getAttributeNames ()
  - getAttribute (String)
  - removeAttribute (String)
  - setAttribute (String, Object)
  - etc
Описание слайда:
ServletContext Servlet uses ServletContext to communicate with its servlet container, access the servlet container. ServletContext sc = request.getServletContext(); Main methods:   - getAttributeNames ()   - getAttribute (String)   - removeAttribute (String)   - setAttribute (String, Object) - etc

Слайд 17





Filter
@WebFilter(urlPatterns = {"/*"})
public class HelloFilter implements Filter {
    public void init(FilterConfig cfg) {
    }

    public void doFilter(
        ServletRequest req, ServletResponse resp, FilterChain chain
    ) throws ServletException, IOException {
        chain.doFilter(req, resp);
    }

    public void destroy() {
    }
}
Описание слайда:
Filter @WebFilter(urlPatterns = {"/*"}) public class HelloFilter implements Filter { public void init(FilterConfig cfg) { } public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ) throws ServletException, IOException { chain.doFilter(req, resp); } public void destroy() { } }

Слайд 18





Error Handling
@WebServlet("/error")
public class ErrorHandler extends HttpServlet {
    private static final long serialVersionUID = 1L;

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        resp.setContentType("text/html; charset=utf-8");
        try (PrintWriter writer = resp.getWriter()) {
            writer.write("<html><head><title>Error description</title></head><body>");
            writer.write("<h2>Error description</h2>");
            writer.write("<ul>");
            Arrays.asList(
                ERROR_STATUS_CODE,
                ERROR_EXCEPTION_TYPE,
                ERROR_MESSAGE)
                .forEach(e ->
                    writer.write("<li>" + e + ":" + req.getAttribute(e) + " </li>")
                );
            writer.write("</ul>");
            writer.write("</html></body>");
        }
    }
}
Описание слайда:
Error Handling @WebServlet("/error") public class ErrorHandler extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/html; charset=utf-8"); try (PrintWriter writer = resp.getWriter()) { writer.write("<html><head><title>Error description</title></head><body>"); writer.write("<h2>Error description</h2>"); writer.write("<ul>"); Arrays.asList( ERROR_STATUS_CODE, ERROR_EXCEPTION_TYPE, ERROR_MESSAGE) .forEach(e -> writer.write("<li>" + e + ":" + req.getAttribute(e) + " </li>") ); writer.write("</ul>"); writer.write("</html></body>"); } } }

Слайд 19





Error Handling
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
   http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">

    <display-name>Web Project</display-name>

    <error-page>
        <exception-type>java.lang.RuntimeException</exception-type>
        <location>/error</location>
    </error-page>
</web-app>
Описание слайда:
Error Handling <?xml version="1.0" encoding="UTF-8"?> <web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"> <display-name>Web Project</display-name> <error-page> <exception-type>java.lang.RuntimeException</exception-type> <location>/error</location> </error-page> </web-app>

Слайд 20





Web (servlet) container
A Web server - component that interacts with Java Servlets.
Primary responsibilities are:
  - Management of servlets and their life cycle
  - Mapping the URL to a specific servlet.
  - Check access rights
Описание слайда:
Web (servlet) container A Web server - component that interacts with Java Servlets. Primary responsibilities are:   - Management of servlets and their life cycle - Mapping the URL to a specific servlet. - Check access rights

Слайд 21





Java EE & Servlet (Web) Container
Most popular Servlet (Web) Containers
• Apache Tomcat
• Jetty
• JBoss Application Server (WildFly)
• …
Описание слайда:
Java EE & Servlet (Web) Container Most popular Servlet (Web) Containers • Apache Tomcat • Jetty • JBoss Application Server (WildFly) • …

Слайд 22





Apache Tomcat
Описание слайда:
Apache Tomcat

Слайд 23





WAR
Web application ARchive -  is a JAR file used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, libraries, static web pages (HTML, JS, CSS, etc) and other resources…
Описание слайда:
WAR Web application ARchive - is a JAR file used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, libraries, static web pages (HTML, JS, CSS, etc) and other resources…

Слайд 24





WAR
Описание слайда:
WAR

Слайд 25





Literature
Building Java Web Applications
Servlets (by Baeldung)
Servlets (by Tutorialspoint)
How to Install Apache Tomcat
What is servlet container
Servlets (by Jetbrains)
Описание слайда:
Literature Building Java Web Applications Servlets (by Baeldung) Servlets (by Tutorialspoint) How to Install Apache Tomcat What is servlet container Servlets (by Jetbrains)

Слайд 26





Homework Task 1
Implement a servlet with interface:
 `/session?action=[add/update/remove/invalidate]&name=...&value=...`
1. The servlet generates a form with input fields "action", "name", "value" and button "Submit". Below print is a list of all attributes of the user session.
action - depending on the value, the servlet adds, updates, or removes an attribute in/from a session;
name - the name of the attribute;
value - is the value of the attribute.
2. If any error happens – log and redirect user to custom error page
3. Add request blocking filter, when user browser is ‘Microsoft Edge’ – block request and show error page. Use 
4. Add separate request logging filter. Log endpoints path and total execution time. Should measure all actions (even when request blocked)
5. Add separate request blocking filter. When today is weekend – deny all operations. Microsoft Edge users should never come here and be stopped by user-agent filter.
6. Attributes lists should not be shared between two browsers
Описание слайда:
Homework Task 1 Implement a servlet with interface: `/session?action=[add/update/remove/invalidate]&name=...&value=...` 1. The servlet generates a form with input fields "action", "name", "value" and button "Submit". Below print is a list of all attributes of the user session. action - depending on the value, the servlet adds, updates, or removes an attribute in/from a session; name - the name of the attribute; value - is the value of the attribute. 2. If any error happens – log and redirect user to custom error page 3. Add request blocking filter, when user browser is ‘Microsoft Edge’ – block request and show error page. Use 4. Add separate request logging filter. Log endpoints path and total execution time. Should measure all actions (even when request blocked) 5. Add separate request blocking filter. When today is weekend – deny all operations. Microsoft Edge users should never come here and be stopped by user-agent filter. 6. Attributes lists should not be shared between two browsers

Слайд 27





Homework Task 1
Описание слайда:
Homework Task 1



Теги Java 4 WEB
Похожие презентации
Mypresentation.ru
Загрузить презентацию