当前位置: 首页 > news >正文

牛商网做的网站国外网站404错误页

牛商网做的网站,国外网站404错误页,wordpress 论坛模版,html模板语法当我开发Web应用程序时#xff0c;我希望能够从Eclipse快速启动它们#xff0c;而不必依赖各种重量级的tomcat或glassfish插件。 因此#xff0c;我通常要做的只是创建一个可以直接从Eclipse运行的基于Java的简单启动器。 该启动器会在几秒钟内启动#xff0c;因此使开发工… 当我开发Web应用程序时我希望能够从Eclipse快速启动它们而不必依赖各种重量级的tomcat或glassfish插件。 因此我通常要做的只是创建一个可以直接从Eclipse运行的基于Java的简单启动器。 该启动器会在几秒钟内启动因此使开发工作更加愉快。 但是有时正确设置所有内容会有些困难。 因此在本文中我将向您快速概述如何将Jetty与Weld for CDI和Vaadin一起设置为Web框架。 为了正确设置所有内容我们需要执行以下步骤 为所需的依赖项设置Maven Pom 创建一个基于Java的Jetty启动器 设置web.xml 添加焊接占位符 为所需的依赖项设置Maven Pom 我使用以下pom.xml文件。 例如如果您不使用自定义组件则可能不需要所有东西。 但是它应该作为其中应该包含的内容的良好参考。 ?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/modelVersiongroupIdgroup.id/groupIdartifactIdartifact.id/artifactIdpackagingwar/packagingversion1.0/versionnameVaadin Web Application/namepropertiesproject.build.sourceEncodingUTF-8/project.build.sourceEncodingvaadin.version6.7.1/vaadin.versiongwt.version2.3.0/gwt.versiongwt.plugin.version2.2.0/gwt.plugin.version/propertiesbuildpluginsplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-compiler-plugin/artifactIdconfigurationsource1.5/sourcetarget1.5/target/configuration/pluginplugingroupIdorg.codehaus.mojo/groupIdartifactIdgwt-maven-plugin/artifactIdversion${gwt.plugin.version}/versionconfigurationwebappDirectory${project.build.directory}/${project.build.finalName}/VAADIN/widgetsets/webappDirectoryextraJvmArgs-Xmx512M -Xss1024k/extraJvmArgsrunTargetcvgenerator-web/runTargethostedWebapp${project.build.directory}/${project.build.finalName}/hostedWebappnoServertrue/noServerport8080/portcompileReportfalse/compileReport/configurationexecutionsexecutiongoalsgoalresources/goalgoalcompile/goal/goals/execution/executionsdependenciesdependencygroupIdcom.google.gwt/groupIdartifactIdgwt-dev/artifactIdversion${gwt.version}/version/dependencydependencygroupIdcom.google.gwt/groupIdartifactIdgwt-user/artifactIdversion${gwt.version}/version/dependency/dependencies/pluginplugingroupIdcom.vaadin/groupIdartifactIdvaadin-maven-plugin/artifactIdversion1.0.2/versionexecutionsexecutionconfiguration/configurationgoalsgoalupdate-widgetset/goal/goals/execution/executions/plugin/plugins/build!-- extra repositories for Vaadin extensions --repositoriesrepositoryidvaadin-snapshots/idurlhttp://oss.sonatype.org/content/repositories/vaadin-snapshots//urlreleasesenabledfalse/enabled/releasessnapshotsenabledtrue/enabled/snapshots/repositoryrepositoryidvaadin-addons/idurlhttp://maven.vaadin.com/vaadin-addons/url/repository/repositories!-- repositories for the plugins --pluginRepositoriespluginRepositoryidcodehaus-snapshots/idurlhttp://nexus.codehaus.org/snapshots/urlsnapshotsenabledtrue/enabled/snapshotsreleasesenabledfalse/enabled/releases/pluginRepositorypluginRepositoryidvaadin-snapshots/idurlhttp://oss.sonatype.org/content/repositories/vaadin-snapshots//urlsnapshotsenabledtrue/enabled/snapshotsreleasesenabledfalse/enabled/releases/pluginRepository/pluginRepositories!-- minimal set of dependencies --dependenciesdependencygroupIdcom.vaadin/groupIdartifactIdvaadin/artifactIdversion${vaadin.version}/version/dependencydependencygroupIdorg.vaadin.addons/groupIdartifactIdstepper/artifactIdversion1.1.0/version/dependency!-- the jetty version well use --dependencygroupIdorg.eclipse.jetty.aggregate/groupIdartifactIdjetty-all-server/artifactIdversion8.0.4.v20111024/versiontypejar/typescopecompile/scopeexclusionsexclusionartifactIdmail/artifactIdgroupIdjavax.mail/groupId/exclusion/exclusions/dependency!-- vaadin custom field addon --dependencygroupIdorg.vaadin.addons/groupIdartifactIdcustomfield/artifactIdversion0.9.3/version/dependency!-- with cdi utils plugin you can use Weld --dependencygroupIdorg.vaadin.addons/groupIdartifactIdcdi-utils/artifactIdversion0.8.6/version/dependency!-- well use this version of Weld --dependencygroupIdorg.jboss.weld.servlet/groupIdartifactIdweld-servlet/artifactIdversion1.1.5.Final/versiontypejar/typescopecompile/scope/dependency!-- normally following are provided, but not if you run within jetty --dependencygroupIdjavax.servlet/groupIdartifactIdservlet-api/artifactIdversion2.5/versiontypejar/typescopeprovided/scope/dependencydependencygroupIdjavax.servlet.jsp/groupIdartifactIdjsp-api/artifactIdversion2.2/versiontypejar/typescopeprovided/scope/dependencydependencyartifactIdel-api/artifactIdgroupIdjavax.el/groupIdversion2.2/versionscopeprovided/scope/dependency/dependencies/project 创建Java启动器 有了这个pom我们就有了一起运行JettyVaadin和Weld所需的所有依赖项。 让我们看一下Jetty Launcher。 import javax.naming.InitialContext; import javax.naming.Reference;import org.eclipse.jetty.plus.jndi.Resource; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.webapp.WebAppContext;/*** Simple jetty launcher, which launches the webapplication from the local* resources and reuses the projects classpath.* * author jos*/ public class Launcher {/** run under root context */private static String contextPath /;/** location where resources should be provided from for VAADIN resources */private static String resourceBase src/main/webapp;/** port to listen on */private static int httpPort 8081;private static String[] __dftConfigurationClasses {org.eclipse.jetty.webapp.WebInfConfiguration,org.eclipse.jetty.webapp.WebXmlConfiguration,org.eclipse.jetty.webapp.MetaInfConfiguration, org.eclipse.jetty.webapp.FragmentConfiguration, org.eclipse.jetty.plus.webapp.EnvConfiguration,org.eclipse.jetty.webapp.JettyWebXmlConfiguration} ;/*** Start the server, and keep waiting.*/public static void main(String[] args) throws Exception {System.setProperty(java.naming.factory.url,org.eclipse.jetty.jndi);System.setProperty(java.naming.factory.initial,org.eclipse.jetty.jndi.InitialContextFactory);InitialContext ctx new InitialContext();ctx.createSubcontext(java:comp);Server server new Server(httpPort);WebAppContext webapp new WebAppContext();webapp.setConfigurationClasses(__dftConfigurationClasses);webapp.setDescriptor(src/main/webapp/WEB-INF/web.xml);webapp.setContextPath(contextPath);webapp.setResourceBase(resourceBase);webapp.setClassLoader(Thread.currentThread().getContextClassLoader());server.setHandler(webapp);server.start();new Resource(BeanManager, new Reference(javax.enterprise.inject.spi.BeanMnanager,org.jboss.weld.resources.ManagerObjectFactory, null));server.join();} } 此代码将启动一个Jetty服务器该服务器使用项目中的web.xml来启动Vaadin Web应用程序。 请注意我们明确使用 setConfigurationClasses 操作。 这是确保我们具有可用于注册Weld beanmanager的JNDI上下文所必需的。 设置web.xml 接下来我们看一下web.xml。 接下来显示我在此示例中使用的一个 ?xml version1.0 encodingUTF-8? web-app xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlnshttp://java.sun.com/xml/ns/javaee xmlns:webhttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsdxsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsdidWebApp_ID version2.5display-nameVaadin Web Application/display-namecontext-paramdescriptionVaadin production mode/descriptionparam-nameproductionMode/param-nameparam-valuefalse/param-value/context-paramservletservlet-nameexample/servlet-nameservlet-classServletSpecifiedByTheCDIVaadinPlugin/servlet-classinit-paramdescriptionVaadin application class to start/descriptionparam-nameapplication/param-nameparam-valueVaadinApplicationClassName/param-value/init-paraminit-paramparam-namewidgetset/param-nameparam-valuecustomwidgetsetnameifyouuseit/param-value/init-param/servletservlet-mappingservlet-nameexample/servlet-nameurl-pattern/example/*/url-pattern/servlet-mappingwelcome-file-listwelcome-fileindex.html/welcome-file/welcome-file-listlistenerlistener-classorg.jboss.weld.environment.servlet.Listener/listener-class/listenerresource-env-refdescriptionObject factory for the CDI Bean Manager/descriptionresource-env-ref-nameBeanManager/resource-env-ref-nameresource-env-ref-typejavax.enterprise.inject.spi.BeanManager/resource-env-ref-type/resource-env-ref /web-app 在web.xml的底部您可以看到我们为Weld定义的resource-env和所需的侦听器以确保启动Weld并注入了bean。 您还可以看到我们指定了一个不同的servlet名称而不是普通的Vaadin servlet。 有关此内容的详细信息请参见CDI插件页面 https : //vaadin.com/directory#addon/cdi-utils 主要步骤是从该页面获取 在WEB-INF目录下将空bean.xml -fileCDI标记文件添加到您的项目中 将cdiutils * .jar添加到WEB-INF / lib下的项目中 通过扩展AbstractCdiApplication创建您的Application类 扩展AbstractCdiApplicationServlet并使用WebServleturlPatterns “ / *”对其进行注释 部署到与JavaEE / Web配置文件兼容的容器CDI应用程序也可以在servlet容器等上运行但需要进行一些进一步的配置 添加焊接占位符 至此我们已经拥有所有依赖项我们创建了可直接从Eclipse使用的启动器并确保在启动时加载了Weld。 我们还为Vaadin配置了CDI插件。 至此我们差不多完成了。 我们只需要在我们要包含在Weld的bean发现中的位置添加空bean.xml文件。 ?xml version1.0 encodingUTF-8? beans xmlnshttp://java.sun.com/xml/ns/javaeexmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd /beans 我必须将这些添加到 src / main / java / META-INF 图书馆和 网络信息 Weld的目录以拾取所有带注释的bean。 就是这样。 现在您可以启动启动器并且应该看到出现了所有的Weld和Vaadin日志记录。 参考来自JCG合作伙伴的 Embedded JettyVaadin和Weld   Smart Java博客中的Jos Dirksen。 翻译自: https://www.javacodegeeks.com/2012/02/embedded-jetty-vaadin-and-weld.html
http://www.huolong8.cn/news/284134/

