1

I know little about Java. I want to know how Java implement an web-service which can deploy simply.

I find Jenkins can deploy without any servlet container (like as Tomcat). It can be ran using "java -jar jenkins.war --httpPort=xxx". I want to study the source code of Jenkins. But it is complicated. I can't find where Jenkins parse "httpPort" option.

who can help me to analyze the implementation of Jenkins? Thanks.

Tody.Lu
  • 915
  • 9
  • 24
  • Source code is indeed complicated. Look into https://github.com/jenkinsci/jenkins. Here are the occurences: http://pastie.org/5084672 – shkschneider Oct 19 '12 at 15:58
  • 1
    I decompress `jenkins.war`. There is `winstone.jar` in it. I think jenkins use [http://winstone.sourceforge.net/](winston) as native web service. – Tody.Lu Oct 19 '12 at 23:28
  • The "embedding" section describes two ways it could be done with Winstone: http://winstone.sourceforge.net/#embedding . The first is probably the one Jenkins uses, while the second one looks quite easy. – uldall Oct 20 '12 at 06:44
  • You can create a `JAX-WS` webservice with core (J2SE) java without a servlet container see http://stackoverflow.com/a/12870543/1530938 – kolossus Oct 21 '12 at 08:10

3 Answers3

1

Have a look at Jetty, which is a lightweight container you can deploy into. It's often used for unit testing where a container is needed - it starts practically immediately.

Bohemian
  • 412,405
  • 93
  • 575
  • 722
1

What you are looking for is probably an embeddable servlet container.

Good examples are:

You can find a tutorial on Jetty here: http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty

uldall
  • 2,458
  • 1
  • 17
  • 31
1

I believe you want to create and deploy a web service in java. If that is the case, Apache CXF would be best framework to start on. There are hundreds of tutorials and active forums are available.

Below link would help you to start developing simple webservice in CXF ( this would work even with out Tomcat container) http://www.benmccann.com/dev-blog/web-services-tutorial-with-apache-cxf/

Satheesh Cheveri
  • 3,621
  • 3
  • 27
  • 46