# Request Details Resolver

###### Identifier:

org.eclipse.mat.api.requestResolver

###### Since:

0.7.0

###### Description:

The Leak Suspect report tries to display the current activity of a suspicious thread. For example, a HTTP worker thread used by a web container usually contains information about the request URL currently processed. This information is helpful to better understand the current problem.

This is how it works: The heap dump contains information about which objects are currently on the call stack of a thread (so called "Java Locals"). If some "HTTP request" object is on the call stack, one can pretty safely assume that the thread is executing this HTTP request. Of course, this requires some implementation knowlege and may change from version to version. The Memory Analyzer checks if a request details resolver is configured for one of the Java local objects and asks the resolver to provide a summary and detail page.

###### Configuration Markup:

<!ELEMENT extension (resolver)+>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED

>

<!ELEMENT resolver EMPTY>

<!ATTLIST resolver

impl CDATA #REQUIRED

>

- impl - implementor of `org.eclipse.mat.snapshot.extension.IRequestDetailsResolver` annotated with `@Subject` or `@Subjects`

###### Examples:

Following is an example of a request resolver declaration:

       <extension point="org.eclipse.mat.api.requestResolver">
          <resolver impl="org.eclipse.mat.inspections.jetty.JettyRequestResolver"/>
       </extension>

The implemenation could look like this:

       @Subject("org.mortbay.jetty.Request")
       public class JettyRequestResolver implements IRequestDetailsResolver
       {
          public void complement(ISnapshot snapshot,
                                 IThreadInfo thread,
                                 int[] javaLocals,
                                 int thisJavaLocal,
                                 IProgressListener listener)
                      throws SnapshotException
        {
           IObject httpRequest = snapshot.getObject(thisJavaLocal);
           IObject requestURI = (IObject) httpRequest.resolveValue("_requestURI");

           [...]

           thread.addRequest(summary, details);
       }

The `@Subject` tells the Memory Analyzer, to use this request details resolver for all instances of type "org.mortbay.jetty.Request". In this

###### API Information:

The value of the impl attribute must represent an implementor of `org.eclipse.mat.snapshot.extension.IRequestDetailsResolver`.

###### Supplied Implementation:

The Memory Analyzer supplies a sample request details resolver for Jetty: `org.eclipse.mat.inspections.jetty.JettyRequestResolver`.

Copyright (c) 2008 SAP AG and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html