This page applies to an earlier version of the AppDynamics App IQ Platform.
See the latest version of the documentation.


Skip to end of metadata
Go to start of metadata

On this page:

Related pages:

Your Rating:
Results:
PatheticBadOKGoodOutstanding!
53 rates

Assisted injection is when your server-side application injects the JavaScript Agent into your browser application. The following sections show you how to configure your business applications to inject the JavaScript Agent into your browser applications.

Injection Rules (Java Only)

To have your server-side application use assisted injection of the JavaScript Agent using injection rules, you define rules to configure: 

  • The Java classes and methods that should be intercepted 
  • The Java writer object and method to use to add the agent to the response object 

Assisted injection using rules is available for Java frameworks only.  

Access the User Experience App Integration Panel

  1. From the Applications page, open the business application that you want to automatically inject the JavaScript Agent into your browser application.
  2. From the left navigation bar, select Configuration.
  3. Click User Experience App Integration.

Create JavaScript Injection Rules

  1. In the JavaScript Agent Injection tab, select a browser application from the Inject the JavaScript Agent configured for this Browser App dropdown.
  2. From the Configure JavaScript Injection tab, expand Create Injection Rules.
  3. Click the + icon to open the Create Manual Injection Rule dialog.
  4. From the Where to Inject JavaScript tab:
    1.  In the Name field, enter a name for the rule. 
    2. Check Enable.
    3. In the Class and Method to intercept section, define match conditions for the class and method that write to the output stream in your application. This is the class that server-side agent intercepts for injection.
    4. If the write method is overloaded:
      1. Check the Is this Method Overloaded? check box.

      2. Click Add Parameter.
      3. Add the parameters that define the method.
    1. In the Pointer to the writer section: 
      1. Select how to obtain a reference to the writer object using either the selected method with a configured number of parameters, return value, or invoked object.
      2. Specify a getter chain.
    2. In the Injection options section, specify:
      • the output stream write method the server-side agent should use to inject the JavaScript Agent
      • when the injection should occur: when the method begins or when the method ends
      • which part of the script should be injected: the header or the footer
      • optional prefix to output before writing the header or footer, such as <DOCTYPE. . . >
  5. Click Create Injection Rule.

Attribute Injection

To have your server-side application use assisted injection of the JavaScript Agent using attribute injection, you: 

  • Enable attribute injection
  • Copy code snippets into your page template 

Only Servlet containers supported assisted injection.

Access the User Experience App Integration Panel

  1. From the Applications page, open the business application that you want to automatically inject the JavaScript Agent into your browser application.
  2. From the left navigation bar, select Configuration.
  3. Click User Experience App Integration.

Access the JavaScript Injection Configuration Panel

  1. From the User Experience App Integration page, click the JavaScript Agent Injection tab.
  2. In the JavaScript Agent Injection tab, select a browser application from the Inject the JavaScript Agent configured for this Browser App dropdown.

Copy Code Snippets into Your Page Template

The following examples show code snippets that can be copied directly into your page templates or other code creating your page. These code snippets tell the app agent where to inject information. The header value must be injected at the very top of the <head> section and the footer value must be added at the very end of the code creating the page.  

If you have already injected the header portion of the agent using manual injection, you can use these code snippets to automatically inject the footer data portion only. In this case, add only the JS_FOOTER values shown in the sections below.

JSF

<h:outputText rendered="#{AppDynamics_JS_HEADER != null}" value='#{request.getAttribute("AppDynamics_JS_HEADER")}' escape="false"/>
<h:outputText rendered="#{AppDynamics_JS_FOOTER != null}" value='#{request.getAttribute("AppDynamics_JS_FOOTER")}' escape="false"/>

JSP

<% if (request.getAttribute("AppDynamics_JS_HEADER") != null) { %> <%=request.getAttribute("AppDynamics_JS_HEADER")%> <% } %>
<% if (request.getAttribute("AppDynamics_JS_FOOTER") != null) { %> <%=request.getAttribute("AppDynamics_JS_FOOTER")%> <% } %>

Servlet

if (request.getAttribute("AppDynamics_JS_HEADER") != null)
{
    out.write(request.getAttribute("AppDynamics_JS_HEADER".toString());
}
if (request.getAttribute("AppDynamics_JS_FOOTER") != null)
{
    out.write(request.getAttribute("AppDynamics_JS_FOOTER").toString());
}

Groovy

<g:if test="${AppDynamics_JS_HEADER}">
    ${AppDynamics_JS_HEADER}
</g:if>

<g:if test="${AppDynamics_JS_FOOTER}">
    ${AppDynamics_JS_FOOTER}
</g:if>

Velocity Template

#if ($AppDynamics_JS_HEADER)
    $AppDynamics_JS_HEADER
#end
#if ($AppDynamics_JS_FOOTER)
    $AppDynamics_JS_FOOTER
#end

ASP.NET C#

<% if (Context.Items.Contains("AppDynamics_JS_HEADER"))
    Response.Write(Context.Items["AppDynamics_JS_HEADER"]); %>
<% if (Context.Items.Contains("AppDynamics_JS_FOOTER"))
    Response.Write(Context.Items["AppDynamics_JS_FOOTER"]); %>

MVC Razor

@if(HttpContext.Current.Items.Contains("AppDynamics_JS_HEADER")) 
{ @Html.Raw((string)HttpContext.Current.Items["AppDynamics_JS_HEADER"]) }
@if(HttpContext.Current.Items.Contains("AppDynamics_JS_FOOTER") )
{ @Html.Raw(HttpContext.Current.Items["AppDynamics_JS_FOOTER"].ToString()) }