Class StaticFilesHandler.Builder (2.14.0)

publicstaticfinalclass StaticFilesHandler.BuilderextendsGeneratedMessageV3.Builder<StaticFilesHandler.Builder>implementsStaticFilesHandlerOrBuilder

Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them.

Protobuf type google.appengine.v1.StaticFilesHandler

Inherited Members

com.google.protobuf.GeneratedMessageV3.Builder.getUnknownFieldSetBuilder()
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int)
com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int)
com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder)

Static Methods

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

publicStaticFilesHandler.BuilderaddRepeatedField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
StaticFilesHandler.Builder
Overrides

build()

publicStaticFilesHandlerbuild()
Returns
Type Description
StaticFilesHandler

buildPartial()

publicStaticFilesHandlerbuildPartial()
Returns
Type Description
StaticFilesHandler

clear()

publicStaticFilesHandler.Builderclear()
Returns
Type Description
StaticFilesHandler.Builder
Overrides

clearApplicationReadable()

publicStaticFilesHandler.BuilderclearApplicationReadable()

Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas.

bool application_readable = 7;

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

clearExpiration()

publicStaticFilesHandler.BuilderclearExpiration()

Time a static file served by this handler should be cached by web proxies and browsers.

.google.protobuf.Duration expiration = 5;

Returns
Type Description
StaticFilesHandler.Builder

clearField(Descriptors.FieldDescriptor field)

publicStaticFilesHandler.BuilderclearField(Descriptors.FieldDescriptorfield)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
StaticFilesHandler.Builder
Overrides

clearHttpHeaders()

publicStaticFilesHandler.BuilderclearHttpHeaders()
Returns
Type Description
StaticFilesHandler.Builder

clearMimeType()

publicStaticFilesHandler.BuilderclearMimeType()

MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension.

string mime_type = 4;

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

