[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],null,["# App Engine appengine-web.xml reference\n\n### Region ID\n\nThe \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e is an abbreviated code that Google assigns\nbased on the region you select when you create your app. The code does not\ncorrespond to a country or province, even though some region IDs may appear\nsimilar to commonly used country and province codes. For apps created after\nFebruary 2020, \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e`.r` is included in\nApp Engine URLs. For existing apps created before this date, the\nregion ID is optional in the URL.\n\nLearn more\n[about region IDs](/appengine/docs/legacy/standard/java/how-requests-are-routed#region-id). \nOK\n\nIn addition to the [`web.xml` deployment\ndescriptor](/appengine/docs/legacy/standard/java/config/webxml), App Engine Java\napplications use a configuration file, named `appengine-web.xml`,\nto specify information about your app and to identify which files in the app's\n`WAR` file are static files (like images) and which are resource files used by\nthe application.\n\nExample\n-------\n\nThe following example is a minimal file that specifies the Java 8\nruntime with no static files or resource files: \n\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cappengine-web-app xmlns=\"http://appengine.google.com/ns/1.0\"\u003e\n \u003cthreadsafe\u003etrue\u003c/threadsafe\u003e\n \u003cruntime\u003ejava8\u003c/runtime\u003e\n \u003c/appengine-web-app\u003e\n\nSyntax\n------\n\nAn App Engine Java app must have a file named `appengine-web.xml` in its\nWAR, in the directory `WEB-INF/`. This is an XML file whose root element is\n`\u003cappengine-web-app\u003e`.\n\nYou can find the Document Type Definition and schema specifications for the\n`appengine-web.xml` in the SDK's `docs/` directory.\n| **Note:** The standard `appengine-web.xml` file defines the default service. You will need to specify additional configuration parameters for each non-default service, which were formerly known as modules. These are described in the [overview of\n| App Engine](/appengine/docs/legacy/standard/java/an-overview-of-app-engine). You can also apply these configuration parameters to the default service.\n\n### Scaling elements\n\nThe following table lists the options for defining how you can specify that your\napplication should scale.\n\nFor a comparison of the performance features of the scaling types, see\n[Scaling dynamic instances](/appengine/docs/legacy/standard/java/how-instances-are-managed#scaling_dynamic_instances).\n\n### Staging elements\n\nMuch of the work done during a deployment occurs locally in a preparation step\ncalled *staging*, where JAR files are assembled, JSPs are compiled, and so forth.\nYou can optionally configure certain parts of the staging\nbehavior using staging elements in the application configuration file. Most\napplications will deploy successfully without manually configuring staging\nbehavior. If your app doesn't deploy, you may need to configure staging\nusing the options shown below.\n\n### Staging option defaults\n\nThe defaults for staging options are as follows:\n\n### Include and exclude syntax\n\nPath patterns are specified using zero or more `\u003cinclude\u003e` and\n`\u003cexclude\u003e` elements. In a pattern, `'*'` represents zero or more\nof any character in a file or directory name, and `**` represents zero or more\ndirectories in a path. Files and directories matching `\u003cexclude\u003e`\npatterns will not be uploaded when you deploy your app to App Engine. However,\nthese files and directories will still be accessible to your application when\nrunning on the local Development Server.\n\nAn `\u003cinclude\u003e` element overrides the default behavior of including\nall files. An `\u003cexclude\u003e` element applies after all\n`\u003cinclude\u003e` patterns (as well as the default if no explicit\n`\u003cinclude\u003e` is provided).\n\nThe following example demonstrates how to designate all `.png` files as static\nfiles (except those in the `data/` directory and all of its subdirectories): \n\n \u003cstatic-files\u003e\n \u003cinclude path=\"/**.png\" /\u003e\n \u003cexclude path=\"/data/**.png\" /\u003e\n \u003c/static-files\u003e\n\nYou can also set HTTP headers to use when responding to requests to these static\nresources. \n\n \u003cstatic-files\u003e\n \u003cinclude path=\"/my_static-files\" \u003e\n \u003chttp-header name=\"Access-Control-Allow-Origin\"\n value=\"http://example.org\" /\u003e\n \u003c/include\u003e\n \u003c/static-files\u003e\n\n| **Note:** If the `path` string doesn't start with a slash, then the HTTP headers, if any, work on App Engine but do **not** work on the Development Server.\n\nMIME types for static files\n---------------------------\n\nBy default, static files are served using a MIME type selected based on the\nfilename extension. You can associate custom MIME types with filename\nextensions for static files using `\u003cmime-mapping\u003e` elements in `web.xml`.\n\nURLFetch timeout\n----------------\n\nYou can set a deadline for each\n[URLFetch](/appengine/docs/legacy/standard/java/issue-requests#setting_a_request_timeout) request. By default, the deadline for a fetch is 5 seconds.\nYou can change this default by including the following setting in your\n`appengine-web.xml` configuration file. Specify the timeout in seconds: \n\n \u003csystem-properties\u003e\n \u003cproperty name=\"appengine.api.urlfetch.defaultDeadline\" value=\"10\"/\u003e\n \u003c/system-properties\u003e"]]