Virajsinh

getinfo

Jul 17th, 2018
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. //Ex 21
  2.  
  3. import java.io.*;
  4. import java.util.*;
  5. import javax.servlet.*;
  6. import javax.servlet.http.*;
  7.  
  8. public class getinfo extends GenericServlet
  9. {
  10.     public void service(ServletRequest req, ServletResponse res) throws IOException, ServletException
  11.     {
  12.         ServletContext context = getServletContext();
  13.         PrintWriter out = res.getWriter();
  14.         res.setContentType("text/html");
  15.        
  16.         out.println(new Date().toString());
  17.         out.println("<br>Server : "+context.getServerInfo());
  18.         out.println("<br>Server Name : "+req.getServerName());
  19.         out.println("<br>Server Port : "+req.getServerPort());
  20.         out.println("<br>Server Protocol :"+req.getProtocol());
  21.     }
  22.     public String getServlet()
  23.     {
  24.         return "Click";
  25.     }
  26. }
Add Comment
Please, Sign In to add comment