publicStaticFilesHandler.BuilderclearOneof(Descriptors.OneofDescriptoroneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
StaticFilesHandler.Builder
Overrides

clearPath()

publicStaticFilesHandler.BuilderclearPath()

Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern.

string path = 1;

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

clearRequireMatchingFile()

publicStaticFilesHandler.BuilderclearRequireMatchingFile()

Whether this handler should match the request if the file referenced by the handler does not exist.

bool require_matching_file = 6;

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

clearUploadPathRegex()

publicStaticFilesHandler.BuilderclearUploadPathRegex()

Regular expression that matches the file paths for all files that should be referenced by this handler.

string upload_path_regex = 2;

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

clone()

publicStaticFilesHandler.Builderclone()
Returns
Type Description
StaticFilesHandler.Builder
Overrides

containsHttpHeaders(String key)

publicbooleancontainsHttpHeaders(Stringkey)

HTTP headers to use for all responses from these URLs.

map<string, string> http_headers = 3;

Parameter
Name Description
key String
Returns
Type Description
boolean

getApplicationReadable()

publicbooleangetApplicationReadable()

Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas.

bool application_readable = 7;

Returns
Type Description
boolean

The applicationReadable.

getDefaultInstanceForType()

publicStaticFilesHandlergetDefaultInstanceForType()
Returns
Type Description
StaticFilesHandler

getDescriptorForType()

publicDescriptors.DescriptorgetDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getExpiration()

publicDurationgetExpiration()

Time a static file served by this handler should be cached by web proxies and browsers.

.google.protobuf.Duration expiration = 5;

Returns
Type Description
Duration

The expiration.

getExpirationBuilder()

publicDuration.BuildergetExpirationBuilder()

Time a static file served by this handler should be cached by web proxies and browsers.

.google.protobuf.Duration expiration = 5;

Returns
Type Description
Builder

getExpirationOrBuilder()

publicDurationOrBuildergetExpirationOrBuilder()

Time a static file served by this handler should be cached by web proxies and browsers.

.google.protobuf.Duration expiration = 5;

Returns
Type Description
DurationOrBuilder

getHttpHeaders()

publicMap<String,String>getHttpHeaders()

Use #getHttpHeadersMap() instead.

Returns
Type Description
Map<String,String>

getHttpHeadersCount()

publicintgetHttpHeadersCount()

HTTP headers to use for all responses from these URLs.

map<string, string> http_headers = 3;

Returns
Type Description
int

getHttpHeadersMap()

publicMap<String,String>getHttpHeadersMap()

HTTP headers to use for all responses from these URLs.

map<string, string> http_headers = 3;

Returns
Type Description
Map<String,String>

getHttpHeadersOrDefault(String key, String defaultValue)

publicStringgetHttpHeadersOrDefault(Stringkey,StringdefaultValue)

HTTP headers to use for all responses from these URLs.

map<string, string> http_headers = 3;

Parameters
Name Description
key String
defaultValue String
Returns
Type Description
String

getHttpHeadersOrThrow(String key)

publicStringgetHttpHeadersOrThrow(Stringkey)

HTTP headers to use for all responses from these URLs.

map<string, string> http_headers = 3;

Parameter
Name Description
key String
Returns
Type Description
String

getMimeType()

publicStringgetMimeType()

MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension.

string mime_type = 4;

Returns
Type Description
String

The mimeType.

getMimeTypeBytes()

publicByteStringgetMimeTypeBytes()

MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension.

string mime_type = 4;

Returns
Type Description
ByteString

The bytes for mimeType.

getMutableHttpHeaders()

publicMap<String,String>getMutableHttpHeaders()

Use alternate mutation accessors instead.

Returns
Type Description
Map<String,String>

getPath()

publicStringgetPath()

Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern.

string path = 1;

Returns
Type Description
String

The path.

getPathBytes()

publicByteStringgetPathBytes()

Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern.

string path = 1;

Returns
Type Description
ByteString

The bytes for path.

getRequireMatchingFile()

publicbooleangetRequireMatchingFile()

Whether this handler should match the request if the file referenced by the handler does not exist.

bool require_matching_file = 6;

Returns
Type Description
boolean

The requireMatchingFile.

getUploadPathRegex()

publicStringgetUploadPathRegex()

Regular expression that matches the file paths for all files that should be referenced by this handler.

string upload_path_regex = 2;

Returns
Type Description
String

The uploadPathRegex.

getUploadPathRegexBytes()

publicByteStringgetUploadPathRegexBytes()

Regular expression that matches the file paths for all files that should be referenced by this handler.

string upload_path_regex = 2;

Returns
Type Description
ByteString

The bytes for uploadPathRegex.

hasExpiration()

publicbooleanhasExpiration()

Time a static file served by this handler should be cached by web proxies and browsers.

.google.protobuf.Duration expiration = 5;

Returns
Type Description
boolean

Whether the expiration field is set.

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

internalGetMapField(int number)

protectedMapFieldinternalGetMapField(intnumber)
Parameter
Name Description
number int
Returns
Type Description
MapField
Overrides

internalGetMutableMapField(int number)

protectedMapFieldinternalGetMutableMapField(intnumber)
Parameter
Name Description
number int
Returns
Type Description
MapField
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

mergeExpiration(Duration value)

publicStaticFilesHandler.BuildermergeExpiration(Durationvalue)

Time a static file served by this handler should be cached by web proxies and browsers.

.google.protobuf.Duration expiration = 5;

Parameter
Name Description
value Duration
Returns
Type Description
StaticFilesHandler.Builder

mergeFrom(StaticFilesHandler other)

publicStaticFilesHandler.BuildermergeFrom(StaticFilesHandlerother)
Parameter
Name Description
other StaticFilesHandler
Returns
Type Description
StaticFilesHandler.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicStaticFilesHandler.BuildermergeFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
StaticFilesHandler.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

publicStaticFilesHandler.BuildermergeFrom(Messageother)
Parameter
Name Description
other Message
Returns
Type Description
StaticFilesHandler.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

publicfinalStaticFilesHandler.BuildermergeUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
StaticFilesHandler.Builder
Overrides

putAllHttpHeaders(Map<String,String> values)

publicStaticFilesHandler.BuilderputAllHttpHeaders(Map<String,String>values)

HTTP headers to use for all responses from these URLs.

map<string, string> http_headers = 3;

Parameter
Name Description
values Map<String,String>
Returns
Type Description
StaticFilesHandler.Builder

putHttpHeaders(String key, String value)

publicStaticFilesHandler.BuilderputHttpHeaders(Stringkey,Stringvalue)

HTTP headers to use for all responses from these URLs.

map<string, string> http_headers = 3;

Parameters
Name Description
key String
value String
Returns
Type Description
StaticFilesHandler.Builder

removeHttpHeaders(String key)

publicStaticFilesHandler.BuilderremoveHttpHeaders(Stringkey)

HTTP headers to use for all responses from these URLs.

map<string, string> http_headers = 3;

Parameter
Name Description
key String
Returns
Type Description
StaticFilesHandler.Builder

setApplicationReadable(boolean value)

publicStaticFilesHandler.BuildersetApplicationReadable(booleanvalue)

Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas.

bool application_readable = 7;

Parameter
Name Description
value boolean

The applicationReadable to set.

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

setExpiration(Duration value)

publicStaticFilesHandler.BuildersetExpiration(Durationvalue)

Time a static file served by this handler should be cached by web proxies and browsers.

.google.protobuf.Duration expiration = 5;

Parameter
Name Description
value Duration
Returns
Type Description
StaticFilesHandler.Builder

setExpiration(Duration.Builder builderForValue)

publicStaticFilesHandler.BuildersetExpiration(Duration.BuilderbuilderForValue)

Time a static file served by this handler should be cached by web proxies and browsers.

.google.protobuf.Duration expiration = 5;

Parameter
Name Description
builderForValue Builder
Returns
Type Description
StaticFilesHandler.Builder

setField(Descriptors.FieldDescriptor field, Object value)

publicStaticFilesHandler.BuildersetField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
StaticFilesHandler.Builder
Overrides

setMimeType(String value)

publicStaticFilesHandler.BuildersetMimeType(Stringvalue)

MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension.

string mime_type = 4;

Parameter
Name Description
value String

The mimeType to set.

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

setMimeTypeBytes(ByteString value)

publicStaticFilesHandler.BuildersetMimeTypeBytes(ByteStringvalue)

MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension.

string mime_type = 4;

Parameter
Name Description
value ByteString

The bytes for mimeType to set.

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

setPath(String value)

publicStaticFilesHandler.BuildersetPath(Stringvalue)

Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern.

string path = 1;

Parameter
Name Description
value String

The path to set.

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

setPathBytes(ByteString value)

publicStaticFilesHandler.BuildersetPathBytes(ByteStringvalue)

Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern.

string path = 1;

Parameter
Name Description
value ByteString

The bytes for path to set.

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

publicStaticFilesHandler.BuildersetRepeatedField(Descriptors.FieldDescriptorfield,intindex,Objectvalue)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
StaticFilesHandler.Builder
Overrides

setRequireMatchingFile(boolean value)

publicStaticFilesHandler.BuildersetRequireMatchingFile(booleanvalue)

Whether this handler should match the request if the file referenced by the handler does not exist.

bool require_matching_file = 6;

Parameter
Name Description
value boolean

The requireMatchingFile to set.

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

publicfinalStaticFilesHandler.BuildersetUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
StaticFilesHandler.Builder
Overrides

setUploadPathRegex(String value)

publicStaticFilesHandler.BuildersetUploadPathRegex(Stringvalue)

Regular expression that matches the file paths for all files that should be referenced by this handler.

string upload_path_regex = 2;

Parameter
Name Description
value String

The uploadPathRegex to set.

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

setUploadPathRegexBytes(ByteString value)

publicStaticFilesHandler.BuildersetUploadPathRegexBytes(ByteStringvalue)

Regular expression that matches the file paths for all files that should be referenced by this handler.

string upload_path_regex = 2;

Parameter
Name Description
value ByteString

The bytes for uploadPathRegex to set.

Returns
Type Description
StaticFilesHandler.Builder

This builder for chaining.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.