- 浏览: 103515 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
chifanbua:
我基本上在iteye上很少留言的 不过你的这个写的确实不错 用 ...
Oracle decode函数说明 -
shaoxuexue86:
谢谢啊
RMI 开发步骤 -
huxiaojun_198213:
RMIRegistHelper只是负责注册远程对象,与客户端所 ...
RMI 开发步骤 -
shaoxuexue86:
请问客户端程序ClientTest 与 RMIRegistHe ...
RMI 开发步骤 -
huxiaojun_198213:
本章节可能有一些细节方面翻译得不是很好,有出入的地方,还请各 ...
RMI动态类加载
尽管etc/jetty.xml设置了合理的缺省值,但为了满足你的实际需要,你仍然可以定制Jetty.Jetty的配置文件结构如下:
configure.dtd内容如下:
Jetty配置文件分解
Doctype(必需)
在jetty.xml中声明的所有标签和元素必须符合configure.dtd的规范。
Server(必需)
org.mortbay.jetty.Server是Jetty HTTP服务器的主类。当运行服务器时,这是第一个被调用的实例。它用于整合连接器(Connectors,HTTP请求接收者)和请求处理器(request Handlers).server本身是一个处理器(handler)和线程池(TreadPool).连接器使用线程池的方法来运行任务,这些任务最后将调用处理方法。
Connectors(必需)
实现了org.mortbay.jetty.Connector接口的类为HTTP协议提供连接器。在其配置中,你可以设置Jetty用于监听连接请求的端口。
Handlers(必需)
处理器用于处理接收到的请求。org.mortbay.jetty.webapp.WebAppContext专门用于服务web应用程序。如果不想完全成熟的应用程序,而只是想处理静态内容和一些servlets,那么你可以使用ContextHandler和配置只需要的服务。server的handlers列表可通过下面的调用来定义:
ThreadPool(可选)
线程池可以确保线程在运行方法退出后被线程池重用,从而避免线程创建时带来的开销。配置如下:
Security Realm(可选)
安全域用于用户认证和授权,安全域中可配置的数量和安全域的类型对于服务器来是没有限制的。下面的示例使用etc/realm.properties文件设置安全域:
示例:
所有的示例都假设是在$JETTY_HOME下,并且下面的所有配置文件都以$JETTY_HOME/etc/myjetty.xml保存。
静态部署1
启动:
View your webapplications at http://localhost:8080/webappfolder/. If you have no webapp defined for the root context ("/"), visiting http://localhost:8080/ will give you a normal 404 page.
静态部署2
As before, start up Jetty with this command:
View your webapplications at http://localhost:8080/webappfolder/.
Other than the extra configuration settings, the biggest change is the addition of the org.mortbay.jetty.handler.DefaultHandler, which deals with unhandled requests in the server. If you have no webapps defined in the root context ("/"), visiting http://localhost:8080/ will 404, but will present a list of contexts that have been deployed on the server. DefaultHandler also serves up a Jetty favicon.
For more details about configuring static deployment, see WebAppDeployer.
Hot Deployment of Customized Contexts
In addition to deploying webapps at start-up, you can also do hot deployment: configure a context deployer which scans a specific directory for XML configuration files, and deploys/redeploys/undeploys a webapp if its configuration file has been modified, added, or removed. These configuration files also allow you to configure certain Jetty-specific per-context settings; configuration file and its format is specific to Jetty. To keep things short, I am not going to reproduce the entire configuration. Add this block to either of the previous examples:
That sets up a ContextDeployer, which will scan the $JETTY_HOME/contexts folder every 5 seconds for changes to the XML descriptors, and hot deploy as necessary. For more details, see ContextDeployer.
File Server, One Handler
Simple HTTP file server with one handler, similar to the embedded FileServer example and embedded OneHandler example. This example serves up purely static files from your current directory:
Note that ResourceHandler does not allow directory listing; if you visit a directory with no welcome files, you will get a 403 Forbidden error message. Try the exact path to the file.
If you just want a specific context to serve static content, while still serving dynamic web applications from other contexts, configure your server to allow hot deployment (see previous example), then set up a context to serve up Static Content.
File Server, Multiple Handlers
Simple HTTP file server with request logging. Similar to the embedded FileServer example and embedded ManyHandlers example
Similar to the one handler example, but defines multiple handlers. A handler can be configured either as soon as it is declared, or further down using the Ref tag. There is no difference in effect between the two. That example serves up static files in the logs directory under your current directory, and logs all requests since the server was last started to request.log.
To see this in action, go to http://localhost:8080/request.log and refresh a few times (you may need to hard refresh, to make sure you are not seeing a cached copy of the data).
For simplicity's sake, the logfile's name does not contain a date; see jetty.xml for an extended configuration which does.
Either a HandlerCollection or a HandlerList can be used when setting multiple handlers. org.mortbay.jetty.handler.HandlerCollection calls all handlers in turn. org.mortbay.jetty.handler.HandlerList calls each contained handler until either an exception is thrown, the response is committed,or a positive response status is sent. In this case, HandlerCollection was chosen so that the RequestLogHandler could log the requests.
参考资料:
http://docs.codehaus.org/display/JETTY/Newbie+Guide+to+Jetty
<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <Configure id="Server" class="org.mortbay.jetty.Server"> <!-- required configuration --> <!-- connectors --> <!-- handlers --> <!-- webapps/contexts --> <!-- optional configuration --> <!-- threadpool --> <!-- session id manager --> <!-- authentication realms --> <!-- request logs --> <!-- extra server options --> </Configure>
configure.dtd内容如下:
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- This is the document type descriptor for the org.mortbay.XmlConfiguration class. It allows a java object to be configured by with a sequence of Set, Put and Call elements. These tags are mapped to methods on the object to be configured as follows: <Set name="Test">value</Set> == obj.setTest("value"); <Put name="Test">value</Put> == obj.put("Test","value"); <Call name="test"><Arg>value</Arg></Call> == obj.test("value"); Values themselves may be configured objects that are created with the <New> tag or returned from a <Call> tag. Values are matched to arguments on a best effort approach, but types my be specified if a match is not achieved. $Id: configure_1_3.dtd,v 1.2 2005/10/26 20:48:48 gregwilkins Exp $ --> <!ENTITY % CONFIG "Set|Get|Put|Call|New|Ref|Array|Map|Property"> <!ENTITY % VALUE "#PCDATA|Get|Call|New|Ref|Array|Map|SystemProperty|Property"> <!ENTITY % TYPEATTR "type CDATA #IMPLIED " > <!-- String|Character|Short|Byte|Integer|Long|Boolean|Float|Double|char|short|byte|int|long|boolean|float|double|URL|InetAddress|InetAddrPort| #classname --> <!ENTITY % IMPLIEDCLASSATTR "class NMTOKEN #IMPLIED" > <!ENTITY % CLASSATTR "class NMTOKEN #REQUIRED" > <!ENTITY % NAMEATTR "name NMTOKEN #REQUIRED" > <!ENTITY % DEFAULTATTR "default CDATA #IMPLIED" > <!ENTITY % IDATTR "id NMTOKEN #IMPLIED" > <!ENTITY % REQUIREDIDATTR "id NMTOKEN #REQUIRED" > <!-- Configure Element. This is the root element that specifies the class of object that can be configured: <Configure class="com.acme.MyClass"> ... </Configure> --> <!ELEMENT Configure (%CONFIG;)* > <!ATTLIST Configure %IMPLIEDCLASSATTR; %IDATTR; > <!-- Set Element. This element maps to a call to a setter method or field on the current object. The name and optional type attributes are used to select the setter method. If the name given is xxx, then a setXxx method is used, or the xxx field is used of setXxx cannot be found. A Set element can contain value text and/or the value objects returned by other elements such as Call, New, SystemProperty, etc. If no value type is specified, then white space is trimmed out of the value. If it contains multiple value elements they are added as strings before being converted to any specified type. A Set with a class attribute is treated as a static set method invocation. --> <!ELEMENT Set ( %VALUE; )* > <!ATTLIST Set %NAMEATTR; %TYPEATTR; %IMPLIEDCLASSATTR; > <!-- Get Element. This element maps to a call to a getter method or field on the current object. The name attribute is used to select the get method. If the name given is xxx, then a getXxx method is used, or the xxx field is used if getXxx cannot be found. A Get element can contain other elements such as Set, Put, Call, etc. which act on the object returned by the get call. A Get with a class attribute is treated as a static get method or field. --> <!ELEMENT Get (%CONFIG;)*> <!ATTLIST Get %NAMEATTR; %IMPLIEDCLASSATTR; %IDATTR; > <!-- Put Element. This element maps to a call to a put method on the current object, which must implement the Map interface. The name attribute is used as the put key and the optional type attribute can force the type of the value. A Put element can contain value text and/or value elements such as Call, New, SystemProperty, etc. If no value type is specified, then white space is trimmed out of the value. If it contains multiple value elements they are added as strings before being converted to any specified type. --> <!ELEMENT Put ( %VALUE; )* > <!ATTLIST Put %NAMEATTR; %TYPEATTR; > <!-- Call Element. This element maps to an arbitrary call to a method on the current object, The name attribute and Arg elements are used to select the method. A Call element can contain a sequence of Arg elements followed by a sequence of other elements such as Set, Put, Call, etc. which act on any object returned by the original call: <Call id="o2" name="test"> <Arg>value1</Arg> <Set name="Test">Value2</Set> </Call> This is equivalent to: Object o2 = o1.test("value1"); o2.setTest("value2"); A Call with a class attribute is treated as a static call. --> <!ELEMENT Call (Arg*,(%CONFIG;)*)> <!ATTLIST Call %NAMEATTR; %IMPLIEDCLASSATTR; %IDATTR;> <!-- Arg Element. This element defines a positional argument for the Call element. The optional type attribute can force the type of the value. An Arg element can contain value text and/or value elements such as Call, New, SystemProperty, etc. If no value type is specified, then white space is trimmed out of the value. If it contains multiple value elements they are added as strings before being converted to any specified type. --> <!ELEMENT Arg ( %VALUE; )* > <!ATTLIST Arg %TYPEATTR; > <!-- New Element. This element allows the creation of a new object as part of a value for elements such as Set, Put, Arg, etc. The class attribute determines the type of the new object and the contained Arg elements are used to select the constructor for the new object. A New element can contain a sequence of Arg elements followed by a sequence of elements such as Set, Put, Call, etc. elements which act on the new object: <New id="o" class="com.acme.MyClass"> <Arg>value1</Arg> <Set name="test">Value2</Set> </New> This is equivalent to: Object o = new com.acme.MyClass("value1"); o.setTest("Value2"); --> <!ELEMENT New (Arg*,(%CONFIG;)*)> <!ATTLIST New %CLASSATTR; %IDATTR;> <!-- Ref Element. This element allows a previously created object to be referenced by id. A Ref element can contain a sequence of elements such as Set, Put, Call, etc. which act on the referenced object: <Ref id="myobject"> <Set name="Test">Value2</Set> </New> --> <!ELEMENT Ref ((%CONFIG;)*)> <!ATTLIST Ref %REQUIREDIDATTR;> <!-- Array Element. This element allows the creation of a new array as part of a value of elements such as Set, Put, Arg, etc. The type attribute determines the type of the new array and the contained Item elements are used for each element of the array: <Array type="java.lang.String"> <Item>value0</Item> <Item><New class="java.lang.String"><Arg>value1</Arg></New></Item> </Array> This is equivalent to: String[] a = new String[] { "value0", new String("value1") }; --> <!ELEMENT Array (Item*)> <!ATTLIST Array %TYPEATTR; %IDATTR; > <!-- Map Element. This element allows the creation of a new map as part of a value of elements such as Set, Put, Arg, etc. The type attribute determines the type of the new array and the contained Item elements are used for each element of the array: <Map> <Entry> <Item>keyName</Item> <Item><New class="java.lang.String"><Arg>value1</Arg></New></Item> </Entry> </Map> This is equivalent to: Map m = new HashMap(); m.put("keyName", new String("value1")); --> <!ELEMENT Map (Entry*)> <!ATTLIST Map %IDATTR; > <!ELEMENT Entry (Item,Item)> <!-- Item Element. This element defines an entry for the Array or Map Entry elements. The optional type attribute can force the type of the value. An Item element can contain value text and/or the value object of elements such as Call, New, SystemProperty, etc. If no value type is specified, then white space is trimmed out of the value. If it contains multiple value elements they are added as strings before being converted to any specified type. --> <!ELEMENT Item ( %VALUE; )* > <!ATTLIST Item %TYPEATTR; %IDATTR; > <!-- System Property Element. This element allows JVM System properties to be retrieved as part of the value of elements such as Set, Put, Arg, etc. The name attribute specifies the property name and the optional default argument provides a default value. <SystemProperty name="Test" default="value" /> This is equivalent to: System.getProperty("Test","value"); --> <!ELEMENT SystemProperty EMPTY> <!ATTLIST SystemProperty %NAMEATTR; %DEFAULTATTR; %IDATTR;> <!-- Property Element. This element allows arbitrary properties to be retrieved by name. The name attribute specifies the property name and the optional default argument provides a default value. A Property element can contain a sequence of elements such as Set, Put, Call, etc. which act on the retrieved object: <Property name="Server"> <Call id="jdbcIdMgr" name="getAttribute"> <Arg>jdbcIdMgr</Arg> </Call> </Property> --> <!ELEMENT Property ((%CONFIG;)*)> <!ATTLIST Property %NAMEATTR; %DEFAULTATTR; %IDATTR;>
Jetty配置文件分解
Doctype(必需)
在jetty.xml中声明的所有标签和元素必须符合configure.dtd的规范。
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"
Server(必需)
org.mortbay.jetty.Server是Jetty HTTP服务器的主类。当运行服务器时,这是第一个被调用的实例。它用于整合连接器(Connectors,HTTP请求接收者)和请求处理器(request Handlers).server本身是一个处理器(handler)和线程池(TreadPool).连接器使用线程池的方法来运行任务,这些任务最后将调用处理方法。
<Configure id="Server" class="org.mortbay.jetty.Server"> ... </Configure>
Connectors(必需)
实现了org.mortbay.jetty.Connector接口的类为HTTP协议提供连接器。在其配置中,你可以设置Jetty用于监听连接请求的端口。
<Set name="connectors"> <Array type="org.mortbay.jetty.Connector"> <Item> <New class="org.mortbay.jetty.nio.SelectChannelConnector"> <Set name="host"> <SystemProperty name="jetty.host" /> </Set> <Set name="port"> <SystemProperty name="jetty.port" default="8080"/> </Set> ... </New> </Item> </Array> </Set>
Handlers(必需)
处理器用于处理接收到的请求。org.mortbay.jetty.webapp.WebAppContext专门用于服务web应用程序。如果不想完全成熟的应用程序,而只是想处理静态内容和一些servlets,那么你可以使用ContextHandler和配置只需要的服务。server的handlers列表可通过下面的调用来定义:
<Set name="handlers"> <Array type="org.mortbay.jetty.Handler"> ... </Set>
ThreadPool(可选)
线程池可以确保线程在运行方法退出后被线程池重用,从而避免线程创建时带来的开销。配置如下:
<Set name="ThreadPool"> <New class="org.mortbay.thread.QueuedThreadPool"> <Set name="minThreads">10</Set> <Set name="maxThreads">200</Set> <Set name="lowThreads">20</Set> <Set name="SpawnOrShrinkAt">2 </Set> </New> </Set>
Security Realm(可选)
安全域用于用户认证和授权,安全域中可配置的数量和安全域的类型对于服务器来是没有限制的。下面的示例使用etc/realm.properties文件设置安全域:
<Set name="UserRealms"> <Array type="org.mortbay.jetty.security.UserRealm"> <Item> <New class="org.mortbay.jetty.security.HashUserRealm"> <Set name="name">Test Realm</Set> <Set name="config">etc/realm.properties</Set> </New> </Item> </Array> </Set>
示例:
所有的示例都假设是在$JETTY_HOME下,并且下面的所有配置文件都以$JETTY_HOME/etc/myjetty.xml保存。
静态部署1
<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <Configure id="Server" class="org.mortbay.jetty.Server"> <Call name="addConnector"> <Arg> <New class="org.mortbay.jetty.nio.SelectChannelConnector"> <Set name="port">8080</Set> </New> </Arg> </Call> <Set name="handler"> <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection"> <Set name="handlers"> <Array type="org.mortbay.jetty.Handler"> <Item> <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/> </Item> </Array> </Set> </New> </Set> <Call name="addLifeCycle"> <Arg> <New class="org.mortbay.jetty.deployer.WebAppDeployer"> <Set name="contexts"><Ref id="Contexts"/></Set> <Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set> </New> </Arg> </Call> </Configure>
启动:
java -jar start.jar etc/myjetty.xml
View your webapplications at http://localhost:8080/webappfolder/. If you have no webapp defined for the root context ("/"), visiting http://localhost:8080/ will give you a normal 404 page.
静态部署2
<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <Configure id="Server" class="org.mortbay.jetty.Server"> <Call name="addConnector"> <Arg> <New class="org.mortbay.jetty.nio.SelectChannelConnector"> <Set name="host"><SystemProperty name="jetty.host" /></Set> <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set> </New> </Arg> </Call> <Set name="handler"> <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection"> <Set name="handlers"> <Array type="org.mortbay.jetty.Handler"> <Item> <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/> </Item> <Item> <New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/> </Item> </Array> </Set> </New> </Set> <Call name="addLifeCycle"> <Arg> <New class="org.mortbay.jetty.deployer.WebAppDeployer"> <Set name="contexts"><Ref id="Contexts"/></Set> <Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set> <Set name="parentLoaderPriority">false</Set> <Set name="extract">true</Set> <Set name="allowDuplicates">false</Set> <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set> </New> </Arg> </Call> </Configure>
As before, start up Jetty with this command:
java -jar start.jar etc/myjetty.xml
View your webapplications at http://localhost:8080/webappfolder/.
Other than the extra configuration settings, the biggest change is the addition of the org.mortbay.jetty.handler.DefaultHandler, which deals with unhandled requests in the server. If you have no webapps defined in the root context ("/"), visiting http://localhost:8080/ will 404, but will present a list of contexts that have been deployed on the server. DefaultHandler also serves up a Jetty favicon.
For more details about configuring static deployment, see WebAppDeployer.
Hot Deployment of Customized Contexts
In addition to deploying webapps at start-up, you can also do hot deployment: configure a context deployer which scans a specific directory for XML configuration files, and deploys/redeploys/undeploys a webapp if its configuration file has been modified, added, or removed. These configuration files also allow you to configure certain Jetty-specific per-context settings; configuration file and its format is specific to Jetty. To keep things short, I am not going to reproduce the entire configuration. Add this block to either of the previous examples:
<Call name="addLifeCycle"> <Arg> <New class="org.mortbay.jetty.deployer.ContextDeployer"> <Set name="contexts"><Ref id="Contexts"/></Set> <Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set> <Set name="scanInterval">5</Set> </New> </Arg> </Call>
That sets up a ContextDeployer, which will scan the $JETTY_HOME/contexts folder every 5 seconds for changes to the XML descriptors, and hot deploy as necessary. For more details, see ContextDeployer.
File Server, One Handler
Simple HTTP file server with one handler, similar to the embedded FileServer example and embedded OneHandler example. This example serves up purely static files from your current directory:
<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <Configure id="Server" class="org.mortbay.jetty.Server"> <Call name="addConnector"> <Arg> <New class="org.mortbay.jetty.nio.SelectChannelConnector"> <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set> </New> </Arg> </Call> <Set name="handler"> <New id="ResourceHandler" class="org.mortbay.jetty.handler.ResourceHandler"> <Set name="resourceBase">.</Set> </New> </Set> </Configure>
Note that ResourceHandler does not allow directory listing; if you visit a directory with no welcome files, you will get a 403 Forbidden error message. Try the exact path to the file.
If you just want a specific context to serve static content, while still serving dynamic web applications from other contexts, configure your server to allow hot deployment (see previous example), then set up a context to serve up Static Content.
File Server, Multiple Handlers
Simple HTTP file server with request logging. Similar to the embedded FileServer example and embedded ManyHandlers example
<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <Configure id="Server" class="org.mortbay.jetty.Server"> <Call name="addConnector"> <Arg> <New class="org.mortbay.jetty.nio.SelectChannelConnector"> <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set> </New> </Arg> </Call> <Set name="handler"> <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection"> <Set name="handlers"> <Array type="org.mortbay.jetty.Handler"> <Item> <New id="ResourceHandler" class="org.mortbay.jetty.handler.ResourceHandler"> <Set name="resourceBase">./logs</Set> </New> </Item> <Item> <New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/> </Item> </Array> </Set> </New> </Set> <Ref id="RequestLog"> <Set name="requestLog"> <New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog"> <Set name="filename"><SystemProperty name="jetty.logs" default="./logs"/>/request.log</Set> <Set name="append">false</Set> </New> </Set> </Ref> </Configure>
Similar to the one handler example, but defines multiple handlers. A handler can be configured either as soon as it is declared, or further down using the Ref tag. There is no difference in effect between the two. That example serves up static files in the logs directory under your current directory, and logs all requests since the server was last started to request.log.
To see this in action, go to http://localhost:8080/request.log and refresh a few times (you may need to hard refresh, to make sure you are not seeing a cached copy of the data).
For simplicity's sake, the logfile's name does not contain a date; see jetty.xml for an extended configuration which does.
Either a HandlerCollection or a HandlerList can be used when setting multiple handlers. org.mortbay.jetty.handler.HandlerCollection calls all handlers in turn. org.mortbay.jetty.handler.HandlerList calls each contained handler until either an exception is thrown, the response is committed,or a positive response status is sent. In this case, HandlerCollection was chosen so that the RequestLogHandler could log the requests.
参考资料:
http://docs.codehaus.org/display/JETTY/Newbie+Guide+to+Jetty
相关推荐
本文将详细介绍如何进行简单的Jetty配置,包括解析`jetty.xml`、`pom.xml`和`jetty-env.xml`这三个关键配置文件。 首先,我们来看`jetty.xml`文件。这是Jetty的主配置文件,它定义了服务器的行为,如端口设置、...
这个文件是Jetty服务器的配置文件,用于定制服务器的行为,例如端口设置、部署路径等。打开这个文件,你可以看到XML结构,其中包含了各种Jetty的配置元素。 - `<Configure>`标签定义了一个配置类,用于设置服务器...
“jetty配置”是指对Jetty服务器进行定制以满足项目需求。Jetty是一个轻量级的Java Web容器,它可以快速地运行Servlet和Web应用。配置Jetty主要涉及修改jetty.xml或相关的context.xml文件,比如设置端口、添加部署、...
Jetty的配置相对简单,主要通过修改`start.ini`或`jetty.xml`文件来定制服务器行为。你可以设置端口、线程池大小、日志配置等。此外,Jetty还支持热部署,这意味着你可以在不重启服务器的情况下更新Web应用。 6. *...
通过配置`build.gradle`文件,我们可以轻松地定制Jetty服务器的运行参数。结合IDEA这样的集成开发环境,开发过程变得更加高效。在实际项目中,根据需求调整`jettyRunWar`任务的配置,以及利用`gradle-jetty-xml`中的...
4. **启动脚本**:Jetty提供start.jar,可以通过命令行执行启动和停止操作,也可以自定义start.ini文件来定制启动参数。 此外,了解如何在IDE中配置部署Web项目到Jetty服务器也很重要。在Eclipse中,使用Jetty插件...
4. **配置与使用**:在Jetty 6.1.26中,可以通过修改`etc/jetty.xml`或`etc/webdefault.xml`等配置文件来定制服务器行为。启动脚本`jetty.sh`可以配置JVM参数和服务器选项。 5. **Servlet支持**:Jetty 6.1.26支持...
### Jetty下载启动配置详解及与Maven结合的POM配置 #### 一、Jetty简介与下载 Jetty是一款开源的Servlet容器,它能够帮助开发者快速构建基于Java的应用程序。Jetty支持多种协议,包括HTTP、HTTPS等,并且具有高度...
通过修改此文件,用户可以定制Jetty服务器的行为,如设置端口号、启用特定模块等。 `start.jar`是一个可执行的Java归档文件,包含了Jetty的启动脚本和依赖库。运行`run.bat`时,实际上是通过`java -jar start.jar`...
`org.mortbay.xml.XmlConfiguration`类提供了读取和解析Jetty配置文件的能力。用户可以通过这个类来加载配置文件,并将配置信息转换成Java对象模型,方便后续的配置管理和使用。 #### 五、在Jetty中部署Web应用程序...
- 利用插件提供的配置选项,根据实际需求定制Jetty服务器的设置。 - 使用版本控制工具管理代码,便于团队协作和版本回溯。 - 定期更新插件和Jetty服务器,获取最新的安全修复和新特性。 通过Eclipse3 Jetty插件...
通过修改`start.ini`文件或创建自定义的`jetty.xml`配置文件,可以定制Jetty的行为,例如设置端口、添加模块、调整日志级别等。 ### Jetty与源码分析 对于希望深入了解Jetty工作原理的开发者,阅读源码是很好的...
4. **启动脚本或类**:用于启动Jetty服务器,这通常是一个Java类或者一个Shell脚本,它会加载Jetty配置并启动服务器。 5. **README或其他文档**:可能包含关于如何构建、运行和理解示例的说明。 运行JettyDemo的...
5. **配置与定制**:学习如何自定义Jetty的配置,如设置端口号、线程池大小、会话管理策略等。 6. **JettTest**:这个可能是一个测试类或者模块,用于验证内嵌Jetty服务器的正确运行。理解如何通过这样的测试来确保...
它支持通过XML配置或API来定制设置,使得开发者可以根据需求灵活调整。默认配置已经能够满足大多数日常使用场景,极大地简化了部署和管理过程。此外,Jetty的轻量化使得将其嵌入到Java应用程序中变得异常简单,只需...
- **配置文件**:Jetty使用XML配置文件来定制服务器行为,包括Connector、Handler、Server等。 - **部署Web应用**:支持静态和动态部署,包括Servlet2.5的新特性。 6. **Jetty架构**: - **Connector**:负责...
压缩包中的文件可能包括源代码、编译后的JAR文件、文档、配置示例等,开发者可以通过解压并查阅这些文件了解Jetty的内部工作原理和如何进行定制配置。通过学习和使用Jetty,开发者可以创建高效、灵活且易于维护的...
开发者可以通过修改这些配置文件来定制服务器的行为。 8. **安全性**:Jetty提供了基本的安全特性,如SSL/TLS支持,以及对JAAS(Java Authentication and Authorization Service)的集成,可以实现用户认证和访问...
5. **模块化设计**:Jetty的模块化设计允许用户根据需要选择安装和配置特定的组件,如HTTP服务器、HTTPS支持、WebSocket等,这有助于降低资源消耗并提高定制性。 6. **线程模型**:Jetty使用一种高效的线程模型,名...
通过修改这些配置文件,可以定制Jetty的行为以满足特定需求。 2. **javadoc**:这个目录下包含Jetty API的Java文档,是开发者了解和使用Jetty API的重要参考资源,提供了详细的类和方法说明,帮助开发人员更好地...