ObjectSnoop Homepage Features History Download Contact Links Manual
SourceForge Project homepage Website
| Chapter 5. Filters by class
The documentation of ObjectSnoop wouldn't be complete without a catalog
of all of the built in filters. These filters are all available to
the developer as a named alias through the get()
method of FilterFactory
or the filter() method of SnoopDirector
(Section 3.5).
Filters fall into two classifications: simple and composite. A simple filter
will take an object and examine one aspect of it. A composite filter is
a collection of simple filters and/or other composite filters, and provides
a great deal more information.
Note that a filter cannot automagically obtain an appropriate object
for examination. They passively wait for an object or interface that they
recognize, and then provide additional or replacement interpretation
to the output formatter.
Some filters are only available from the
FilterFactory if the appropriate classes have
already been loaded into your application. This prevents
'class not found' runtime errors should ObjectSnoop try to load classes that
you don't have installed on your system. At present this only applies to
servlet related classes.
The filters described here act on the Java classes that are present
in the JRE (Java Runtime Environment). There are only
a small selection of filters here at the moment, for what might be judged
as the most frequently used classes.
5.1.1. Filter descriptions
The filters described here can be found in the
net.sourceforge.objectsnoop.filter.java
package. Aliases for the classes are all prefixed with
j_ for identification of the scope of their
intended use.
Table 5.1. List of filters for the standard Java API Filter alias | Comments | Implementing class |
---|
j_map |
Examines an object that implements the Map
interface, showing up to the first ten objects returned by the
iterator. At present, a Map that uses
objects other than String's as keys
will only show the key's object reference (i.e. the key isn't
snooped). This may be changed in a future release of ObjectSnoop
| MapFilter | j_set |
Examines an object that implements the Set
interface, showing up to the first ten objects returned by the
iterator.
| SetFilter | j_list |
Examines an object that implements the List
interface, showing up to the first ten objects returned by the
iterator.
| ListFilter |
These filters process information about the state of a
generic servlet and the objects that
define the environment around the servlet. The snooped classes
and interfaces are all found in the javax.servlet
package.
Many of these filters have counterparts among the HTTP servlet
family (Section 5.3). This shouldn't be surprising as
many of those classes and interfaces are derived from the ones examined
here.
5.2.1. Filter descriptions
All of the filter classes described here can be found in the
net.sourceforge.objectsnoop.filter.servlet
package. Aliases for the classes are all prefixed with
serv_ for identification of the scope
of their intended use.
You will probably find yourself making the greatest use of the
composite filters serv, serv_cont, and
serv_req,
as well as the serv_resp filter.
Table 5.2. List of filters for the GenericServlet API Filter alias | Comments | Implementing class |
---|
serv |
A "catch all" composite filter that includes all the other
filters in this section.
| ServletFilter | serv_cont |
A composite filter that examines the ServletContext
and displays all of the attributes, info, and initialization
parameters.
| ContextFilter | serv_cont_attr |
A single filter that displays all of the object attributes stored
in the ServletContext and accessed
with the getAttribute() method.
| ContextAttributesFilter | serv_cont_info |
A simple filter that examines the state of a ServletContext
described through its getter methods. This includes the supported
servlet API major and minor versions, and the identifying servlet
container.
| ContextInfoFilter | serv_cont_init |
This simple filter describes the initialization parameters
stored in the ServletContext and
accessed through the getInitParam() method.
For web oriented servlet containers, this will be the
initialization parameters found within web.xml.
| ContextInitParamsFilter | serv_req |
This composite filter displays information about the
ServletRequest object. It looks
at the parameters, attributes, and information on the
current state of the request.
| RequestFilter | serv_req_param |
This simple filter examines the parameters stored within
the ServletRequest object, and
normally accessed through the getParameter()
method.
| RequestParamFilter | serv_req_info |
A simple filter that describes the current state of
a ServletRequest object and how
the request was received. This includes
the remote address and host, protocol, and client preferred
locale.
| RequestInfoFilter | serv_req_attr |
A simple filter that presents the object attributes stored
in the ServletRequest,
and accessible via the getAttribute()
method.
| RequestAttributesFilter | serv_resp |
A simple filter that examines the current state of the
ServletResponse, including the
character encoding, output buffer size, and whether the buffer
has been flushed.
| ResponseFilter |
The filters described here process information about the state
of an http servlet and many of the objects that form
part of the Servlet API. All of these snooped classes and interfaces are found
in the javax.servlet.http package.
Many of these filters are derived from those among the servlet filters
(Section 5.2). The HttpServlet
extends the generic servlet classes to handle the HTTP protocol, and
the additional information centers around that extension. Where there
is an equivalent servlet filter, the HTTP filter will only
function for the HTTP specific class or interface (even if the output
would otherwise be identical).
The ServletContext isn't modified
when used in an HTTP aware servlet container, so the
serv_cont filter isn't duplicated in this set of filters.
5.3.1. Filter descriptions
All the filter classes described here can be found in the
net.sourceforge.objectsnoop.filter.servlet.http
package. Aliases for the classes are all prefixed with
serv_ for identification of the scope of their
intended use.
You will probably find yourself making the greatest use of the
composite filters http, http_req,
and http_sess, as well as the
http_response filter.
Table 5.3. List of filters for the HttpServlet API Filter alias | Comments | Implementing class |
---|
http |
A "catch all" filter that is a composite of all of the
filters defined in this group.
| HttpServletFilter | http_cookie |
Describes all of the cookies found in the servlet
request object. These cookies are the ones currently set on
the client's machine.
| CookieFilter | http_req |
A composite filter that displays all the information
about an HttpServletRequest
object: attributes, headers, info, cookies, and parameters.
| HttpRequestFilter | http_req_attr |
A single simple filter that displays attributes retrieved
from a HttpServletRequest object with
the getAttribute() method.
| HttpRequestAttributesFilter | http_req_head |
A simple filter that presents all of the request header information
sent by the client using the HTTP protocol. This information
includes the host, user-agent (browser) identifier etc.
| HttpRequestHeaderFilter | http_req_info |
A simple filter that presents all the information available
in the HttpServletRequest through getter
methods. This includes the request URL, the origin of the
session cookie, and all the information from the underlying
ServletRequest | HttpRequestInfoFilter | http_req_param |
A simple filter that presents the parameters included in the
request URL from the GET or POST submission methods, normally
accessed through the getParameter() method.
| HttpRequestParamFilter | http_resp |
A simple filter that describes the current state of the
HttpServletResponse object. This includes
the character encoding, the buffer size, and whether the buffer
has been committed.
| HttpResponseFilter | http_sess |
A composite filter that describes the state of the
HttpSession session object
associated with the client. This includes
the attributes stored within a session, as well as
the current information about the state of the session.
| SessionFilter | http_sess_attr |
A simple filter that examines all of the named objects stored
in the client's HttpSession object,
and accessed using the getAttribute()
method.
| SessionAttributesFilter | http_sess_info |
A simple filter that displays the information about
the HttpSession associated with the
client's request. This includes the session id, the time
of creation, and inactivity timeout.
| SessionInfoFilter | http_page |
A simple filter that examines the attributes stored within
the PageContext associated with an
individual JSP page. There is no equivalent object for a servlet.
The attributes examined are in the page scope: this includes
beans created so far on the JSP page, and some implementation
details specific to the JSP container implementation.
| PageAttributesFilter |
|