cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using REGEX for HTTP parameter existence JAVA

a.van.loon
Builder

Hey all,

 

I was wondering if you can use REGEX for matching the HTTP parameter existance. I can't ready anywhere something about it yet it seems like you can only use regex at checking the parameter value.

REGEX.PNG

 

The scenario:

The link is '/pages/cases?162-1.IBehaviorListener.0-caseOverviewForm-caseOverviewResultPanel-casesBody-cases-1-specialAttentionCell' where '162-1.IBehaviorListener.0-caseOverviewForm-caseOverviewResultPanel-casesBody-cases-1-specialAttentionCell' ' is the parameter with no value. The tricky thing is that the parameter changes the number with each case.

So the example link looks like this

162-1.IBehaviorListener.0-caseOverviewForm-caseOverviewResultPanel-casesBody-cases-1-specialAttentionCell'  or

122-1.IBehaviorListener.0-caseOverviewForm-caseOverviewResultPanel-casesBody-cases-0-specialAttentionCell' or

10-1.IBehaviorListener.0-caseOverviewForm-caseOverviewResultPanel-casesBody-cases-3-specialAttentionCell'

 

So I figured I'll do this through REGEX with: \d.*(-1.IBehaviorListener.0-caseOverviewForm-caseOverviewResultPanel-casesBody-cases-)\d.*(-specialAttentionCell)

That however doesn't work?

 

Any tips or tricks?

 

 

7 REPLIES 7

Peter.Holditch
Moderator
Moderator

What Business Transactions would you like to be tracking as a result of the rule you're trying to create and the example links you provided?



Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

Its a servlet transaction. The action that it registers is opening a case. There are multiple cases and each one has different number registration.

So is the problem statement that you want a BT for HTTP requests that hit the /pages/cases URL ONLY if a parameter of the form you provided exists?



Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

Thats exactly what I want. To clarify it even more.

 

The url /pages/cases is a business transaction already. I however need to monitor one extra substep that falls under the .pages/cases link. The thing that makes the transaction unique is the HTTP parameter as provided above. The crux is that http parameter can change depending on which case you open. So if I tell Appdynamics to check specifically for the the parameter above It'll only do it for that specific case. so the specific parameter needs to be filtered to a general parameter.

I have not tested, but you could try a rule which matches /pages/cases and configure the following split:

 

Apply a custom expression on HTPServletRequest

getQueryString().matches(\.*BehaviorListener\.\\d+-caseOverviewForm-caseOverviewResultPanel-casesBody-cases-\\d+-specialAttentionCell\.*)

 

If my regex-fu is right, this will result in 2 BTs called name.true and name.false where name.true is the class of BT you're trying to get at



Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

Interesting. I'm going to check this out this week

 

Still one question though. Is it possible to use regex in the HTTP parameter or is this only possible for de values of HTTP parameters?

 

I'll get back on you about the given solution.

 

Thanks!

Hey Pholditch,

 

Just getting back to you. The solution did work however not the way you explained. I've changed the regex expression and right now a transaction wil get the name of the custom rule as soon as the regex matches. Not getting back any boolean. This kind of acts as I wanted (sometimes the results still are weird though. Could be the regex).

 

Anyways is there any kind of feature coming in the future for performing regex on http parameters names?

 

Thanks for the solution