Results 1 to 4 of 4

Thread: Snoop in JSP

  1. #1
    Join Date
    Nov 2009
    Posts
    680

    Snoop in JSP

    Hi, I want code and the details of Snoop in JSP, can anyone help me to get this? I am waiting for your reply. Please, help me in this to get information. I am waiting for your reply.

  2. #2
    Join Date
    Jan 2008
    Posts
    3,388

    Re: Snoop in JSP

    Hi, The snoop in Jsp is many times contains the request information, ServletContext initialization parameters, ServetContext attributes, request headers, response headers etc. etc.
    You can use the following code to get information about the Snoop:
    Code:
    <%@ page import="javax.servlet.http.HttpUtils,java.util.*" %>
    <h2> Request Information </h2>
    JSP Request Method: <%= request.getMethod() %><br>
    Request URI: <%= request.getRequestURI() %><br>
    Request Protocol: <%= request.getProtocol() %><br>
    Servlet path: <%= request.getServletPath() %><br>
    Path info: <%= request.getPathInfo() %><br>
    Query string: <%= request.getQueryString() %><br>
    Content length: <%= request.getContentLength() %><br>
    Content type: <%= request.getContentType() %><br>
    Server name: <%= request.getServerName() %><br>
    Server port: <%= request.getServerPort() %><br>
    Remote user: <%= request.getRemoteUser() %><br>
    Remote address: <%= request.getRemoteAddr() %><br>
    Remote host: <%= request.getRemoteHost() %><br>
    Authorization scheme: <%= request.getAuthType() %> <br>
    Locale: <%= request.getLocale() %>
    <hr>The browser you are using is <%= request.getHeader("User-Agent") %><hr>
    </body>
    </html>

  3. #3
    Join Date
    May 2008
    Posts
    4,085

    Re: Snoop in JSP

    Hi, I don't know have more knowledge about the JSP. But, I don't know what is snoop. But, I have got the code which will help you to get some knowledge about snoop. Use the code below.

    Code:
    <HTML>
    <HEAD>
    	<TITLE>JSP snoop page</TITLE>
    <%@ page import="javax.servlet.http.HttpUtils,java.util.Enumeration" %>
    </HEAD>
    <BODY>
    <H1>Code for JSP Snoop</H1>
    <TABLE>
    <TR>
    	<TH align=right>Server Info:</TH>
    	<TD><%= application.getServerInfo() %></TD>
    </TR>
    </TABLE>
    
    <H2>Request information</H2>
    
    <TABLE>
    <TR>
    	<TH align=right>Requested URL:</TH>
    	<TD><%= HttpUtils.getRequestURL(request) %></TD>
    </TR>
    <TR>
    	<TH align=right>Request method:</TH>
    	<TD><%= request.getMethod() %></TD>
    </TR>
    <TR>
    	<TH align=right>Request URI:</TH>
    	<TD><%= request.getRequestURI() %></TD>
    </TR>
    <TR>
    	<TH align=right>Request protocol:</TH>
    	<TD><%= request.getProtocol() %></TD>
    </TR>
    <TR>
    	<TH align=right>Servlet path:</TH>
    	<TD><%= request.getServletPath() %></TD>
    </TR>
    <TR>
    	<TH align=right>Path info:</TH>
    	<TD><%= request.getPathInfo() %></TD>
    </TR>
    <TR>
    	<TH align=right>Path translated:</TH>
    	<TD><%= request.getPathTranslated() %></TD>
    </TR>
    <TR>
    	<TH align=right>Query string:</TH>
    	<TD><%= request.getQueryString() %></TD>
    </TR>
    <TR>
    	<TH align=right>Content length:</TH>
    	<TD><%= request.getContentLength() %></TD>
    </TR>
    <TR>
    	<TH align=right>Content type:</TH>
    	<TD><%= request.getContentType() %></TD>
    <TR>
    <TR>
    	<TH align=right>Server name:</TH>
    	<TD><%= request.getServerName() %></TD>
    <TR>
    <TR>
    	<TH align=right>Server port:</TH>
    	<TD><%= request.getServerPort() %></TD>
    <TR>
    <TR>
    	<TH align=right>Remote user:</TH>
    	<TD><%= request.getRemoteUser() %></TD>
    <TR>
    <TR>
    	<TH align=right>Remote address:</TH>
    	<TD><%= request.getRemoteAddr() %></TD>
    <TR>
    <TR>
    	<TH align=right>Remote host:</TH>
    	<TD><%= request.getRemoteHost() %></TD>
    <TR>
    <TR>
    	<TH align=right>Authorization scheme:</TH>
    	<TD><%= request.getAuthType() %></TD>
    <TR>
    </TABLE>
    
    <%
    	Enumeration enum = request.getHeaderNames();
    	if(enum != null && enum.hasMoreElements()) {
    %>
    <H2>Request headers</H2>
    
    <TABLE>
    <TR>
    	<TH align=left>Header:</TH>
    	<TH align=left>Value:</TH>
    </TR>
    <%
    		while(enum.hasMoreElements()) {
    			String str = (String) enum.nextElement();
    %>
    <TR>
    	<TD><%= str %></TD>
    	<TD><%= request.getHeader(str) %></TD>
    </TR>
    <%
    		}
    %>
    </TABLE>
    <%
    	}
    %>
    
    
    <%
    	enum = request.getParameterNames();
    	if(enum != null && enum.hasMoreElements()) {
    %>
    <H2>Request parameters</H2>
    <TABLE>
    <TR valign=top>
    	<TH align=left>Parameter:</TH>
    	<TH align=left>Value:</TH>
    	<TH align=left>Multiple values:</TH>
    </TR>
    <%
    		while(enum.hasMoreElements()) {
    			String str = (String) enum.nextElement();
    			String value = request.getParameter(str);
    			String values[] = request.getParameterValues(str);
    %>
    <TR valign=top>
    	<TD><%= str %></TD>
    	<TD><%= value %></TD>
    	<TD><%
    			for(int i = 0; i < values.length; i++) {
    				if(i > 0)
    					out.print("<BR>");
    				out.print(values[i]);
    			}
    		%></TD>
    </TR>
    <%
    		}
    %>
    </TABLE>
    <%
    	}
    %>
    
    <%
    	enum = getServletConfig().getInitParameterNames();
    	if(enum != null && enum.hasMoreElements()) {
    %>
    <H2>Init parameters</H2>
    <TABLE>
    <TR valign=top>
    	<TH align=left>Parameter:</TH>
    	<TH align=left>Value:</TH>
    </TR>
    <%
    		while(enum.hasMoreElements()) {
    			String str = (String) enum.nextElement();
    			String value = getServletConfig().getInitParameter(str);
    %>
    <TR valign=top>
    	<TD><%= str %></TD>
    	<TD><%= value %></TD>
    </TR>
    <%
    		}
    %>
    </TABLE>
    <%
           String prefix = "org.apache.jserv.";
           Object attrsObj = request.getAttribute("org.apache.jserv.attribute_names");
           if ( attrsObj != null && attrsObj instanceof Enumeration ) {
               Enumeration attrs = (Enumeration) attrsObj;
    %>
     <P>
    <H1>JServ Attributes</H1>
    available via HttpServletRequest.getAttribute()
    <BR>
    <TABLE>
    <%
               while ( attrs.hasMoreElements()) {
                   String attr = attrs.nextElement().toString();
    %>
    <TR><TD>
    <%
                   if ( request.getAttribute(prefix + attr) != null ) {
                       out.println( prefix + attr + "</TD><TD>" +
                           request.getAttribute(prefix + attr).toString());
                   } else {
                       out.println( prefix + attr + "</TD><TD>NULL " );
                   }
    %>
    </TD></TR>
    <%
    
               }
           }
    %>
    </TABLE>
    <%
    	}
    %>
    
    </BODY>
    </HTML>

  4. #4
    Join Date
    Apr 2008
    Posts
    3,267

    Re: Snoop in JSP

    Hi, I am not having any information about the snoop in JSP, but I am very keen to get information about the Snoop from JSP. I have searched on internet, but unable to get information about this. If you got more about this, then give it to me also. I am waiting for reply. I also want to gain some more information about this, so please give me if you have any information.

Similar Threads

  1. Video Dac Snoop
    By Nobleman in forum Operating Systems
    Replies: 3
    Last Post: 21-07-2009, 12:51 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,930,015.17268 seconds with 17 queries