Quartz UI ↗
Browse docs
On this page
Private preview · 0.57.0-devView Markdown

QuartzUIResourceScheme: declaration reference

0.57.0-dev · beta source documentation. Native, Blueprint, Editor and rendering examples are source-reviewed, not executed in Unreal during this scan. See validation and limits.

Pinned source (source: Source/QuartzUIRuntime/Public/QuartzUIResourceScheme.h) · integration recipe · practical guide

FQuartzUIResourceRequest

Advanced type. Browser-independent request seam used by policy automation and adapters.

Prerequisites / integration: Installed source plugin; Editor tools additionally require a compiled compatible host Editor target. Use the QuartzUIResourceScheme recipe in the host module QuartzUIRuntime.

Minimal example / lifecycle: FQuartzUIResourceScheme::MakeUrl("gameui", "index.html"). Process-immutable roots; Cancel releases response body.

Avoid: Assuming tested range seam means stock CEF forwards Range headers. Match the exact declaration below; dependent DTOs/enums are values used by this owner, not independent systems.

Exact source line (source: Source/QuartzUIRuntime/Public/QuartzUIResourceScheme.h#L10)

FQuartzUIResourceResponse

Advanced type. Backend-independent result used by the packaged-resource origin and its tests.

Prerequisites / integration: Installed source plugin; Editor tools additionally require a compiled compatible host Editor target. Use the QuartzUIResourceScheme recipe in the host module QuartzUIRuntime.

Minimal example / lifecycle: FQuartzUIResourceScheme::MakeUrl("gameui", "index.html"). Process-immutable roots; Cancel releases response body.

Avoid: Assuming tested range seam means stock CEF forwards Range headers. Match the exact declaration below; dependent DTOs/enums are values used by this owner, not independent systems.

Exact source line (source: Source/QuartzUIRuntime/Public/QuartzUIResourceScheme.h#L20)

FQuartzUIResourceBodyStream

Advanced type. Thread-safe bounded body stream shared by the CEF adapter and automation.

Prerequisites / integration: Installed source plugin; Editor tools additionally require a compiled compatible host Editor target. Use the QuartzUIResourceScheme recipe in the host module QuartzUIRuntime.

Minimal example / lifecycle: FQuartzUIResourceScheme::MakeUrl("gameui", "index.html"). Process-immutable roots; Cancel releases response body.

Avoid: Assuming tested range seam means stock CEF forwards Range headers. Match the exact declaration below; dependent DTOs/enums are values used by this owner, not independent systems.

Exact source line (source: Source/QuartzUIRuntime/Public/QuartzUIResourceScheme.h#L31)

FQuartzUIResourceScheme

Advanced type. Secure project-owned and plugin-fixture resources exposed through intercepted HTTPS origins.

Prerequisites / integration: Installed source plugin; Editor tools additionally require a compiled compatible host Editor target. Use the QuartzUIResourceScheme recipe in the host module QuartzUIRuntime.

Minimal example / lifecycle: FQuartzUIResourceScheme::MakeUrl("gameui", "index.html"). Process-immutable roots; Cancel releases response body.

Avoid: Assuming tested range seam means stock CEF forwards Range headers. Match the exact declaration below; dependent DTOs/enums are values used by this owner, not independent systems.

Exact source line (source: Source/QuartzUIRuntime/Public/QuartzUIResourceScheme.h#L48)

Complete header

Source snapshot, not an additional example. Unreal annotations distinguish exposed Blueprint nodes from native-only/private methods.

#pragma once

#include "CoreMinimal.h"

class IWebBrowserSingleton;
struct FQuartzUIAppDefinition;
class UQuartzUIProjectSettings;

/** Browser-independent request seam used by policy automation and adapters. */
struct QUARTZUIRUNTIME_API FQuartzUIResourceRequest
{
	FString Verb = TEXT("GET");
	FString Url;

	/** Optional RFC 7233 single byte range, for example bytes=0-1023. */
	FString RangeHeader;
};

/** Backend-independent result used by the packaged-resource origin and its tests. */
struct QUARTZUIRUNTIME_API FQuartzUIResourceResponse
{
	int32 StatusCode = 500;
	FString MimeType = TEXT("text/plain");
	FString DiagnosticCode = TEXT("quartzui.resource.internal-error");
	TMap<FString, FString> Headers;
	TArray<uint8> Body;
	int32 ContentLength = 0;
};

/** Thread-safe bounded body stream shared by the CEF adapter and automation. */
class QUARTZUIRUNTIME_API FQuartzUIResourceBodyStream final
{
public:
	void Reset(TArray<uint8>&& InBody);
	bool Read(uint8* OutBytes, int32 BytesToRead, int32& OutBytesRead);
	void Cancel();
	bool IsCanceled() const;
	int32 GetRemainingBytes() const;

private:
	mutable FCriticalSection Mutex;
	TArray<uint8> Body;
	int32 ReadOffset = 0;
	bool bCanceled = false;
};

/** Secure project-owned and plugin-fixture resources exposed through intercepted HTTPS origins. */
class QUARTZUIRUNTIME_API FQuartzUIResourceScheme
{
public:
	static constexpr const TCHAR* Scheme = TEXT("https");
	static constexpr const TCHAR* OriginSuffix = TEXT(".quartzui.test");
	static constexpr const TCHAR* MvpAppId = TEXT("mvp");
	static constexpr const TCHAR* MvpHost = TEXT("mvp.quartzui.test");

	static FString MakeOrigin(const FString& AppId);
	static FString MakeUrl(const FString& AppId, const FString& RelativePath);
	static FString GetMimeType(const FString& RelativePath);

	/** Registers one bounded immutable app origin, owner, root, and entry. */
	static bool RegisterPackagedApp(const FQuartzUIAppDefinition& Definition, FString& OutError);

	/** Validates and registers the default, additional, and loading project apps. */
	static bool RegisterConfiguredProjectApps(FString& OutError);
	static bool RegisterConfiguredProjectApps(
		const UQuartzUIProjectSettings& Settings,
		FString& OutError);

	/** True only for a URL at an exact currently registered packaged-app origin. */
	static bool IsPackagedUrl(const FString& Url);

	/** Resolves a request without browser dependencies so policy is automation-testable. */
	static bool ResolveRequest(const FString& Verb, const FString& Url, FQuartzUIResourceResponse& OutResponse);
	static bool ResolveRequest(const FQuartzUIResourceRequest& Request, FQuartzUIResourceResponse& OutResponse);

	/**
	 * Installs every retained app root into an initialized Epic browser backend.
	 * A fresh Epic singleton rejects scheme factories until its first browser
	 * window initializes CEF, so callers may use a quiet probe before performing
	 * that one-time bootstrap.
	 */
	static bool EnsureRegistered(
		IWebBrowserSingleton& BrowserSingleton,
		bool bLogFailures = true);

	/** Unregisters the factory before Unreal tears down the browser module. */
	static void Shutdown();
};