相关文章:

  • 上海广告公司网站制作郑州网站推广招聘
  • 建设部网站信息系统重庆建设银行官方网站首页
  • 天津做网站排名虾米音乐 wordpress
  • 网站建设公司推荐万维科技东莞微信网站建设推荐
  • 全球优秀企业网站福田蒙派克e质量怎么样
  • 高端网站建设 来磐石网络兰州app定制
  • 网站建设作品wordpress 禁止删除分类
  • 哪些购物网站做的比较简洁有品质数码印花图案设计网站
  • 小网站链接怎么找win8网站模版
  • 国外做的好的网站网站颜色搭配
  • 青岛企业建站系统模板网站域名如何查询
  • 网站特色栏目重要性设计网页价格
  • 您的网站对百度设置了ua封禁z怎么解决wordpress熊掌号提交
  • 武城县建设局网站上海的公司地址有哪些
  • 网站开发建设一般多少钱wordpress文章在新窗口打开
  • 钢铁网站建设初衷wordpress标签栏
  • 渭南自建站网站建设网站建设报价 下载
  • 移动网站怎么做的网站开发工程师swot分析
  • 企划做网站网站建设台州
  • 做自媒体挣钱的网站有哪些wordpress登录页面空白
  • 做网站属于什么备案桓台做网站
  • 建设网站上传代码谷歌云 搭建wordpress
  • 网站建设毕业设计开题ppt注册公司注册资金要实缴吗
  • 进入江苏省住房和城乡建设厅网站怎么做谷歌收录的网站
  • 贵州小城镇建设网站南山出名的互联网公司
  • 临沂在线上网站建设建立网站培训讲义
  • wordpress本地建站列车营销网站怎么做
  • 建手机号码的网站网站5建设需要学什么
  • 体育建设网站龙华网站建设的基本步骤
  • 网站大全软件网站开发如何做下载支付