AFAIK embedding Tomcat is an easy task too.

Examples:
http://www.onjava.com/pub/a/onjava/2002/04/03/tomcat.html?page=1
http://tomcat.apache.org/tomcat-5.0-doc/catalina/docs/api/org/apache/catalina/startup/Embedded.html

but you have to add a lot of JAR files to make it work:

  - <CATALINA_HOME>/bin/bootstrap.jar
  - <CATALINA_HOME>/server/lib/catalina.jar
  - <CATALINA_HOME>/server/lib/servlet-cgi.jar
  - <CATALINA_HOME>/server/lib/servlets-common.jar
  - <CATALINA_HOME>/server/lib/servlets-default.jar
  - <CATALINA_HOME>/server/lib/servlets-invoker.jar
  - <CATALINA_HOME>/server/lib/servlets-manager.jar
  - <CATALINA_HOME>/server/lib/servlets-snoop.jar
  - <CATALINA_HOME>/server/lib/servlets-ssi.jar
  - <CATALINA_HOME>/server/lib/servlets-webdav.jar
  - <CATALINA_HOME>/server/lib/jakarta-regexp-1.2.jar
  - <CATALINA_HOME>/lib/naming-factory.jar
  - <CATALINA_HOME>/common/lib/crimson.jar
  - <CATALINA_HOME>/common/lib/jasper-compiler.jar
  - <CATALINA_HOME>/common/lib/jasper-runtime.jar
  - <CATALINA_HOME>/common/lib/jaxp.jar
  - <CATALINA_HOME>/common/lib/jndi.jar
  - <CATALINA_HOME>/common/lib/naming-common.jar
  - <CATALINA_HOME>/common/lib/naming-resources.jar
  - <CATALINA_HOME>/common/lib/servlet.jar
  - <CATALINA_HOME>/common/lib/tools.jar


when Jetty is designed to be embedded easily.


On 8/8/06, Alexei Zakharov <[EMAIL PROTECTED]> wrote:

Guys,

Does somebody have numbers why Jetty is so light-weighted comparing to
Tomcat? I believe Tomcat can also be executed directly from Java code.
And a lot of stuff can also be removed from Tomcat - connectors,
examples and so on. Am I wrong?

Regards,

