All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.ableron.springboot.autoconfigure.AbleronProperties Maven / Gradle / Ivy

package io.github.ableron.springboot.autoconfigure;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.unit.DataSize;

import java.time.Duration;
import java.util.List;

@ConfigurationProperties(prefix = "ableron")
public class AbleronProperties {

  /**
   * Whether Ableron UI composition is enabled.
   */
  private boolean enabled = true;

  /**
   * Timeout for requesting fragments.
   */
  private long fragmentRequestTimeoutMillis = Duration.ofSeconds(3).toMillis();

  /**
   * Request headers that are passed to fragment requests if present.
   */
  private List fragmentRequestHeadersToPass = List.of(
    "Accept-Language",
    "Correlation-ID",
    "Forwarded",
    "Referer",
    "User-Agent",
    "X-Correlation-ID",
    "X-Forwarded-For",
    "X-Forwarded-Proto",
    "X-Forwarded-Host",
    "X-Real-IP",
    "X-Request-ID"
  );

  /**
   * Response headers of primary fragments to pass to the page response if present.
   */
  private List primaryFragmentResponseHeadersToPass = List.of(
    "Content-Language",
    "Location",
    "Refresh"
  );

  /**
   * Maximum size in bytes the fragment cache may have.
   */
  private long cacheMaxSizeInBytes = DataSize.ofMegabytes(10).toBytes();

  /**
   * Fragment request headers which influence the requested fragment aside from its URL.
   */
  private List cacheVaryByRequestHeaders = List.of();

  /**
   * Whether to append UI composition stats as HTML comment to the content.
   */
  private boolean statsAppendToContent = false;

  /**
   * Whether to expose fragment URLs in the stats appended to the content.
   */
  private boolean statsExposeFragmentUrl = false;

  public boolean isEnabled() {
    return enabled;
  }

  public void setEnabled(boolean enabled) {
    this.enabled = enabled;
  }

  public long getFragmentRequestTimeoutMillis() {
    return fragmentRequestTimeoutMillis;
  }

  public void setFragmentRequestTimeoutMillis(long fragmentRequestTimeoutMillis) {
    this.fragmentRequestTimeoutMillis = fragmentRequestTimeoutMillis;
  }

  public List getFragmentRequestHeadersToPass() {
    return fragmentRequestHeadersToPass;
  }

  public void setFragmentRequestHeadersToPass(List fragmentRequestHeadersToPass) {
    this.fragmentRequestHeadersToPass = fragmentRequestHeadersToPass;
  }

  public List getPrimaryFragmentResponseHeadersToPass() {
    return primaryFragmentResponseHeadersToPass;
  }

  public void setPrimaryFragmentResponseHeadersToPass(List primaryFragmentResponseHeadersToPass) {
    this.primaryFragmentResponseHeadersToPass = primaryFragmentResponseHeadersToPass;
  }

  public long getCacheMaxSizeInBytes() {
    return cacheMaxSizeInBytes;
  }

  public void setCacheMaxSizeInBytes(long cacheMaxSizeInBytes) {
    this.cacheMaxSizeInBytes = cacheMaxSizeInBytes;
  }

  public List getCacheVaryByRequestHeaders() {
    return cacheVaryByRequestHeaders;
  }

  public void setCacheVaryByRequestHeaders(List cacheVaryByRequestHeaders) {
    this.cacheVaryByRequestHeaders = cacheVaryByRequestHeaders;
  }

  public boolean isStatsAppendToContent() {
    return statsAppendToContent;
  }

  public void setStatsAppendToContent(boolean statsAppendToContent) {
    this.statsAppendToContent = statsAppendToContent;
  }

  public boolean isStatsExposeFragmentUrl() {
    return statsExposeFragmentUrl;
  }

  public void setStatsExposeFragmentUrl(boolean statsExposeFragmentUrl) {
    this.statsExposeFragmentUrl = statsExposeFragmentUrl;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy