com.appland.appmap.process.hooks.HttpClientRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of appmap-agent Show documentation
Show all versions of appmap-agent Show documentation
Inspect and record the execution of Java for use with App Land
package com.appland.appmap.process.hooks;
import com.appland.appmap.output.v1.Event;
import com.appland.appmap.record.Recorder;
import com.appland.appmap.transform.annotations.Unique;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
@Unique("http_client_request")
public class HttpClientRequest {
private static final Recorder recorder = Recorder.getInstance();
// @HookClass(value = "java.net.HttpURLConnection")
public static void connect(Event event, HttpURLConnection httpURLConnection) {
//TODO: ReflectiveType can be used with HttpURLConnection
URL url = httpURLConnection.getURL();
event.setHttpClientRequest(httpURLConnection.getRequestMethod(), url.getHost(), url.getProtocol());
recorder.add(event);
}
// @CallbackOn(MethodEvent.METHOD_RETURN)
// @HookClass(value = "java.net.HttpURLConnection")
public static void connect(Event event, HttpURLConnection httpURLConnection, Object ret) throws IOException {
event.setHttpClientResponse(httpURLConnection.getResponseCode(), httpURLConnection.getContentType());
recorder.add(event);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy