Skip to content

Commit

Permalink
API Endpoint Phase 2: Add Endpoint route in RestEasy-3 Framework
Browse files Browse the repository at this point in the history
  • Loading branch information
IshikaDawda committed May 24, 2024
1 parent dd8379f commit bd620dd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.jboss.resteasy.core;

import com.newrelic.api.agent.security.NewRelicSecurity;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import org.jboss.resteasy.spi.HttpRequest;

import java.util.regex.Matcher;

@Weave(originalName = "org.jboss.resteasy.core.registry.MethodExpression")
public abstract class MethodExpression_Instrumentation {
public abstract String getPathExpression();
public void populatePathParams(HttpRequest request, Matcher matcher, String path){
Weaver.callOriginal();
try {
if (NewRelicSecurity.isHookProcessingActive()) {
NewRelicSecurity.getAgent().getSecurityMetaData().getMetaData().setEndpointRoute(getPathExpression());
}
} catch (Exception e) {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void assertMapping(String method, String path, String handler, Applicati

@Trace(dispatcher = true)
private void service() throws IOException {
HttpURLConnection conn = (HttpURLConnection)TestApplication.getEndPoint("customers/getStuff/users").openConnection();
HttpURLConnection conn = (HttpURLConnection)TestApplication.getEndPoint("users/count/9").openConnection();
conn.connect();
conn.getResponseCode();
}
Expand Down

0 comments on commit bd620dd

Please sign in to comment.