補助インジェクション
Related pages:
このページでは、JavaScript エージェントの補助インジェクションによってブラウザアプリケーションをインストゥルメント化する方法について説明します。補助インジェクションは、サーバ側アプリケーションがブラウザアプリケーションに JavaScript エージェントを挿入するときに使用されます。ブラウザアプリケーションに JavaScript エージェントを挿入するようにビジネスアプリケーションを設定できます。
Types of Assisted Injection
You can perform assisted injection with rules or through attributes. This table summarizes the platforms supported for each type of assisted injection and the process for performing the assisted injection.
| Type of Assisted Injection | Supported Platforms | Description |
|---|---|---|
| Injection Rules | Java |
Type of assisted injection uses rules to configure which Java classes should be intercepted. You create the injection rules in the User Experience App Integration Panel of the Controller UI for the business application that will inject the JavaScript Agent. |
| Attribute Injection | Java, ASP.NET |
Type of assisted injection relies on templates that tell the app agent where to inject information. You enable attribute injection in the User Experience App Integration Panel of the Controller UI for the business application that will inject the JavaScript Agent. Additionally, you add code snippets in the page templates that determine where the JavaScript Agent is injected. |
インジェクションルール(Java のみ)
サーバ側アプリケーションでインジェクションルールを使用して JavaScript エージェントの補助インジェクションを使用するには、以下を構成するルールを定義します。
- インターセプトする必要がある Java クラスとメソッド
- エージェントを応答オブジェクトに追加するために使用する Java ライターオブジェクトとメソッド
[ユーザー体験アプリケーションの統合(User Experience App Integration)] パネルへのアクセス
- [Applications] ページから、ブラウザアプリケーションに JavaScript エージェントを自動的に挿入するビジネスアプリケーションを開きます。
- 左のナビゲーションバーから [Configuration] を選択します。
- User Experience App Integration をクリックします。
JavaScript インジェクションルールの作成
- [JavaScriptエージェントのインジェクション(JavaScript Agent Injection)] タブで、[Inject the JavaScript Agent configured for this Browser App] ドロップダウンからブラウザアプリケーションを選択します。
- [JavaScriptインジェクションの設定(Configure JavaScript Injection)] タブで、[Create Injection Rules.] を展開します
- [+] アイコンをクリックし、[Create Manual Injection Rule] ダイアログを開きます。
- [Where to Inject JavaScript] タブで、次の手順を実行します。
- Create Injection Rule をクリックします。
属性インジェクション
サーバ側アプリケーションで属性インジェクションを使用して JavaScript エージェントの補助インジェクションを使用するには、以下を実行します。
- 属性インジェクションの有効化
- ページテンプレートへのコードスニペットのコピー
[ユーザー体験アプリケーションの統合(User Experience App Integration)] パネルへのアクセス
- [Applications] ページから、ブラウザアプリケーションに JavaScript エージェントを自動的に挿入するビジネスアプリケーションを開きます。
- 左のナビゲーションバーから [Configuration] を選択します。
- User Experience App Integration をクリックします。
[JavaScript Injection Configuration] パネルへのアクセス
- [User Experience App Integration] ページで、[JavaScriptエージェントのインジェクション(JavaScript Agent Injection)] タブをクリックします。
- [JavaScriptエージェントのインジェクション(JavaScript Agent Injection)] タブで、[Inject the JavaScript Agent configured for this Browser App] ドロップダウンからブラウザアプリケーションを選択します。
ページテンプレートへのコードスニペットのコピー
次の例は、ページテンプレートまたは他のページに直接コピーできるコードスニペットを示しています。これらのコードスニペットは、情報を挿入する場所をアプリケーション エージェントに示します。ヘッダー値は <head> セクションの一番上に挿入する必要があります。また、フッター値は、ページを作成するコードの最後に追加する必要があります。
手動インジェクションを使用してエージェントのヘッダー部分をすでに挿入している場合は、これらのコードスニペットを使用して、フッターデータ部分のみを自動的に挿入できます。この場合は、次のセクションに示す JS_FOOTER 値のみを追加します。
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 テンプレート
#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()) }