Jetty

http://freesoftman.iteye.com/category/60521

http://jimichan.iteye.com/blog/601165

http://blog.youkuaiyun.com/sony315/article/details/6416796

JTable

 http://blog.youkuaiyun.com/sws8327/article/details/814701

http://download.oracle.com/javase/tutorial/uiswing/components/table.html

http://webservices.ctocio.com.cn/java/217/9492717.shtml

 

 Oracle

http://czmmiao.iteye.com/blog/1218007

public  class JettyStarter {

     /**
     * 
@param  args
     * 
@throws  Exception
     
*/
     public  static  void main(String[] args)  throws Exception {
         long begin = System.currentTimeMillis();
        Connector connector =  new SelectChannelConnector();
        connector.setPort(Integer.getInteger("jetty.port", 8080).intValue());
         //  设置Web环境
        WebAppContext webapp =  new WebAppContext();
        webapp.setContextPath("/sample");
        webapp.setWar("websample.war");
        Server server =  new Server();
        server.setConnectors( new Connector[] { connector });
        server.setHandler(webapp);
        server.start();
        System.out.println("Jetty Server started, use "
            + (System.currentTimeMillis() - begin) + " ms");
    }
}

 

 

03-08
### Jetty 服务器介绍 Jetty 是一款轻量级的 Java HTTP(S) 服务器和 Servlet 容器,广泛应用于开发环境以及生产环境中部署 Web 应用程序。其设计目标是为了提供高效能、可扩展性和灵活性,在处理高并发请求方面表现出色[^1]。 ### 使用 Spring Boot 集成 Jetty Spring Boot 默认采用 Tomcat 作为嵌入式的 Servlet 容器,但也可以轻松切换至其他容器如 Jetty 或 Undertow。为了在 Spring Boot 中使用 Jetty 而不是默认的 Tomcat,可以通过排除 `spring-boot-starter-tomcat` 并引入 `spring-boot-starter-jetty` 来实现这一点: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <!-- 排除Tomcat依赖 --> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <!-- 添加Jetty依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> </dependency> ``` 通过上述配置更改后,应用程序启动时将会自动加载 Jetty 作为内嵌式 Web 服务器来运行应用实例。 对于更高级别的定制化需求,比如调整线程池大小或其他性能参数,则可以自定义 `ServletWebServerFactory` 的 Bean 实现。 ### 创建 WAR 文件用于外部 Jetty 部署 如果希望构建一个可以在独立安装版 Jetty 上部署的应用程序包 (WAR),则需确保项目的打包方式设置为 war,并且正确指定主类入口点以便于命令行执行。下面是一个典型的 Maven POM 设置片段展示如何创建这样的项目结构[^2]: ```xml <packaging>war</packaging> <properties> ... <start-class>com.example.MyApplication</start-class> ... </properties> ``` 此外还需要注意的是当以这种方式发布时应移除任何关于内置容器的支持代码,因为此时将由外部 Jetty 处理所有的HTTP 请求路由工作。 ### 日志记录工具 Log4j 在 Maven 项目中的集成 Log4j 是 Apache 提供的一个开源日志框架库,允许开发者方便地控制不同级别的消息输出行为。要在基于 Maven 构建系统的Java工程里加入此功能支持,首先要做的就是在 pom.xml 文件中声明相应的依赖关系项[^3]: ```xml <dependencies> ... <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> ... </dependencies> ``` 接着按照官方文档指导完成必要的初始化过程即可开始利用它来进行有效的错误跟踪与调试辅助操作了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值