diff --git a/http-api/src/main/java/io/avaje/http/api/SupressLogging.java b/http-api/src/main/java/io/avaje/http/api/SupressLogging.java new file mode 100644 index 000000000..8741e1e57 --- /dev/null +++ b/http-api/src/main/java/io/avaje/http/api/SupressLogging.java @@ -0,0 +1,32 @@ +package io.avaje.http.api; + +import static java.lang.annotation.RetentionPolicy.SOURCE; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * For this client request suppress payload logging. + * + *
Used when the payload contains sensitive content and the request and response content should + * be suppressed. + * + *
{@code
+ * @Client
+ * interface CustomerApi {
+ * ...
+ * @Get("/{id}")
+ * @SupressLogging
+ * Customer getById(long id);
+ *
+ * @Post
+ * @SupressLogging
+ * long save(Customer customer);
+ * }
+ *
+ * }
+ */
+@Retention(SOURCE)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface SupressLogging {}
diff --git a/http-generator-client/src/main/java/io/avaje/http/generator/client/ClientMethodWriter.java b/http-generator-client/src/main/java/io/avaje/http/generator/client/ClientMethodWriter.java
index 2e89bcf9b..2184a82d4 100644
--- a/http-generator-client/src/main/java/io/avaje/http/generator/client/ClientMethodWriter.java
+++ b/http-generator-client/src/main/java/io/avaje/http/generator/client/ClientMethodWriter.java
@@ -18,6 +18,7 @@
import javax.lang.model.type.TypeKind;
import javax.lang.model.util.ElementFilter;
+import io.avaje.http.api.SupressLogging;
import io.avaje.http.generator.core.APContext;
import io.avaje.http.generator.core.Append;
import io.avaje.http.generator.core.BeanParamReader;
@@ -31,13 +32,14 @@
import io.avaje.http.generator.core.RequestTimeoutPrism;
import io.avaje.http.generator.core.Util;
import io.avaje.http.generator.core.WebMethod;
+import io.avaje.prism.GeneratePrism;
import io.avaje.prism.GenerateUtils;
-import io.avaje.http.generator.client.UType;
/**
* Write code to register Web route for a given controller method.
*/
@GenerateUtils
+@GeneratePrism(SupressLogging.class)
final class ClientMethodWriter {
private static final KnownResponse KNOWN_RESPONSE = new KnownResponse();
private static final String BODY_HANDLER = "java.net.http.HttpResponse.BodyHandler";
@@ -59,6 +61,7 @@ final class ClientMethodWriter {
private final Map