- 浏览: 596038 次
- 性别:
- 来自: 厦门
文章分类
- 全部博客 (669)
- oracle (36)
- java (98)
- spring (48)
- UML (2)
- hibernate (10)
- tomcat (7)
- 高性能 (11)
- mysql (25)
- sql (19)
- web (42)
- 数据库设计 (4)
- Nio (6)
- Netty (8)
- Excel (3)
- File (4)
- AOP (1)
- Jetty (1)
- Log4J (4)
- 链表 (1)
- Spring Junit4 (3)
- Autowired Resource (0)
- Jackson (1)
- Javascript (58)
- Spring Cache (2)
- Spring - CXF (2)
- Spring Inject (2)
- 汉字拼音 (3)
- 代理模式 (3)
- Spring事务 (4)
- ActiveMQ (6)
- XML (3)
- Cglib (2)
- Activiti (15)
- 附件问题 (1)
- javaMail (1)
- Thread (19)
- 算法 (6)
- 正则表达式 (3)
- 国际化 (2)
- Json (3)
- EJB (3)
- Struts2 (1)
- Maven (7)
- Mybatis (7)
- Redis (8)
- DWR (1)
- Lucene (2)
- Linux (73)
- 杂谈 (2)
- CSS (13)
- Linux服务篇 (3)
- Kettle (9)
- android (81)
- protocol (2)
- EasyUI (6)
- nginx (2)
- zookeeper (6)
- Hadoop (41)
- cache (7)
- shiro (3)
- HBase (12)
- Hive (8)
- Spark (15)
- Scala (16)
- YARN (3)
- Kafka (5)
- Sqoop (2)
- Pig (3)
- Vue (6)
- sprint boot (19)
- dubbo (2)
- mongodb (2)
最新评论
Jetty是一个用 Java 实现、开源、基于标准的,并且具有丰富功能的 Http 服务器和 Web 容器。Jetty中应用最广泛的一项功能就是可以作为嵌入式Web容器。
1.在开发阶段,可以使用Jetty在Eclipse里直接启动应用,而不是像Tomcat那样繁琐,先把几十兆应用打包,然后再复制到某个目录后再启动。
2.在测试阶段,可以直接在测试用例中启动Jetty,而不是先将应用打包部署到容器。
3.在运行阶段,可以将war包配置成直接能够运行的应用
在web项目中的lib目录下需要加入对应的Jar包否则会报错。
主要的RuntimeServer类
运行类ServerStarter
Jetty配置文件webdefault.xml(它的位置和Java文件放在同一个目录下面)
需要用到两个Jar包
jetty-6.1.25.jar和jetty-util-6.1.25.jar
1.在开发阶段,可以使用Jetty在Eclipse里直接启动应用,而不是像Tomcat那样繁琐,先把几十兆应用打包,然后再复制到某个目录后再启动。
2.在测试阶段,可以直接在测试用例中启动Jetty,而不是先将应用打包部署到容器。
3.在运行阶段,可以将war包配置成直接能够运行的应用
在web项目中的lib目录下需要加入对应的Jar包否则会报错。
主要的RuntimeServer类
package runtime; //import java.io.File; //import javax.management.MBeanServer; //import java.lang.management.ManagementFactory; //import javax.management.MBeanServer; //import java.lang.management.ManagementFactory; import java.util.Properties; import org.mortbay.jetty.Connector; import org.mortbay.jetty.Server; import org.mortbay.jetty.nio.SelectChannelConnector; import org.mortbay.jetty.webapp.WebAppContext; import org.springframework.core.io.ClassPathResource; //import org.mortbay.management.MBeanContainer; //import org.mortbay.thread.BoundedThreadPool; /** * * -Xms256m -Xmx512m -XX:PermSize=256M -XX:MaxPermSize=256M * * @see <url>http://docs.codehaus.org/display/JETTY/Embedding+Jetty</url> * @see $ JETTY_HOME}\examples\embedded\src\main\java\org\mortbay\jetty\example\ * OneWebApp.java * * Using embedded mode for OneWebApp * * <p> * dependencies: jasper-compiler-5.5.15.jar jasper-compiler-jdt-5.5.15.jar * jasper-runtime-5.5.15.jar * * jetty-6.1.7.jar jetty-util-6.1.7.jar * * jsp-api-2.0.jar servlet-api-2.5-6.1.7.jar * * slf4j-api-1.3.1.jar slf4j-simple-1.3.1.jar * * xercesImpl-2.6.2.jar xmlParserAPIs-2.6.2.jar * * * */ public class RuntimeServer { //这个文件在类路径下面 public static final String DB_RESOURCE_PATH = "applicationContext.properties"; private int port = 8000; private String host = "127.0.0.1"; private String propertyPath = DB_RESOURCE_PATH; private String contextPath = "/WebContent"; private String warApp = "WebContent"; /** * * @param propertyPath * @return */ public RuntimeServer propertyPath(String propertyPath) { this.propertyPath = propertyPath; return this; } /** * @param port * the port to set */ public RuntimeServer port(int port) { this.port = port; return this; } /** * @param host * the host to set */ public RuntimeServer host(String host) { this.host = host; return this; } /** * @param warApp * the warApp to set */ public RuntimeServer warApp(String warApp) { this.warApp = warApp; return this; } //Jetty调用的主方法 public void start() throws Exception { long begin = System.nanoTime();// .currentTimeMillis(); //创建Jetty服务器 Server server = new Server(); //为Jetty服务器配置属性 ClassPathResource classPathResource = new ClassPathResource(propertyPath); Properties properties = new Properties(); properties.load(classPathResource.getInputStream()); port = Integer.parseInt(properties.getProperty("http.port")); contextPath = properties.getProperty("http.context.path"); //设置连接 Connector connector = new SelectChannelConnector(); connector.setPort(Integer.getInteger("jetty.port", port).intValue()); server.setConnectors(new Connector[] { connector }); WebAppContext webAppContext = new WebAppContext(warApp, contextPath); //找到对应的Jetty配置文件 这个文件不需要修改 webAppContext.setDefaultsDescriptor("./runtime/webdefault.xml"); server.setHandler(webAppContext); host = (null == connector.getHost() ? host : connector.getHost()); try { server.start(); String url = "http://" + host + ":" + port + contextPath; System.out.println("[Jetty Server started in " + (System.nanoTime() - begin) / 1000 / 1000 / 1000 + "s]: " + url); //server.join(); } catch (Exception e) { e.printStackTrace(); System.exit(100); } } }
运行类ServerStarter
package runtime; public class ServerStarter { public static void main(String[] args) throws Exception { new RuntimeServer().start(); } }
Jetty配置文件webdefault.xml(它的位置和Java文件放在同一个目录下面)
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- ===================================================================== --> <!-- This file contains the default descriptor for web applications. --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- The intent of this descriptor is to include jetty specific or common --> <!-- configuration for all webapps. If a context has a webdefault.xml --> <!-- descriptor, it is applied before the contexts own web.xml file --> <!-- --> <!-- A context may be assigned a default descriptor by: --> <!-- + Calling WebApplicationContext.setDefaultsDescriptor --> <!-- + Passed an arg to addWebApplications --> <!-- --> <!-- This file is used both as the resource within the jetty.jar (which is --> <!-- used as the default if no explicit defaults descriptor is set) and it --> <!-- is copied to the etc directory of the Jetty distro and explicitly --> <!-- by the jetty.xml file. --> <!-- --> <!-- ===================================================================== --> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" metadata-complete="true" version="2.5"> <description> Default web.xml file. This file is applied to a Web application before it's own WEB_INF/web.xml file </description> <!-- ==================================================================== --> <!-- Context params to control Session Cookies --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- UNCOMMENT TO ACTIVATE <context-param> <param-name>org.mortbay.jetty.servlet.SessionDomain</param-name> <param-value>127.0.0.1</param-value> </context-param> <context-param> <param-name>org.mortbay.jetty.servlet.SessionPath</param-name> <param-value>/</param-value> </context-param> <context-param> <param-name>org.mortbay.jetty.servlet.MaxAge</param-name> <param-value>-1</param-value> </context-param> --> <context-param> <param-name>org.mortbay.jetty.webapp.NoTLDJarPattern</param-name> <param-value>start.jar|ant-.*\.jar|dojo-.*\.jar|jetty-.*\.jar|jsp-api-.*\.jar|junit-.*\.jar|servlet-api-.*\.jar|dnsns\.jar|rt\.jar|jsse\.jar|tools\.jar|sunpkcs11\.jar|sunjce_provider\.jar|xerces.*\.jar</param-value> </context-param> <!-- ==================================================================== --> <!-- The default servlet. --> <!-- This servlet, normally mapped to /, provides the handling for static --> <!-- content, OPTIONS and TRACE methods for the context. --> <!-- The following initParameters are supported: --> <!-- --> <!-- acceptRanges If true, range requests and responses are --> <!-- supported --> <!-- --> <!-- dirAllowed If true, directory listings are returned if no --> <!-- welcome file is found. Else 403 Forbidden. --> <!-- --> <!-- redirectWelcome If true, redirect welcome file requests --> <!-- else use request dispatcher forwards --> <!-- --> <!-- gzip If set to true, then static content will be served--> <!-- as gzip content encoded if a matching resource is --> <!-- found ending with ".gz" --> <!-- --> <!-- resoureBase Can be set to replace the context resource base --> <!-- --> <!-- relativeResourceBase --> <!-- Set with a pathname relative to the base of the --> <!-- servlet context root. Useful for only serving --> <!-- static content from only specific subdirectories. --> <!-- --> <!-- useFileMappedBuffer --> <!-- If set to true (the default), a memory mapped --> <!-- file buffer will be used to serve static content --> <!-- when using an NIO connector. Setting this value --> <!-- to false means that a direct buffer will be used --> <!-- instead. If you are having trouble with Windows --> <!-- file locking, set this to false. --> <!-- --> <!-- cacheControl If set, all static content will have this value --> <!-- set as the cache-control header. --> <!-- --> <!-- maxCacheSize Maximum size of the static resource cache --> <!-- --> <!-- maxCachedFileSize Maximum size of any single file in the cache --> <!-- --> <!-- maxCachedFiles Maximum number of files in the cache --> <!-- --> <!-- cacheType "nio", "bio" or "both" to determine the type(s) --> <!-- of resource cache. A bio cached buffer may be used--> <!-- by nio but is not as efficient as a nio buffer. --> <!-- An nio cached buffer may not be used by bio. --> <!-- --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <servlet> <servlet-name>default</servlet-name> <servlet-class>org.mortbay.jetty.servlet.DefaultServlet</servlet-class> <init-param> <param-name>acceptRanges</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>dirAllowed</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>redirectWelcome</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>maxCacheSize</param-name> <param-value>256000000</param-value> </init-param> <init-param> <param-name>maxCachedFileSize</param-name> <param-value>10000000</param-value> </init-param> <init-param> <param-name>maxCachedFiles</param-name> <param-value>1000</param-value> </init-param> <init-param> <param-name>cacheType</param-name> <param-value>both</param-value> </init-param> <init-param> <param-name>gzip</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>useFileMappedBuffer</param-name> <param-value>false</param-value> </init-param> <!-- <init-param> <param-name>cacheControl</param-name> <param-value>max-age=3600,public</param-value> </init-param> --> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!-- ==================================================================== --> <!-- JSP Servlet --> <!-- This is the jasper JSP servlet from the jakarta project --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- The JSP page compiler and execution servlet, which is the mechanism --> <!-- used by Glassfish to support JSP pages. Traditionally, this servlet --> <!-- is mapped to URL patterh "*.jsp". This servlet supports the --> <!-- following initialization parameters (default values are in square --> <!-- brackets): --> <!-- --> <!-- checkInterval If development is false and reloading is true, --> <!-- background compiles are enabled. checkInterval --> <!-- is the time in seconds between checks to see --> <!-- if a JSP page needs to be recompiled. [300] --> <!-- --> <!-- compiler Which compiler Ant should use to compile JSP --> <!-- pages. See the Ant documenation for more --> <!-- information. [javac] --> <!-- --> <!-- classdebuginfo Should the class file be compiled with --> <!-- debugging information? [true] --> <!-- --> <!-- classpath What class path should I use while compiling --> <!-- generated servlets? [Created dynamically --> <!-- based on the current web application] --> <!-- Set to ? to make the container explicitly set --> <!-- this parameter. --> <!-- --> <!-- development Is Jasper used in development mode (will check --> <!-- for JSP modification on every access)? [true] --> <!-- --> <!-- enablePooling Determines whether tag handler pooling is --> <!-- enabled [true] --> <!-- --> <!-- fork Tell Ant to fork compiles of JSP pages so that --> <!-- a separate JVM is used for JSP page compiles --> <!-- from the one Tomcat is running in. [true] --> <!-- --> <!-- ieClassId The class-id value to be sent to Internet --> <!-- Explorer when using <jsp:plugin> tags. --> <!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] --> <!-- --> <!-- javaEncoding Java file encoding to use for generating java --> <!-- source files. [UTF-8] --> <!-- --> <!-- keepgenerated Should we keep the generated Java source code --> <!-- for each page instead of deleting it? [true] --> <!-- --> <!-- logVerbosityLevel The level of detailed messages to be produced --> <!-- by this servlet. Increasing levels cause the --> <!-- generation of more messages. Valid values are --> <!-- FATAL, ERROR, WARNING, INFORMATION, and DEBUG. --> <!-- [WARNING] --> <!-- --> <!-- mappedfile Should we generate static content with one --> <!-- print statement per input line, to ease --> <!-- debugging? [false] --> <!-- --> <!-- --> <!-- reloading Should Jasper check for modified JSPs? [true] --> <!-- --> <!-- suppressSmap Should the generation of SMAP info for JSR45 --> <!-- debugging be suppressed? [false] --> <!-- --> <!-- dumpSmap Should the SMAP info for JSR45 debugging be --> <!-- dumped to a file? [false] --> <!-- False if suppressSmap is true --> <!-- --> <!-- scratchdir What scratch directory should we use when --> <!-- compiling JSP pages? [default work directory --> <!-- for the current web application] --> <!-- --> <!-- tagpoolMaxSize The maximum tag handler pool size [5] --> <!-- --> <!-- xpoweredBy Determines whether X-Powered-By response --> <!-- header is added by generated servlet [false] --> <!-- --> <!-- If you wish to use Jikes to compile JSP pages: --> <!-- Set the init parameter "compiler" to "jikes". Define --> <!-- the property "-Dbuild.compiler.emacs=true" when starting Jetty --> <!-- to cause Jikes to emit error messages in a format compatible with --> <!-- Jasper. --> <!-- If you get an error reporting that jikes can't use UTF-8 encoding, --> <!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <servlet id="jsp"> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> <init-param> <param-name>logVerbosityLevel</param-name> <param-value>DEBUG</param-value> </init-param> <init-param> <param-name>fork</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>xpoweredBy</param-name> <param-value>false</param-value> </init-param> <!-- <init-param> <param-name>classpath</param-name> <param-value>?</param-value> </init-param> --> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jsp</servlet-name> <url-pattern>*.jsp</url-pattern> <url-pattern>*.jspf</url-pattern> <url-pattern>*.jspx</url-pattern> <url-pattern>*.xsp</url-pattern> <url-pattern>*.JSP</url-pattern> <url-pattern>*.JSPF</url-pattern> <url-pattern>*.JSPX</url-pattern> <url-pattern>*.XSP</url-pattern> </servlet-mapping> <!-- ==================================================================== --> <!-- Dynamic Servlet Invoker. --> <!-- This servlet invokes anonymous servlets that have not been defined --> <!-- in the web.xml or by other means. The first element of the pathInfo --> <!-- of a request passed to the envoker is treated as a servlet name for --> <!-- an existing servlet, or as a class name of a new servlet. --> <!-- This servlet is normally mapped to /servlet/* --> <!-- This servlet support the following initParams: --> <!-- --> <!-- nonContextServlets If false, the invoker can only load --> <!-- servlets from the contexts classloader. --> <!-- This is false by default and setting this --> <!-- to true may have security implications. --> <!-- --> <!-- verbose If true, log dynamic loads --> <!-- --> <!-- * All other parameters are copied to the --> <!-- each dynamic servlet as init parameters --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- Uncomment for dynamic invocation <servlet> <servlet-name>invoker</servlet-name> <servlet-class>org.mortbay.jetty.servlet.Invoker</servlet-class> <init-param> <param-name>verbose</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>nonContextServlets</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>dynamicParam</param-name> <param-value>anyValue</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping> --> <!-- ==================================================================== --> <session-config> <session-timeout>30</session-timeout> </session-config> <!-- ==================================================================== --> <!-- Default MIME mappings --> <!-- The default MIME mappings are provided by the mime.properties --> <!-- resource in the org.mortbay.jetty.jar file. Additional or modified --> <!-- mappings may be specified here --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- UNCOMMENT TO ACTIVATE <mime-mapping> <extension>mysuffix</extension> <mime-type>mymime/type</mime-type> </mime-mapping> --> <!-- ==================================================================== --> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <!-- ==================================================================== --> <locale-encoding-mapping-list> <locale-encoding-mapping><locale>ar</locale><encoding>ISO-8859-6</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>be</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>bg</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>ca</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>cs</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>da</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>de</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>el</locale><encoding>ISO-8859-7</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>en</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>es</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>et</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>fi</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>fr</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>hr</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>hu</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>is</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>it</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>iw</locale><encoding>ISO-8859-8</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>ja</locale><encoding>Shift_JIS</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>ko</locale><encoding>EUC-KR</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>lt</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>lv</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>mk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>nl</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>no</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>pl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>pt</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>ro</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>ru</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>sh</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>sk</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>sl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>sq</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>sr</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>sv</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>tr</locale><encoding>ISO-8859-9</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>uk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>zh</locale><encoding>GB2312</encoding></locale-encoding-mapping> <locale-encoding-mapping><locale>zh_TW</locale><encoding>Big5</encoding></locale-encoding-mapping> </locale-encoding-mapping-list> <security-constraint> <web-resource-collection> <web-resource-name>Disable TRACE</web-resource-name> <url-pattern>/</url-pattern> <http-method>TRACE</http-method> </web-resource-collection> <auth-constraint/> </security-constraint> </web-app>
需要用到两个Jar包
jetty-6.1.25.jar和jetty-util-6.1.25.jar
- jetty-6.1.25.jar (526 KB)
- 下载次数: 0
- jetty-util-6.1.25.jar (173 KB)
- 下载次数: 0
发表评论
文章已被作者锁定,不允许评论。
相关推荐
6. **Jetty Eclipse Plugin使用**:熟悉插件的安装和配置过程,学习如何在Eclipse中快速启动Jetty服务器、部署应用、调试Servlet和JSP,以及进行热部署和性能分析。 7. **性能调优**:了解如何通过调整Jetty的配置...
通过上述内容的学习,你将能够熟练地运用Jetty进行Web应用开发,无论是构建独立的服务还是嵌入到其他项目中,Jetty都能提供强大且稳定的支撑。请参考压缩包中的学习资料,逐步探索和掌握这些知识点,提升你的Java ...
此文档是我在学习Jetty过程中总结的Jetty学习笔记
【Jetty入门学习资料】 Jetty是一个轻量级、高性能的开源Servlet容器,它由Java编写,以JAR包形式提供API,便于开发者将其轻松集成到Java应用中。Jetty自1995年创立以来,已被众多知名项目如Apache Geromino、JBoss...
Jetty6 指南书是一本专门针对Jetty 6版本的详尽教程,旨在为读者提供...总的来说,Jetty6指南书是一本全面、深入的Jetty学习资料,无论你是初学者还是经验丰富的开发者,都能从中受益,提升对Jetty的理解和应用能力。
这个压缩包包含Jetty 8版本的实现及其依赖库,是学习和理解Jetty工作原理,尤其是NIO(非阻塞I/O)和Servlet容器实现的宝贵资源。 Jetty 8在设计时特别强调了性能和可扩展性,它使用了Java NIO(New I/O)API来处理...
6. **文档**:包括用户指南、API文档等,供开发者参考学习。 在使用Jetty时,确保你已经安装了正确的JDK版本,并正确配置了`JAVA_HOME`环境变量。解压下载的Jetty发行版后,通过命令行运行相应的启动脚本,就可以...
【Jetty彗星技术(Cometd)及Continuation机制详解】 Jetty是一个高效、轻量级的Java Servlet容器,不仅可作为HTTP服务器,还能作为HTTP客户端。它以其小巧、稳定和高性能的特点受到广泛赞誉,适合企业级应用的需求。...
Jetty是一个轻量级、高性能的HTTP服务器和Servlet容器,完全用Java编写,遵循开放源码和标准。自1995年成立以来,Jetty...通过深入学习和实践,你可以充分利用Jetty的各项特性,提高你的开发效率并优化应用程序的性能。
2. **内嵌Jetty的实现**:学习如何通过Java代码创建并启动一个内嵌的Jetty服务器,这通常涉及导入相关的Jetty库,创建Server对象,配置Connector(如HTTP或HTTPS)和Handler(如WebAppContext)。 3. **Servlet容器...
Jetty服务器是一款轻量级、高性能的Java Web服务器和Servlet容器,被广泛应用于小型到大型的Web应用程序。它以其小巧的体积、高效的性能以及易于集成的特点,在开发和测试环境中尤其受欢迎。下面我们将深入探讨Jetty...
Jetty 6.1.6 是一个开源的、轻量级的Java Web服务器和Servlet容器。这个版本的Jetty发布于较早时期,但它的设计理念和...虽然这个版本相对较旧,但其基本原理和架构对于学习现代Web服务器的工作方式仍具有参考价值。
Jetty是一款轻量级、高性能的Java Web服务器和Servlet容器,它被广泛应用于各种规模的项目,从微型服务器到大型企业级应用。...通过学习和使用Jetty,开发者可以创建高效、灵活且易于维护的Java Web应用程序。
虽然Jetty已经发展到了更高版本,但早期版本的学习资料依然有价值,特别是对于理解Jetty的基础概念和核心原理。 总结来说,Jetty作为一个轻量级的Java Web服务器,因其高效、灵活的特性,在开发和测试环境中广泛...
### Jetty插件安装及使用步骤详解 #### 一、Jetty插件简介 Jetty是一款开源、轻量级的Java应用服务器,广泛应用于开发测试环境。与Tomcat相比,Jetty具有更好的...希望本教程能帮助到正在学习和使用Jetty的开发者们。
源代码下载是获取Jetty开发细节和学习其实现方式的重要途径。你可以通过访问Jetty的官方网站或者使用Git版本控制系统从其官方仓库获取最新的源代码。通常,下载源码的步骤包括: 1. **访问Git仓库**:首先,你需要...
深入学习i-jetty源码有助于理解Web服务器和Servlet容器的工作原理: 1. **Jetty Server**:研究`Server`类,它是整个i-jetty的入口点,负责配置和启动服务器。 2. **Connector**:理解`Connector`接口及其实现,如...
Jetty是一款轻量级、高性能的Java Web服务器和Servlet容器,因其开源、小巧且易于集成的特点,被广泛应用于各种项目中。...在学习过程中,配合源代码示例`testjetty`,动手实践是理解Jetty工作原理的最佳途径。
通过这些基本操作的学习,用户可以迅速掌握Jetty的基础使用方法。 #### 三、Jetty架构 **3.1 架构概述** Jetty采用了模块化的架构设计,主要包括以下几个核心组件: - **Connector**:负责监听网络连接并接收...