Coder Social home page Coder Social logo

rainleo / executable-embeded-tomcat-sample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hengyunabc/executable-embeded-tomcat-sample

0.0 1.0 0.0 18 KB

executable-embeded-tomcat-sample, support traditional web.xml.

License: Apache License 2.0

Java 99.32% HTML 0.68%

executable-embeded-tomcat-sample's Introduction

executable-embeded-tomcat-sample

Features

  • Support web.xml

spring boot is a great project, but it don't support web.xml. This project support traditional web.xml.

  • Support Fat jar

By spring-boot-maven-plugin, the project can be packaged into an executable jar.

You can also use maven-assembly-plugin/jar-with-dependencies, but spring-boot-maven-plugin is a better choice.

  • Run in IDE

Sample

Run main class io.github.hengyunabc.Main in your IDE, or

mvn clean package

java -jar target/executable-embeded-tomcat-sample-0.0.1-SNAPSHOT.jar

Open the following link in your browser:

http://localhost:8080/test.jsp

http://localhost:8080/hello

http://localhost:8080/annotation

How to migrate from a webapp project

It is very simple.

  1. add embeded tomcat maven dependencies into your pom.xml

  2. move src/main/webapp/WEB-INF to src/main/resources/WEB-INF, move all files under src/main/webapp to src/main/META-INF/resources.

according to servlet 3.0, ServletContext can get static content from META-INF/resource.

  1. add a main class, start your embeded tomcat.

Others

http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/basic_app_embedded_tomcat/basic_app-tomcat-embedded.html

A sample from oracle, but it do not support web.xml, and do not support run in IDE.

https://github.com/kui/executable-war-sample

Another sample, it has security problems. people can access your .class file through http!!

License

Apache License V2

executable-embeded-tomcat-sample's People

Contributors

hengyunabc avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.