In FusionReactor 6.0.0 we have added the ability to name the Application for each web request. This feature allows for a greater break down of requests by each application. There are many different ways to name the application and FusionReactor will automatically try all options, however there is a priority order.
Naming Priority
- FRAPI.setTransactionApplicationName
- Request attribute (fr.application.name)
- Middleware server (e.g.CFAPPLICATION)
- Servlet init parameter (fr.application.name)
- Filter init parameter (fr.application.name)
- Web app context parameter (fr.application.name)
- Web app context name (display-name)
- Web app servlet context path
- The Default Application Name
Default Name
In the event that FusionReactor is unable to detect the name of the application via any of the options above (or if the automatic application naming is disabled), it will default to name set as the default. This is set in the FusionReactor -> Settings page (http://docs.intergral.com/display/FR60/Settings).
Manual Naming
If you want to override the automatic naming detected by FusionReactor you can set the name for the application using request attributes of parameters at different levels (context, filter and servlet). In all cases the key used is fr.application.name.
Web App Context Parameter
To set the application name used by FusionReactor as a context parameter, edit the web.xml file and add the following code block.
<context-param> <param-name>fr.application.name</param-name> <param-value>JSP Test App</param-value> </context-param>
Filter Parameter
To set the application name used by FusionReactor as a filter init parameter, edit the filter configuration and add the property fr.application.name with the value being the name of the application. This can be done via the web.xml adding the parameter to the filter definition.
<filter> <filter-name>Filter3</filter-name> <filter-class>com.intergral.test.fusionreactor.filters.Filter3</filter-class> <init-param> <param-name>fr.application.name</param-name> <param-value>Application Name</param-value> </init-param> </filter>
Servlet Parameter
Similar to the filter parameter settings you can set the application name for FusionReactor to use as a servlet init parameter. This is also done via the web.xml file.
<servlet> <servlet-name>Servlet2</servlet-name> <servlet-class>com.intergral.fusionreactor.servlets.Servlet2</servlet-class> <init-param> <param-name>fr.application.name</param-name> <param-value>Application Name</param-value> </init-param> </servlet>
Request Attribute
To set the application name with a request attribute simply add the attribute to the request object. FusionReactor will then use this attribute as the application name when the request is complete. This approach will only affect the requests where this attribute is set.
request.setAttribute("fr.application.name", "Application Name");
FRAPI Call
To set the application name with the FusionReactor API (FRAPI) you simply need to call the appropriate method within your code. This method of setting the application name takes precedence over all other methods, however it will only affect the single request where this method is called.
FRAPI.getFRAPI().setTransactionApplicationName("Application Name");
Automatic Naming
FusionReactor will automatically name applications using a few different ways, FusionReactor will try all of these methods without needing any additional settings.
Middleware Server
With some application servers it is possible to set the name of the application in the code. For example in Coldfusion you can set the name of the application using the <CFAPPLICATION> tag.
<cfapplication name=CF App>
Web App Context Name
The most common name will become the application context name. This name is defined in the web.xml for the application, using the display-name element.
<display-name>JSP Test Application</display-name>
Web App Context path
The last resort for the application name before it becomes the default is to use the context path for the application. This is the root of the URL for the application.
This image shows the URL for the Apache Tomcat Manager app, where the context paht is /manager.
Fixed Application Name
When running microservices or other small J2EE servers its nice to be able to set the application name to a single value for the whole server if the server is only running one application. E.g dev_website or prod_website.
You can configure this by disabling Auto Application Naming in the FusionReactor Settings. This is set in the FusionReactor -> Settings page (http://docs.intergral.com/display/FR60/Settings). You can these configure the Default Application Name to be the name of your application. E.g dev_website. This will result in all information that FusionReactor tracks be attributed to this application name.
Both these settings can be set at the command line too.
- -Dfr.application.name can be used to set the default application name
- -Dfr.application.auto_naming can be used to enable or disable the automatic application naming.
So the following would set the application name to be dev_website for all transactions :
-Dfr.application.name=dev_website -Dfr.application.auto_naming=false
Issue Details
Type | Technote |
---|---|
Issue Number | FRS-367 |
Components | FRAPI |
Resolution | Fixed |
Last Updated | 2019-11-25T12:07:32.724+0000 |
Fix Version(s) | 6.0.0 |