Create a FetchOptions that allows truncation of the response.
Shorthand for FetchOptions.withDefaults().allowTruncate();.
Please read the FetchOptions class javadoc for an explanation of
how response truncating works.
Create a FetchOptions that disallows truncation of the response.
Shorthand for
FetchOptions.withDefaults().disallowTruncate();.
Please read the FetchOptions class javadoc for an explanation of
how esponse truncating works.
Create a FetchOptions that does not follow redirects.
Shorthand for
FetchOptions.withDefaults().doNotFollowRedirects();.
Please read the FetchOptions class javadoc for an explanation of
how redirection following works.
Create a FetchOptions that does not perform SSL certificate
validation.
Shorthand for
FetchOptions.withDefaults().doNotValidateCertificate();.
Please read the FetchOptions class javadoc for an explanation of
how certificate validation works.
Create a FetchOptions that follows redirects.
Shorthand for
FetchOptions.withDefaults().followRedirects();.
Please read the FetchOptions class javadoc for an explanation of
how redirection following works.
Create a FetchOptions that performs SSL certificate validation.
Shorthand for
FetchOptions.withDefaults().validateCertificate();.
Please read the FetchOptions class javadoc for an explanation of
how certificate validation works.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eFetchOptions.Builder\u003c/code\u003e provides static methods for creating \u003ccode\u003eFetchOptions\u003c/code\u003e instances, which are used to configure URL fetching behavior.\u003c/p\u003e\n"],["\u003cp\u003eYou can create \u003ccode\u003eFetchOptions\u003c/code\u003e that either allow or disallow the truncation of responses using \u003ccode\u003eallowTruncate()\u003c/code\u003e and \u003ccode\u003edisallowTruncate()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003efollowRedirects()\u003c/code\u003e and \u003ccode\u003edoNotFollowRedirects()\u003c/code\u003e methods allow for control over whether or not redirects are followed during the URL fetch.\u003c/p\u003e\n"],["\u003cp\u003eSSL certificate validation can be enabled or disabled using \u003ccode\u003evalidateCertificate()\u003c/code\u003e and \u003ccode\u003edoNotValidateCertificate()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ewithDeadline(double deadline)\u003c/code\u003e creates \u003ccode\u003eFetchOptions\u003c/code\u003e with a specified deadline, while \u003ccode\u003ewithDefaults()\u003c/code\u003e provides an instance with the standard settings.\u003c/p\u003e\n"]]],[],null,["# Class FetchOptions.Builder (2.0.0)\n\n public static final class FetchOptions.Builder\n\nContains static creation methods for [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions). \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e FetchOptions.Builder \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Methods\n--------------\n\n### allowTruncate()\n\n public static FetchOptions allowTruncate()\n\nCreate a [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) that allows truncation of the response.\nShorthand for `FetchOptions.withDefaults().allowTruncate();`.\nPlease read the [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) class javadoc for an explanation of\nhow response truncating works.\n\n### disallowTruncate()\n\n public static FetchOptions disallowTruncate()\n\nCreate a [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) that disallows truncation of the response.\nShorthand for\n`FetchOptions.withDefaults().disallowTruncate();`.\nPlease read the [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) class javadoc for an explanation of\nhow esponse truncating works.\n\n### doNotFollowRedirects()\n\n public static FetchOptions doNotFollowRedirects()\n\nCreate a [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) that does not follow redirects.\nShorthand for\n`FetchOptions.withDefaults().doNotFollowRedirects();`.\nPlease read the [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) class javadoc for an explanation of\nhow redirection following works.\n\n### doNotValidateCertificate()\n\n public static FetchOptions doNotValidateCertificate()\n\nCreate a [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) that does not perform SSL certificate\nvalidation.\n\nShorthand for\n`FetchOptions.withDefaults().doNotValidateCertificate();`.\nPlease read the [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) class javadoc for an explanation of\nhow certificate validation works.\n\n### followRedirects()\n\n public static FetchOptions followRedirects()\n\nCreate a [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) that follows redirects.\nShorthand for\n`FetchOptions.withDefaults().followRedirects();`.\nPlease read the [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) class javadoc for an explanation of\nhow redirection following works.\n\n### validateCertificate()\n\n public static FetchOptions validateCertificate()\n\nCreate a [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) that performs SSL certificate validation.\n\nShorthand for\n`FetchOptions.withDefaults().validateCertificate();`.\nPlease read the [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) class javadoc for an explanation of\nhow certificate validation works.\n\n### withDeadline(double deadline)\n\n public static FetchOptions withDeadline(double deadline)\n\nCreate a [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions) with the specified deadline.\nShorthand for\n`FetchOptions.withDefaults().setDeadline(deadline);`.\n\n### withDefaults()\n\n public static FetchOptions withDefaults()\n\nHelper method for creating a [FetchOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions)\ninstance with default values.\nSee Also: [FetchOptions#DEFAULT_ALLOW_TRUNCATE](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions#com_google_appengine_api_urlfetch_FetchOptions_DEFAULT_ALLOW_TRUNCATE), [FetchOptions#DEFAULT_DEADLINE](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions#com_google_appengine_api_urlfetch_FetchOptions_DEFAULT_DEADLINE), [FetchOptions#DEFAULT_FOLLOW_REDIRECTS](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.FetchOptions#com_google_appengine_api_urlfetch_FetchOptions_DEFAULT_FOLLOW_REDIRECTS)"]]