Quarkus Java
/pixel.gif 요청에 빈 GIF로 응답하는 Quarkus용 Java 스니펫입니다. GIF는 시작할 때 한 번만 디코딩합니다.
Quarkus Java
package org.acme;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Response;
import java.util.Base64;
@Path("/pixel.gif")
public class PixelResource {
private static final byte[] GIF = Base64.getDecoder().decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
@GET
@Produces("image/gif")
public Response pixel() {
return Response.ok(GIF).header("Cache-Control", "no-store").build();
}
}
이 스니펫은 실행해 보고, 반환된 바이트를 비교했습니다.
확인
curl -sI http://localhost:8080/pixel.gif