Virajsinh

serverinfo

Jul 17th, 2018
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. //23
  2. import java.io.*;
  3. import java.util.*;
  4. import javax.servlet.*;
  5. import javax.servlet.http.*;
  6.  
  7. public class servletinfo extends GenericServlet
  8. {
  9.     public void service(ServletRequest req, ServletResponse res) throws IOException, ServletException
  10.     {
  11.         ServletContext context = getServletContext();
  12.        
  13.         PrintWriter out = res.getWriter();
  14.         res.setContentType("text/html");
  15.        
  16.         out.println("Test");
  17.         out.println("<br>Major Version Of Servlet : "+context.getMajorVersion());
  18.         out.println("<br>Manor Version Of Servlet : "+context.getMinorVersion());
  19.         out.println("<br>Real Path : "+context.getRealPath("servletinfo.java"));
  20.         out.println("<br>ResourceAsStream : "+context.getResourceAsStream("servletinfo"));
  21.         out.println("<br>Resource : "+context.getResource("servletinfo"));
  22.         out.println("<br>RequestDispatcher : "+context.getRequestDispatcher("servletinfo"));
  23.         out.println("<br>Servlet Info : "+context.getServerInfo());
  24.         out.println("<br>Mime Type : "+context.getMimeType("servletinfo"));
  25.     }
  26. }
Add Comment
Please, Sign In to add comment