招聘网站简历数据分析怎么做,市场调研报告模板ppt,学影视后期去哪培训好,网络软文范例app mvc框架前段时间#xff0c;我写了一篇关于如何使用Spring MVC实现Restful Web API的文章 。 阅读我以前的文章以了解它。 在那篇文章中#xff0c;它开发了一个简单的Rest示例。 为了测试该应用程序#xff0c;将文件复制到Web服务器#xff08;例如Tomcat #xff0… app mvc框架 前段时间我写了一篇关于如何使用Spring MVC实现Restful Web API的文章 。 阅读我以前的文章以了解它。 在那篇文章中它开发了一个简单的Rest示例。 为了测试该应用程序将文件复制到Web服务器例如Tomcat 中然后返回访问字符1的http// localhost8080 / RestServer / characters / 1信息。 在当前文章中我将解释如何将应用程序转换为Google App Engine并使用Maven部署到Google的基础架构中。 当然在这种情况下我们将部署Rest Spring MVC应用程序但是可以使用相同的方法将Spring MVC Web应用程序或使用其他Web框架开发的任何其他应用程序迁移到GAE。 首先显然您应该创建一个Google帐户并注册一个新的应用程序 请记住名称因为它将在下一步中使用。 之后您可以开始迁移。 需要进行三个更改创建定义应用程序名称的appengine-web.xml 使用Google帐户信息将服务器标签添加到settings.xml并修改pom.xml以添加GAE插件及其依赖项。 让我们从appengine-web.xml开始。 GAE使用此文件来配置应用程序并将其创建到WEB-INF目录与web.xml处于同一级别。 ?xml version1.0 encodingutf-8?
appengine-web-app xmlnshttp://appengine.google.com/ns/1.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocationhttp://appengine.google.com/ns/1.0 http://googleappengine.googlecode.com/svn/branches/1.2.1/java/docs/appengine-web.xsdapplicationalexsotoblog/applicationversion1/versionsystem-propertiesproperty namejava.util.logging.config.file valueWEB-INF/classes/logging.properties//system-propertiesprecompilation-enabledfalse/precompilation-enabledsessions-enabledtrue/sessions-enabled
/appengine-web-app 最重要的字段是应用程序标签。 此标记包含我们应用程序的名称在您注册新的Google应用程序时定义。 其他标记包括版本系统属性和环境变量以及其他配置例如您是否希望预编译以提高性能或应用程序需要会话。 而且您的项目不再需要修改现在仅Maven文件将被触摸。 在settings.xml中 应该添加帐户信息 settings xmlnshttp://maven.apache.org/SETTINGS/1.1.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsdlocalRepository/media/share/maven_repo/localRepositoryserversserveridappengine.google.com/idusernamemy_accountgmail.com/usernamepasswordmy_password/password/server/servers/settings 看到这和在Maven中注册任何其他服务器一样容易。 最后是最繁琐的部分修改pom.xml 。 首先要添加新属性 gae.home/media/share/maven_repo/com/google/appengine/appengine-java-sdk/1.5.5/appengine-java-sdk-1.5.5/gae.home
gaeApplicationNamealexsotoblog/gaeApplicationName
gaePluginVersion0.9.0/gaePluginVersion
gae.version1.5.5/gae.version!-- Upload to http://test.latest.applicationName.appspot.com by default --
gae.application.versiontest/gae.application.version 在第一行我们定义Appengine Java SDK的位置。 如果已经安装则在此标记中插入位置如果没有请复制此pom的相同位置然后将maven存储库目录在我的情况下为/ media / share / maven_repo更改为您的目录。 通常您的Maven存储库位置将是/home/user/.m2/repositories 。 Maven将在部署时为您下载SDK 。 下一步是添加Maven GAE存储库。 repositoriesrepositoryidmaven-gae-plugin-repo/idurlhttp://maven-gae-plugin.googlecode.com/svn/repository/urlnamemaven-gae-plugin repository/name/repository
/repositoriespluginRepositoriespluginRepositoryidmaven-gae-plugin-repo/idnameMaven Google App Engine Repository/nameurlhttp://maven-gae-plugin.googlecode.com/svn/repository//url/pluginRepository
/pluginRepositories 因为我们的项目是虚拟项目 所以不使用Datanucleus 。 对于更复杂的项目需要使用例如JDO来访问数据库应添加下一个依赖项 dependencygroupIdjavax.jdo/groupIdartifactIdjdo2-api/artifactIdversion2.3-eb/versionexclusionsexclusiongroupIdjavax.transaction/groupIdartifactIdtransaction-api/artifactId/exclusion/exclusions
/dependencydependencygroupIdcom.google.appengine.orm/groupIdartifactIddatanucleus-appengine/artifactIdversion1.0.6.final/version
/dependencydependencygroupIdorg.datanucleus/groupIdartifactIddatanucleus-core/artifactIdversion1.1.5/versionscoperuntime/scopeexclusionsexclusiongroupIdjavax.transaction/groupIdartifactIdtransaction-api/artifactId/exclusion/exclusions
/dependencydependencygroupIdcom.google.appengine/groupIdartifactIdgeronimo-jta_1.1_spec/artifactIdversion1.1.1/versionscoperuntime/scope
/dependencydependencygroupIdcom.google.appengine/groupIdartifactIdgeronimo-jpa_3.0_spec/artifactIdversion1.1.1/versionscoperuntime/scope
/dependency 如果您使用的是Datanucleus 则应注册maven-datanucleus-plugin 。 请注意根据您的项目正确配置它。 plugingroupIdorg.datanucleus/groupIdartifactIdmaven-datanucleus-plugin/artifactIdversion1.1.4/versionconfiguration!--Make sure this path contains your persistentclasses!--mappingIncludes**/model/*.class/mappingIncludesverbosetrue/verboseenhancerNameASM/enhancerNameapiJDO/api/configurationexecutionsexecutionphasecompile/phasegoalsgoalenhance/goal/goals/execution/executionsdependenciesdependencygroupIdorg.datanucleus/groupIdartifactIddatanucleus-core/artifactIdversion1.1.5/versionexclusionsexclusiongroupIdjavax.transaction/groupIdartifactIdtransaction-api/artifactId/exclusion/exclusions/dependencydependencygroupIdorg.datanucleus/groupIdartifactIddatanucleus-rdbms/artifactIdversion1.1.5/version/dependencydependencygroupIdorg.datanucleus/groupIdartifactIddatanucleus-enhancer/artifactIdversion1.1.5/version/dependency/dependencies
/plugin 现在添加了Google App Engine依赖项。 dependencygroupIdcom.google.appengine/groupIdartifactIdappengine-api-1.0-sdk/artifactIdversion${gae.version}/version
/dependencydependencygroupIdcom.google.appengine/groupIdartifactIdappengine-tools-api/artifactIdversion1.3.7/version
/dependency 然后如果您想测试GAE 功能 在我们的虚拟项目中未使用则添加下一个GAE库 dependencygroupIdcom.google.appengine/groupIdartifactIdappengine-api-labs/artifactIdversion${gae.version}/versionscopetest/scope
/dependencydependencygroupIdcom.google.appengine/groupIdartifactIdappengine-api-stubs/artifactIdversion${gae.version}/versionscopetest/scope
/dependencydependencygroupIdcom.google.appengine/groupIdartifactIdappengine-testing/artifactIdversion${gae.version}/versionscopetest/scope
/dependency 接下来的更改是对maven-war-plugin的修改其中将appengine-web.xml包含到生成的包中 plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-war-plugin/artifactIdconfigurationwebResourcesresourcedirectorysrc/main/webapp/directoryfilteringtrue/filteringincludesinclude**/appengine-web.xml/include/includes/resource/webResources/configuration
/plugin 最后添加maven-gae-plugin并将其配置为将应用程序上传到appspot 。 plugingroupIdnet.kindleit/groupIdartifactIdmaven-gae-plugin/artifactIdversion${gaePluginVersion}/versionconfigurationserverIdappengine.google.com/serverId/configurationdependenciesdependencygroupIdnet.kindleit/groupIdartifactIdgae-runtime/artifactIdversion${gae.version}/versiontypepom/type/dependency/dependencies
/plugin 看到serviceId标记包含先前在settings.xml文件中定义的服务器名称。 另外如果您使用的是maven-release-plugin 则可以在releaseperform目标期间将应用程序自动上传到appspot plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-release-plugin/artifactIdversion2.2.1/versionconfigurationgoalsgae:deploy/goals/configuration
/plugin 现在运行gaedeploy目标。 如果您已经安装了Appengine Java SDK 那么您的应用程序将被上传到您的GAE网站。 但是如果这是您第一次运行该插件则会收到错误消息。 不要惊慌发生此错误是因为Maven插件未在您在gae.home标记中指定的目录中找到Appengine SDK 。 但是如果您已将gae.home位置配置到本地Maven存储库中只需运行gaeunpack目标即可正确安装SDK 因此当您重新运行gaedeploy时您的应用程序将上传到Google基础架构中。 在后例子中你可以去http://alexsotoblog.appspot.com/characters/1http://alexsotoblog.appspot.com/characters/1和JSON格式的字符信息显示到浏览器中。 正如我在文章开头所指出的相同的过程可以用于任何Web应用程序而不仅仅是Spring Rest MVC 。 由于教学目的对应用程序pom进行了所有修改。 我的建议是您要使用GAE相关标签创建父pom 因此必须上传到Google App Engine的每个项目都来自同一pom文件。 我希望您发现这篇文章有用。 本周我在devoxx 在那与我见面我将在17日星期四13:00发表有关通过聚合和最小化加速Javascript和CSS下载时间的演讲 。 完整的pom文件 ?xml version1.0 encodingUTF-8?
project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsdmodelVersion4.0.0/modelVersiongroupIdorg.springframework/groupIdartifactIdrest/artifactIdnameRest/namepackagingwar/packagingversion1.0.0-BUILD-SNAPSHOT/versionpropertiesjava-version1.6/java-versionorg.springframework-version3.0.4.RELEASE/org.springframework-versionorg.aspectj-version1.6.9/org.aspectj-versionorg.slf4j-version1.5.10/org.slf4j-version!-- Specify AppEngine version for your project. It should match SDK version pointed to by ${gae.home} property (Typically, one used by your Eclipse plug-in) --gae.home/home/alex/.m2/repository/com/google/appengine/appengine-java-sdk/1.5.5/appengine-java-sdk-1.5.5/gae.homegaeApplicationNamealexsotoblog/gaeApplicationNamegaePluginVersion0.9.0/gaePluginVersiongae.version1.5.5/gae.version!-- Upload to http://test.latest.applicationName.appspot.com by default --gae.application.versiontest/gae.application.version/propertiesdependencies!-- Rest --dependencygroupIdcom.sun.xml.bind/groupIdartifactIdjaxb-impl/artifactIdversion2.2.4-1/version/dependencydependencygroupIdorg.codehaus.jackson/groupIdartifactIdjackson-core-lgpl/artifactIdversion1.8.5/version/dependencydependencygroupIdorg.codehaus.jackson/groupIdartifactIdjackson-mapper-lgpl/artifactIdversion1.8.5/version/dependency!-- GAE libraries for local testing as described here: http://code.google.com/appengine/docs/java/howto/unittesting.html --dependencygroupIdcom.google.appengine/groupIdartifactIdappengine-api-labs/artifactIdversion${gae.version}/versionscopetest/scope/dependencydependencygroupIdcom.google.appengine/groupIdartifactIdappengine-api-stubs/artifactIdversion${gae.version}/versionscopetest/scope/dependencydependencygroupIdcom.google.appengine/groupIdartifactIdappengine-testing/artifactIdversion${gae.version}/versionscopetest/scope/dependencydependencygroupIdcom.google.appengine/groupIdartifactIdappengine-api-1.0-sdk/artifactIdversion${gae.version}/version/dependencydependencygroupIdcom.google.appengine/groupIdartifactIdappengine-tools-api/artifactIdversion1.3.7/version/dependency!-- Spring --dependencygroupIdorg.springframework/groupIdartifactIdspring-context/artifactIdversion${org.springframework-version}/versionexclusions!-- Exclude Commons Logging in favor of SLF4j --exclusiongroupIdcommons-logging/groupIdartifactIdcommons-logging/artifactId/exclusion/exclusions/dependencydependencygroupIdorg.springframework/groupIdartifactIdspring-webmvc/artifactIdversion${org.springframework-version}/version/dependencydependencygroupIdorg.springframework/groupIdartifactIdspring-oxm/artifactIdversion${org.springframework-version}/version/dependency!-- AspectJ --dependencygroupIdorg.aspectj/groupIdartifactIdaspectjrt/artifactIdversion${org.aspectj-version}/version/dependency!-- Logging --dependencygroupIdorg.slf4j/groupIdartifactIdslf4j-api/artifactIdversion${org.slf4j-version}/version/dependencydependencygroupIdorg.slf4j/groupIdartifactIdjcl-over-slf4j/artifactIdversion${org.slf4j-version}/versionscoperuntime/scope/dependencydependencygroupIdorg.slf4j/groupIdartifactIdslf4j-log4j12/artifactIdversion${org.slf4j-version}/versionscoperuntime/scope/dependencydependencygroupIdlog4j/groupIdartifactIdlog4j/artifactIdversion1.2.15/versionexclusionsexclusiongroupIdjavax.mail/groupIdartifactIdmail/artifactId/exclusionexclusiongroupIdjavax.jms/groupIdartifactIdjms/artifactId/exclusionexclusiongroupIdcom.sun.jdmk/groupIdartifactIdjmxtools/artifactId/exclusionexclusiongroupIdcom.sun.jmx/groupIdartifactIdjmxri/artifactId/exclusion/exclusionsscoperuntime/scope/dependency!-- Inject --dependencygroupIdjavax.inject/groupIdartifactIdjavax.inject/artifactIdversion1/version/dependency!-- Servlet --dependencygroupIdjavax.servlet/groupIdartifactIdservlet-api/artifactIdversion2.5/versionscopeprovided/scope/dependencydependencygroupIdjavax.servlet.jsp/groupIdartifactIdjsp-api/artifactIdversion2.1/versionscopeprovided/scope/dependencydependencygroupIdjavax.servlet/groupIdartifactIdjstl/artifactIdversion1.2/version/dependency!-- Test --dependencygroupIdjunit/groupIdartifactIdjunit/artifactIdversion4.7/versionscopetest/scope/dependency/dependenciesrepositories!-- For testing against latest Spring snapshots --repositoryidorg.springframework.maven.snapshot/idnameSpring Maven Snapshot Repository/nameurlhttp://maven.springframework.org/snapshot/urlreleasesenabledfalse/enabled/releasessnapshotsenabledtrue/enabled/snapshots/repository!-- For developing against latest Spring milestones --repositoryidorg.springframework.maven.milestone/idnameSpring Maven Milestone Repository/nameurlhttp://maven.springframework.org/milestone/urlsnapshotsenabledfalse/enabled/snapshots/repository!-- GAE repositories --repositoryidmaven-gae-plugin-repo/idurlhttp://maven-gae-plugin.googlecode.com/svn/repository/urlnamemaven-gae-plugin repository/name/repository/repositoriespluginRepositoriespluginRepositoryidmaven-gae-plugin-repo/idnameMaven Google App Engine Repository/nameurlhttp://maven-gae-plugin.googlecode.com/svn/repository//url/pluginRepository/pluginRepositoriesbuildpluginsplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-compiler-plugin/artifactIdconfigurationsource${java-version}/sourcetarget${java-version}/target/configuration/plugin!-- Adding appengine-web into war --plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-war-plugin/artifactIdconfigurationwebResourcesresourcedirectorysrc/main/webapp/directoryfilteringtrue/filteringincludesinclude**/appengine-web.xml/include/includes/resource/webResourceswarNameabc/warName/configuration/pluginplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-dependency-plugin/artifactIdexecutionsexecutionidinstall/idphaseinstall/phasegoalsgoalsources/goal/goals/execution/executions/pluginplugingroupIdorg.codehaus.mojo/groupIdartifactIdaspectj-maven-plugin/artifactId!-- Have to use version 1.2 since version 1.3 does not appear to work with ITDs --version1.2/versiondependencies!-- You must use Maven 2.0.9 or above or these are ignored (see MNG-2972) --dependencygroupIdorg.aspectj/groupIdartifactIdaspectjrt/artifactIdversion${org.aspectj-version}/version/dependencydependencygroupIdorg.aspectj/groupIdartifactIdaspectjtools/artifactIdversion${org.aspectj-version}/version/dependency/dependenciesexecutionsexecutiongoalsgoalcompile/goalgoaltest-compile/goal/goals/execution/executionsconfigurationoutxmltrue/outxmlsource${java-version}/sourcetarget${java-version}/target/configuration/pluginplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-surefire-plugin/artifactIdconfigurationjunitArtifactNamejunit:junit/junitArtifactName/configuration/pluginplugingroupIdorg.codehaus.mojo/groupIdartifactIdtomcat-maven-plugin/artifactIdversion1.0-beta-1/version/plugin!-- The actual maven-gae-plugin. Type mvn gae:run to run project, mvn gae:deploy to upload to GAE. --plugingroupIdnet.kindleit/groupIdartifactIdmaven-gae-plugin/artifactIdversion${gaePluginVersion}/versionconfigurationserverIdappengine.google.com/serverId/configurationdependenciesdependencygroupIdnet.kindleit/groupIdartifactIdgae-runtime/artifactIdversion${gae.version}/versiontypepom/type/dependency/dependencies/plugin/plugins/build
/project 下载代码。 音乐 http //www.youtube.com/watchv Nba3Tr_GLZU 参考来自JCG合作伙伴 Alex Soto 在Google App Engine上的Spring MVC和REST来自One Jar To Rule All All博客。 相关文章 使用Spring MVC开发Restful Web服务 Spring MVC开发–快速教程 jqGridRESTAJAX和Spring MVC集成 使用Spring 3.1和基于Java的配置构建RESTful Web服务第2部分 Spring MVC3 Hibernate CRUD示例应用程序 Google AppEngineGAE中的多租户 翻译自: https://www.javacodegeeks.com/2011/12/spring-mvc-and-rest-at-google-app.htmlapp mvc框架