Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //23
- import java.io.*;
- import java.util.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- public class servletinfo extends GenericServlet
- {
- public void service(ServletRequest req, ServletResponse res) throws IOException, ServletException
- {
- ServletContext context = getServletContext();
- PrintWriter out = res.getWriter();
- res.setContentType("text/html");
- out.println("Test");
- out.println("<br>Major Version Of Servlet : "+context.getMajorVersion());
- out.println("<br>Manor Version Of Servlet : "+context.getMinorVersion());
- out.println("<br>Real Path : "+context.getRealPath("servletinfo.java"));
- out.println("<br>ResourceAsStream : "+context.getResourceAsStream("servletinfo"));
- out.println("<br>Resource : "+context.getResource("servletinfo"));
- out.println("<br>RequestDispatcher : "+context.getRequestDispatcher("servletinfo"));
- out.println("<br>Servlet Info : "+context.getServerInfo());
- out.println("<br>Mime Type : "+context.getMimeType("servletinfo"));
- }
- }
Add Comment
Please, Sign In to add comment