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

io.vertx.mutiny.ext.web.handler.StaticHandler Maven / Gradle / Ivy

There is a newer version: 3.18.0
Show newest version
package io.vertx.mutiny.ext.web.handler;

import java.util.Map;
import java.util.stream.Collectors;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;
import io.smallrye.mutiny.vertx.TypeArg;
import io.vertx.codegen.annotations.Fluent;
import io.smallrye.common.annotation.CheckReturnValue;
import java.util.List;
import io.vertx.ext.web.handler.FileSystemAccess;
import io.vertx.ext.web.Http2PushMapping;
import java.util.Set;
import io.vertx.core.Handler;

/**
 * A handler for serving static resources from the file system or classpath.
 *
 * 

* NOTE: This class has been automatically generated from the {@link io.vertx.ext.web.handler.StaticHandler original} non Mutiny-ified interface using Vert.x codegen. */ @io.smallrye.mutiny.vertx.MutinyGen(io.vertx.ext.web.handler.StaticHandler.class) public class StaticHandler implements io.vertx.core.Handler, java.util.function.Consumer { public static final io.smallrye.mutiny.vertx.TypeArg __TYPE_ARG = new io.smallrye.mutiny.vertx.TypeArg<>( obj -> new StaticHandler((io.vertx.ext.web.handler.StaticHandler) obj), StaticHandler::getDelegate ); private final io.vertx.ext.web.handler.StaticHandler delegate; public StaticHandler(io.vertx.ext.web.handler.StaticHandler delegate) { this.delegate = delegate; } public StaticHandler(Object delegate) { this.delegate = (io.vertx.ext.web.handler.StaticHandler)delegate; } /** * Empty constructor used by CDI, do not use this constructor directly. **/ StaticHandler() { this.delegate = null; } public io.vertx.ext.web.handler.StaticHandler getDelegate() { return delegate; } @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; StaticHandler that = (StaticHandler) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public void handle(io.vertx.mutiny.ext.web.RoutingContext arg0) { delegate.handle(arg0.getDelegate()); } /** * @return the handler */ public static io.vertx.mutiny.ext.web.handler.StaticHandler create() { io.vertx.mutiny.ext.web.handler.StaticHandler ret = io.vertx.mutiny.ext.web.handler.StaticHandler.newInstance((io.vertx.ext.web.handler.StaticHandler)io.vertx.ext.web.handler.StaticHandler.create()); return ret; } /** * @param root the web-root * @return the handler */ public static io.vertx.mutiny.ext.web.handler.StaticHandler create(String root) { io.vertx.mutiny.ext.web.handler.StaticHandler ret = io.vertx.mutiny.ext.web.handler.StaticHandler.newInstance((io.vertx.ext.web.handler.StaticHandler)io.vertx.ext.web.handler.StaticHandler.create(root)); return ret; } /** * @param handlerVisibility CWD or file system root * @param root the web-root * @return the handler */ public static io.vertx.mutiny.ext.web.handler.StaticHandler create(io.vertx.ext.web.handler.FileSystemAccess handlerVisibility, String root) { io.vertx.mutiny.ext.web.handler.StaticHandler ret = io.vertx.mutiny.ext.web.handler.StaticHandler.newInstance((io.vertx.ext.web.handler.StaticHandler)io.vertx.ext.web.handler.StaticHandler.create(handlerVisibility, root)); return ret; } /** * @param allowRootFileSystemAccess whether root access is allowed * @return a reference to this, so the API can be used fluently * @deprecated */ @Deprecated @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess) { delegate.setAllowRootFileSystemAccess(allowRootFileSystemAccess); return this; } /** * @param webRoot the web root * @return a reference to this, so the API can be used fluently * @deprecated */ @Deprecated @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setWebRoot(String webRoot) { delegate.setWebRoot(webRoot); return this; } /** * @param readOnly whether files are read-only * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setFilesReadOnly(boolean readOnly) { delegate.setFilesReadOnly(readOnly); return this; } /** * @param maxAgeSeconds maximum time for browser to cache, in seconds * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setMaxAgeSeconds(long maxAgeSeconds) { delegate.setMaxAgeSeconds(maxAgeSeconds); return this; } /** * @param enabled true if enabled * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setCachingEnabled(boolean enabled) { delegate.setCachingEnabled(enabled); return this; } /** * @param directoryListing true if enabled * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setDirectoryListing(boolean directoryListing) { delegate.setDirectoryListing(directoryListing); return this; } /** * @param includeHidden true if hidden files should be served * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setIncludeHidden(boolean includeHidden) { delegate.setIncludeHidden(includeHidden); return this; } /** * @param timeout the timeout, in ms * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setCacheEntryTimeout(long timeout) { delegate.setCacheEntryTimeout(timeout); return this; } /** * @param indexPage the index page * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setIndexPage(String indexPage) { delegate.setIndexPage(indexPage); return this; } /** * @param maxCacheSize the max cache size * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setMaxCacheSize(int maxCacheSize) { delegate.setMaxCacheSize(maxCacheSize); return this; } /** * @param http2PushMappings the mapping for http2 push * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setHttp2PushMapping(List http2PushMappings) { delegate.setHttp2PushMapping(http2PushMappings); return this; } /** * @param mediaTypes the set of mime types that are already compressed * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler skipCompressionForMediaTypes(Set mediaTypes) { delegate.skipCompressionForMediaTypes(mediaTypes); return this; } /** * @param fileSuffixes the set of file suffixes that are already compressed * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler skipCompressionForSuffixes(Set fileSuffixes) { delegate.skipCompressionForSuffixes(fileSuffixes); return this; } /** * @param alwaysAsyncFS true for always async FS access * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setAlwaysAsyncFS(boolean alwaysAsyncFS) { delegate.setAlwaysAsyncFS(alwaysAsyncFS); return this; } /** * @param enableFSTuning true to enabled FS tuning * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setEnableFSTuning(boolean enableFSTuning) { delegate.setEnableFSTuning(enableFSTuning); return this; } /** * @param maxAvgServeTimeNanoSeconds max serve time, in ns * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds) { delegate.setMaxAvgServeTimeNs(maxAvgServeTimeNanoSeconds); return this; } /** * @param directoryTemplate the directory template * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setDirectoryTemplate(String directoryTemplate) { delegate.setDirectoryTemplate(directoryTemplate); return this; } /** * @param enableRangeSupport true to enable range support * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setEnableRangeSupport(boolean enableRangeSupport) { delegate.setEnableRangeSupport(enableRangeSupport); return this; } /** * @param varyHeader true to sent vary header * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setSendVaryHeader(boolean varyHeader) { delegate.setSendVaryHeader(varyHeader); return this; } /** * @param contentEncoding the desired content encoding e.g.: "UTF-8" * @return a reference to this, so the API can be used fluently */ @Fluent public io.vertx.mutiny.ext.web.handler.StaticHandler setDefaultContentEncoding(String contentEncoding) { delegate.setDefaultContentEncoding(contentEncoding); return this; } /** * Default value of the web-root, where files are served from */ public static final String DEFAULT_WEB_ROOT = io.vertx.ext.web.handler.StaticHandler.DEFAULT_WEB_ROOT; /** * Default value of whether files are read -only and never will be updated */ public static final boolean DEFAULT_FILES_READ_ONLY = io.vertx.ext.web.handler.StaticHandler.DEFAULT_FILES_READ_ONLY; /** * Default max age for cache headers */ public static final long DEFAULT_MAX_AGE_SECONDS = io.vertx.ext.web.handler.StaticHandler.DEFAULT_MAX_AGE_SECONDS; /** * Default of whether cache header handling is enabled */ public static final boolean DEFAULT_CACHING_ENABLED = io.vertx.ext.web.handler.StaticHandler.DEFAULT_CACHING_ENABLED; /** * Default of whether directory listing is enabled */ public static final boolean DEFAULT_DIRECTORY_LISTING = io.vertx.ext.web.handler.StaticHandler.DEFAULT_DIRECTORY_LISTING; /** * Default template file to use for directory listing */ public static final String DEFAULT_DIRECTORY_TEMPLATE = io.vertx.ext.web.handler.StaticHandler.DEFAULT_DIRECTORY_TEMPLATE; /** * Default of whether hidden files can be served */ public static final boolean DEFAULT_INCLUDE_HIDDEN = io.vertx.ext.web.handler.StaticHandler.DEFAULT_INCLUDE_HIDDEN; /** * Default cache entry timeout, when caching */ public static final long DEFAULT_CACHE_ENTRY_TIMEOUT = io.vertx.ext.web.handler.StaticHandler.DEFAULT_CACHE_ENTRY_TIMEOUT; /** * The default index page */ public static final String DEFAULT_INDEX_PAGE = io.vertx.ext.web.handler.StaticHandler.DEFAULT_INDEX_PAGE; /** * The default max cache size */ public static final int DEFAULT_MAX_CACHE_SIZE = io.vertx.ext.web.handler.StaticHandler.DEFAULT_MAX_CACHE_SIZE; /** * Default of whether async filesystem access should always be used */ public static final boolean DEFAULT_ALWAYS_ASYNC_FS = io.vertx.ext.web.handler.StaticHandler.DEFAULT_ALWAYS_ASYNC_FS; /** * Default of whether fs async/sync tuning should be used */ public static final boolean DEFAULT_ENABLE_FS_TUNING = io.vertx.ext.web.handler.StaticHandler.DEFAULT_ENABLE_FS_TUNING; /** * Default max avg serve time, in ns, over which serving will be considered slow */ public static final long DEFAULT_MAX_AVG_SERVE_TIME_NS = io.vertx.ext.web.handler.StaticHandler.DEFAULT_MAX_AVG_SERVE_TIME_NS; /** * Default of whether Range request handling support should be used */ public static final boolean DEFAULT_RANGE_SUPPORT = io.vertx.ext.web.handler.StaticHandler.DEFAULT_RANGE_SUPPORT; /** * Default of whether access to the root of the file system should be allowed or * just allow from the current working * directory. */ public static final boolean DEFAULT_ROOT_FILESYSTEM_ACCESS = io.vertx.ext.web.handler.StaticHandler.DEFAULT_ROOT_FILESYSTEM_ACCESS; /** * Default of whether vary header should be sent. */ public static final boolean DEFAULT_SEND_VARY_HEADER = io.vertx.ext.web.handler.StaticHandler.DEFAULT_SEND_VARY_HEADER; public void accept(io.vertx.mutiny.ext.web.RoutingContext item) { handle(item); } public static StaticHandler newInstance(io.vertx.ext.web.handler.StaticHandler arg) { return arg != null ? new StaticHandler(arg) : null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy