PackHttpServer

public final class PackHttpServer implements AutoCloseable

Minimal HTTP server that serves:

  • The pack zip itself on <pathPrefix>, with the headers Geyser needs (Content-Type: application/zip + accurate Content-Length). If the pack file is absent, this route 404s — relevant when self-hosting hasn't produced a pack yet on a fresh backend.
  • Additional file-serving routes registered via registerFileRoute after start — used by the backend to expose its Bedrock-conversion outputs (/bedrock.zip, /mappings.json) for the proxy to pull. These routes read the file fresh on every request, support If-Modified-Since so unchanged files return 304, and 404 cleanly when the file is absent.
Bound on 0.0.0.0:port. Callers supply the externally-reachable host name when constructing the URL via urlOn. Geyser fetches the URL itself on the proxy JVM and serves bytes onward to Bedrock clients via the Bedrock protocol — so plain HTTP works here even for Bedrock. See https://github.com/GeyserMC/Geyser/blob/master/core/src/main/java/org/geysermc/geyser/pack/url/GeyserUrlPackCodec.java

Types

Link copied to clipboard
public final class FileRouteDescriptor extends Record
A per-request file descriptor.

Properties

Link copied to clipboard
public final static String BEDROCK_PACK_PATH
Link copied to clipboard
public final static String EXECUTABLE_UPDATE_AUTH_CHALLENGE
Link copied to clipboard
public final static String EXECUTABLE_UPDATE_PATH
Link copied to clipboard
public final static String EXECUTABLE_UPDATE_TOKEN_DOMAIN
Link copied to clipboard
public final static String GEYSER_MAPPINGS_PATH

Functions

Link copied to clipboard
public void close()
Link copied to clipboard
public int port()
Link copied to clipboard
public void registerFileRoute(String path, File file, String contentType)
Register an additional route that serves a single file from disk.
public void registerFileRoute(String path, Supplier<PackHttpServer.FileRouteDescriptor> descriptorSupplier, String contentType)
Register a dynamic route whose publisher can provide its existing SHA-1.
Link copied to clipboard
public void registerProtectedExecutableRoute(String path, Supplier<File> fileSupplier, Supplier<String> networkKeySupplier)
Registers a dynamically resolved executable JAR route protected by a capability-specific bearer token derived from the RSPM network key.
Link copied to clipboard
public static PackHttpServer start(File packFile, int port, String pathPrefix)
Compatibility overload for callers that publish one fixed file.
public static PackHttpServer start(Supplier<File> packFileSupplier, int port, String pathPrefix)
Bind and start.
Link copied to clipboard
public static PackHttpServer startWithDescriptor(Supplier<PackHttpServer.FileRouteDescriptor> packDescriptorSupplier, int port, String pathPrefix)
Starts the primary pack route with a producer-owned digest descriptor.
Link copied to clipboard
public String urlOn(String publicHost)
External URL for clients.