2006/8/8, Andrew Zhang <[EMAIL PROTECTED]>:
> Hi Filip,
>
> We want to use jetty to eliminate any external dependency, which means
we do
> not need to start an external web server when we run Harmony test. Jetty
is
> suitable for this job, while tomcat may not work. Furthermore, jetty is
> lightweight, and can be easily integrated to Harmony from source code
level,
> say, drop a jetty.jar or such in Harmony, and we can write jetty based
http
> tests. Sounds reasonable?
>
> On 8/8/06, Filip Hanik - Dev Lists <[EMAIL PROTECTED]> wrote:
> >
> > as a lurker, any reason for not choosing Tomcat, as it already is an
ASF
> > project?
> > I'd be happy to help out with that effort,
> >
> > Filip
> >
> > Andrew Zhang wrote:
> > > Alexei, sorry for my late reply.
> > >
> > > It seems a big problem to me. :) I haven't find any solution yet.
> > > Futhurmore, ftp server also needs to be substituted. Do you have any
> > > suggestions?
> > >
> > > Anyway, let's start from http server -- jetty. :) Any committers
would
> > > like
> > > to integrate jetty to Harmony? Thanks!
> > >
> > >
> > >
> > > On 8/1/06, Alexei Zakharov <[EMAIL PROTECTED]> wrote:
> > >>
> > >> Hi Andrew,
> > >>
> > >> > I volunteer to work on excluded tests in luni module, most of
which
> > >> are
> > >> > dependent on external servers(http server, socks proxy and etc.).
> > >>
> > >> Great news - go ahead! :)
> > >> What are you going to use as a substitute for the remote socks
proxy?
> > >>
> > >> Regards,
> > >>
> > >> 2006/8/1, Andrew Zhang <[EMAIL PROTECTED]>:
> > >> > Hi folks,
> > >> >
> > >> > I volunteer to work on excluded tests in luni module, most of
which
> > >> are
> > >> > dependent on external servers(http server, socks proxy and etc.).
> > >> >
> > >> > As we discussed some months earlier, we'd integrate Jetty to
Harmony
> > >> test
> > >> > framework for eliminating external http server, but seems no more
> > >> progress.
> > >> >
> > >> > Any volunteer to do this job? :-)
> > >> >
> > >> > Thanks!
> > >> >
> > >> >
> > >> > On 5/23/06, Stepan Mishura <[EMAIL PROTECTED]> wrote:
> > >> > >
> > >> > > Hi George, Paulex,
> > >> > >
> > >> > > Thanks for your answers. As a preliminary result - your
convinced
> > me
> > >> and
> > >> > > I'm
> > >> > > going to be volunteer to evaluate jetty integration to classlib
> > test
> > >> > > suite.
> > >> > >
> > >> > > Do anybody work on integrating jetty http server to move net
> > >> tests out
> > >> of
> > >> > > exclude list?
> > >> > >
> > >> > > Thanks,
> > >> > > Stepan.
> > >> > >
> > >> > > On 5/23/06, George Harley <[EMAIL PROTECTED]>
wrote:
> > >> > > >
> > >> > > > Stepan Mishura wrote:
> > >> > > > > Hi George, Tim
> > >> > > > >
> > >> > > > > I'd like to clarify the following questions:
> > >> > > > > 1) Configuring
> > >> > > > > As I understood we say that the server is 'embedded' when
we
> > can
> > >> > > > > start/stop
> > >> > > > > it within Ant without additional configuration steps. And
all
> > we
> > >> need
> > >> > > > > to do
> > >> > > > > is just download required jars. Right?
> > >> > > > >
> > >> > > > > What about Eclipse users?
> > >> > > >
> > >> > > > Hi Stepan,
> > >> > > >
> > >> > > > In addition to be being start-able, stop-able and
configurable
> > >> from
> > >> Ant
> > >> > > > and XML config files, Jetty can also be embedded into the
Java
> > >> code
> > >> of a
> > >> > > > test case or test suite. Configuration, starting and stopping
are
> > >> all
> > >> > > > possible. Eclipse users should not be disadvantaged.
> > >> > > >
> > >> > > >
> > >> > > > >
> > >> > > > > 2) Time to run test suite
> > >> > > > > May be it is hard to estimate but anyway - will the test
> > >> suite run
> > >> > > > > slow down
> > >> > > > > if we'll use jetty instead of mock objects? How much?
> > >> > > >
> > >> > > > Depends on configuration. Configure and start the server in
the
> > >> setup()
> > >> > > > of a JUnit TesCase (and stopping the server in the
teardown())
> > >> would
> > >> > > > obviously be slower than doing the equivalent in a JUnit
> > TestSetup
> > >> > > > descendent. Start up is a lot less than half a second on my
> > >> machine.
> > >> > > >
> > >> > > > Is there some performance benchmark for tests that is at risk
> > >> here ?
> > >> > > >
> > >> > > >
> > >> > > > >
> > >> > > > > 3) Testing
> > >> > > > > Quoting Tim from 'local server thread': "There is no way to
> > >> force
> > >> a
> > >> > > > > server
> > >> > > > > to send you a chunked response using regular HTTP headers,
so
> > in
> > >> this
> > >> > > > > case
> > >> > > > > the server and client have an understanding that when the
> > client
> > >> asks
> > >> > > > > for a
> > >> > > > > particular resource the server will send it back in
chunks."
> > >> > > > >
> > >> > > > > With mock objects this can be done with no problems and
> > >> HARMONY-164
> > >> > > > > demonstrates the possible way. Also are we going to create
> > >> negative
> > >> > > > > tests,
> > >> > > > > for example, for broken server response? I think yes. Can
jetty
> > >> server
> > >> > > > be
> > >> > > > > used for negative testing?
> > >> > > >
> > >> > > > Yes. You can send back any error.
> > >> > > >
> > >> > > >
> > >> > > > >
> > >> > > > > See other comments below
> > >> > > > >
> > >> > > > > On 5/22/06, George Harley wrote:
> > >> > > > >>
> > >> > > > >> Stepan Mishura wrote:
> > >> > > > >> > On 5/19/06, Tim Ellison wrote:
> > >> > > > >> >>
> > >> > > > >> >> Stepan Mishura wrote:
> > >> > > > >> >> <snip>
> > >> > > > >> >> > I'm OK only if we separate tests with Jetty from
common
> > >> test
> > >> > > suite
> > >> > > > >> >> run.
> > >> > > > >> >>
> > >> > > > >> >> Why?
> > >> > > > >> >
> > >> > > > >> >
> > >> > > > >> > Because each external dependency complicates 'normal'
test
> > >> suite
> > >> > > > >> run ( I
> > >> > > > >> > don't want to face with situation when to run Harmony
test
> > >> suite I
> > >> > > > >> > have to
> > >> > > > >> > configure and run 20 different external servers even
they
> > are
> > >> easy
> > >> > > > >> > configurable). As far as I remember we agreed to use
mock
> > >> objects -
> > >> > > > so
> > >> > > > >> > let's
> > >> > > > >> > use them! For example, in this case there is no need in
> > jetty
> > >> > > server.
> > >> > > > >> >
> > >> > > > >> > I'm not against 'jetty based tests' but I'd prefer to
> > >> separate
> > >> such
> > >> > > > >> > tests.
> > >> > > > >> >
> > >> > > > >> > Thanks,
> > >> > > > >> > Stepan.
> > >> > > > >> >
> > >> > > > >>
> > >> > > > >> Hi Stepan,
> > >> > > > >>
> > >> > > > >> Just seen this note and think that my previous append on
the
> > >> "Re:
> > >> svn
> > >> > > > >> commit: r407752" thread sums up my thoughts. Allow me to
quote
> > >> > > myself:
> > >> > > > >>
> > >> > > > >> <paste>
> > >> > > > >> Jetty or equivalent is a good basis for such local server
> > >> stubs.
> > >> It
> > >> > > is
> > >> > > > >> fast, it is lightweight,
> > >> > > > >
> > >> > > > >
> > >> > > > > Fast and lightweight as what?
> > >> > > > > I saw sometimes ago java server that has jar size 4k. And
> > >> > > > > jetty-6.0.0beta6.jar is 423k size.
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> > > > Not sure of your point here. Is there some test file
footprint
> > >> benchmark
> > >> > > > that is at risk here ? If there is a better, faster, more
> > >> lightweight
> > >> > > > server that would suit our purposes then let's hear about it
so
> > >> that
> > >> we
> > >> > > > can investigate whether or not it may be used with our
network
> > >> tests.
> > >> > > >
> > >> > > > >
> > >> > > > >> it can be started and stopped very simply from
> > >> > > > >> within Ant (so that it only runs for the duration of a
> > >> specified
> > >> > > batch
> > >> > > > >> of unit tests) and may also be completely controlled from
Java
> > >> test
> > >> > > > code
> > >> > > > >> so that we can configure its behaviour for any test case
from
> > >> within
> > >> > > > >> that test case.
> > >> > > > >
> > >> > > > >
> > >> > > > > Good.
> > >> > > > >
> > >> > > > > It's architecture means that we do not have to run it as
> > >> > > > >> a complete web server but can stub out any aspect of its
> > >> runtime
> > >> > > > >> behaviour we wish in order to suit the purposes of the
> > test(s).
> > >> > > > >
> > >> > > > >
> > >> > > > > What about 'chunked response'? Can a testcase force jetty
> > server
> > >> to
> > >> > > > > send it
> > >> > > > > a chunked response?
> > >> > > >
> > >> > > > Yes. The API provides options to do this. Chunks are encoded
as
> > >> per
> > >> > > > RFC2616.
> > >> > > >
> > >> > > >
> > >> > > > Best regards,
> > >> > > > George
> > >> > > >
> > >> > > > >
> > >> > > > > I don't really understand why such network tests making use
of
> > a
> > >> > > small,
> > >> > > > >> embedded server running locally would need to be
considered as
> > >> > > outside
> > >> > > > >> of the "normal test flow".
> > >> > > > >> </paste>
> > >> > > > >
> > >> > > > >
> > >> > > > > Because I consider adding jetty server as precedent for
adding
> > >> other
> > >> > > > > dependencies to the "normal test flow". I believe that
"normal
> > >> test
> > >> > > > flow"
> > >> > > > > should be fast and lightweight as much as possible. Each
> > >> additional
> > >> > > > > dependency or configuration step adds a brick(even it
light) to
> > >> > > > > developer's
> > >> > > > > large. As the result classlib test suite may become very
slow
> > >> and
> > >> hard
> > >> > > > to
> > >> > > > > configure. All I want is to understand - do we really need
> > jetty
> > >> > > server
> > >> > > > > inside it.
> > >> > > > >
> > >> > > > > Thanks,
> > >> > > > > Stepan.
> > >> > > > >
> > >> > > > > We are not talking about an external server here and we are
not
> > >> > > talking
> > >> > > > >> about developers having to carry out complex configuration
> > >> manoeuvres
> > >> > > > >> when running the tests. That is something that nobody
wants.
> > >> The
> > >> > > > >> motivation here is purely to get more of the java.nettests
> > out
> > >> of
> > >> > > the
> > >> > > > >> "excludes" sin bin.
> > >> > > > >>
> > >> > > > >> Best regards,
> > >> > > > >> George
> > >> > > > >>
> > >> > > > >>
> > >> > > > >> > Regards,
> > >> > > > >> >> Tim
> > >> > > > >> >>
> > >> > > > >> >> --
> > >> > > > >> >>
> > >> > > > >> >> Tim Ellison ([EMAIL PROTECTED])
> > >> > > > >> >> IBM Java technology centre, UK.
> > >> > > > >> >>
> > >> > > > >> >>
> > >> > > >
> > >>
---------------------------------------------------------------------
> > >> > > > >> >> Terms of use :
> > >> http://incubator.apache.org/harmony/mailing.html
> > >> > > > >> >> To unsubscribe, e-mail:
> > >> > > [EMAIL PROTECTED]
> > >> > > > >> >> For additional commands, e-mail:
> > >> > > > >> [EMAIL PROTECTED]
> > >> > > > >> >>
> > >> > > > >> >>
> > >> > > > >> >
> > >> > > > >> >
> > >> > > > >>
> > >> > > > >>
> > >> > > > >>
> > >>
---------------------------------------------------------------------
> > >> > > > >> Terms of use :
> > http://incubator.apache.org/harmony/mailing.html
> > >> > > > >> To unsubscribe, e-mail:
> > >> [EMAIL PROTECTED]
> > >> > > > >> For additional commands, e-mail:
> > >> > > [EMAIL PROTECTED]
> > >> > > > >>
> > >> > > > >>
> > >> > > > >
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> > > >
> > >>
---------------------------------------------------------------------
> > >> > > > Terms of use :
http://incubator.apache.org/harmony/mailing.html
> > >> > > > To unsubscribe, e-mail:
> > >> [EMAIL PROTECTED]
> > >> > > > For additional commands, e-mail:
> > >> [EMAIL PROTECTED]
> > >> > > >
> > >> > > >
> > >> > >
> > >> > >
> > >> > > --
> > >> > > Thanks,
> > >> > > Stepan Mishura
> > >> > > Intel Middleware Products Division
> > >> > >
> > >> > > ------------------------------------------------------
> > >> > > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > >> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > >> > > For additional commands, e-mail:
> > >> [EMAIL PROTECTED]
> > >> > >
> > >> > >
> > >> >
> > >> >
> > >> > --
> > >> > Andrew Zhang
> > >> > China Software Development Lab, IBM
> > >> >
> > >> >
> > >>
> > >>
> > >> --
> > >> Alexei Zakharov,
> > >> Intel Middleware Product Division
> > >>
> > >>
---------------------------------------------------------------------
> > >> Terms of use : http://incubator.apache.org/harmony/mailing.html
> > >> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> > >> For additional commands, e-mail:
[EMAIL PROTECTED]
> > >>
> > >>
> > >
> > >
> > >
------------------------------------------------------------------------
> > >
> > > No virus found in this incoming message.
> > > Checked by AVG Free Edition.
> > > Version: 7.1.394 / Virus Database: 268.10.7/410 - Release Date:
8/5/2006
> > >
> >
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Andrew Zhang
> China Software Development Lab, IBM
>
>


--
Alexei Zakharov,
Intel Middleware Product Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Mikhail Fursov

Reply via email to