Sophie

Sophie

distrib > Mandriva > 2010.0 > x86_64 > by-pkgid > c27466c2a3fa3cf6008c3a485d00ce04 > files > 165

jetty5-manual-5.1.15-1.5.2mdv2010.0.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>Getting Started with Jetty</title>
                                                                        
                 
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
  <body>
                         
<table cellpadding="0" cellspacing="8" border="0" width="20%">
                 <tbody>
                   <tr>
                     <td valign="middle" bgcolor="#ccccff"><small><a href="index.html">
            BACK</a></small></td>
                     <td valign="middle" bgcolor="#ccccff"><small><a href="index.html">
               INDEX</a></small><br>
                     </td>
                     <td valign="middle" bgcolor="#ccccff"><small><a href="..">
           EXIT</a></small><br>
                     </td>
                     <td valign="middle" bgcolor="#ccccff"><small><a href="overview.html">
               NEXT</a></small><br>
                     </td>
                   </tr>
                                                           
  </tbody>               
</table>
                  
<h1>Getting Started</h1>
               <a name="Introduction"></a><big><big><b>Introduction</b></big></big><br>
          <br>
             So you want to skip all the preliminary reading and just get 
Jetty      up and going? No problem, but we do recommend that once you've 
satisfied      the urge to play around with it in your environment that you 
go back and    visit the <a href="index.html">tutorial</a>, particularly if
you're so enthused     that you want to <a href="/jetty/contributing.html">
 contribute</a>    to Jetty!<br>
             <br>
             <br>
             Firstly, if you haven't already done it, you need to <a href="/jetty/download.html">
            download</a>  Jetty using one of the methods provided on the
<a href="/jetty/download.html">            download page</a>. Once successfully
downloaded, follow the links   for&nbsp;   <a href="#Running_Jetty">  running
the demonstrations</a> provided   with  Jetty.<br>
          <br>
         <br>
            <br>
           <big><a name="Running_Jetty"></a> <big><b>Running the Jetty demonstrations</b></big></big><br>
          <br>
         The installation includes the ability to serve the Jetty web site
 pages    locally as a demonstration of Jetty's capabilities.&nbsp; The demonstrations
    include various servlets, JSP integration, SSL integration and a web
application.     <br>
         <br>
         There are 4 ways to run it:<br>
                   
<ul>
	    <li>using start.jar</li>
            <li>using the Ant build environment</li>
            <li>using prepared scripts</li>
            <li>manually<br>
            </li>
                   
</ul>
Of the above options, the easiest is to use the <A hef="#start.jar">start.jar</A> method.Alternatively, if  you
  have Ant installed, you can <a href="#Ant">use it</a> to run the demonstration content. 
          The scripts handle all the housekeeping tasks associated with getting 
   a server started, and are provided as <a href="#Unix">Unix shell scripts</a>
          and as (unmaintained) <a href="#Windows">Window bat files</a> (you should treat
them as examples, and feel free to brew your own). 
    Finally, you can <a href="#manual">manually configure</a> your
  environment  and run the server by hand.<br>
          <br>
          <br>
          <big><a name="start.jar"></a><b>Quick start with start.jar</b></big><br>
	  <br>

<b>Starting Jetty </b>
<P>
The start.jar file in the Jetty distribution may be run with

<pre>
  java -jar start.jar <configfile> ...
</pre>

For example

<pre>
  java -jar start.jar etc/admin.xml etc/demo.xml
</pre>

On some systems with graphical file browsers, it may be possible to start
jetty by double clicking on this jar file. For more details see 

<pre>
  $JETTY_HOME/src/org/mortbay/start/README.txt
or
  http://jetty.mortbay.org/javadoc/org/mortbay/start/Main.html
</pre>


If jetty is not being started from the current directory, then 
the jetty.home property should be set:

<pre>
  java -Djetty.home=C:\jetty -jar start.jar <configfile> ...
</pre>


If JSPs do not work with this start method, you may want to clearly specify 
the location of the JDK so the compiler can be accessed:

<pre>
  java -Djava.home=C:\j2sdk1.4.1 -jar start.jar <configfile> ...
</pre>


If an extra classpaths are needed, they can be added with the jetty.class.path
property:
 
<pre>
  java -Djetty.class.path=/usr/share/java -jar start.jar <configfile> ...
</pre>


If no configuration file is provided, start.jar will use etc/admin.xml and 
etc/jetty.xml

<P>

<b>Stopping Jetty </b>
<P>
Programs started with the start.jar mechanism may be stopped with the
stop.jar:

<pre>
   java -jar stop.jar
</pre>

This connects via a local port to stop the server. The default port can be set wi
th the 
STOP.PORT system property (a port of < 0 disables the stop mechanism). 
If the STOP.KEY system property is set, then a random key is generated and 
written to stdout. This key  must be passed to the stop.jar. eg

<pre>
  [540] java -DSTOP.PORT=9999 -DSTOP.KEY -jar start.jar
  1rukbu7owi3uo
  17:39:49.082 EVENT  Starting Jetty/4.2.10pre0
  ...


  [526] java -DSTOP.PORT=9999 -DSTOP.KEY=1rukbu7owi3uo -jar stop.jar 
</pre>



          <br>
          <br>
          &nbsp;<big><a name="Unix"></a><b>Unix shell script</b></big><br>
          <br>
         You must already have a Java environment installed and configured
 (ie   you  must have the <font face="Courier New, Courier, monospace">$JAVA_HOME</font>
          environment variable set).<br>
         <br>
         Then, &nbsp;set up the fundamental Jetty evironment variable <font face="Courier New, Courier, monospace">
         $JETTY_HOME</font>. This must point to the directory into which
you   installed   Jetty:<br>
                 
<blockquote> &nbsp; <font face="Courier New, Courier, monospace">export JETTY_HOME=&lt;jetty 
    install directory&gt;</font><br>
           </blockquote>
           <i><b>Running a simple server</b><br>
           </i><br>
         To verify Jetty on your system, type the following command to start
  a  very  simple one-page server:<br>
                                   
  <blockquote> &nbsp; <font face="Courier New, Courier, monospace">$JETTY_HOME/bin/jetty.sh 
    run</font><br>
             </blockquote>
             <br>
         Use your browser to go to the following location to see the sample 
 page:        <br>
                                                     
    <blockquote> &nbsp; <font face="Courier New, Courier, monospace">http://localhost:8080</font>
               <br>
               </blockquote>
         If the script doesn't work for you, either try the <a href="GettingStarted.html#Ant">
         Ant</a> version, or follow the <a href="#manual">manual instructions</a>
        .<br>
               <br>
               <i><b>Running the Jetty demonstrations</b></i><br>
               <br>
         To run the more sophisticated demonstrations, execute the following
  command   (if you are still running the previous example, don't forget
to   kill it first):<br>
                                                                       
      <blockquote> &nbsp;<font face="Courier New, Courier, monospace">$JETTY_HOME/bin/jetty.sh 
  demo</font><br>
                 </blockquote>
         Use your browser to go to the following location: <br>
                                                                        
                
        <blockquote><font face="Courier New, Courier, monospace">http://localhost:8080<br>
                   </font><br>
                   </blockquote>
         Select the <font face="Courier New, Courier, monospace">Demonstrations</font>
          link to explore the servlets provided. <a href="/jetty/demos.html">
    Here</a>      is page you should see.<br>
                   <br>
          <br>
          <big><br>
                   <b><a name="Windows"></a>Windows .bat file</b></big>
              <br>
          <br>
                   <b>NOTE</b>: &nbsp;Due to problems with the servlet security 
   model,  it is vital that Windows users use the exact case for drive letters, 
   URLs  and filenames.<br>
          <br>
         To run the demonstrations under Windows, ensure that your Java environment 
    is set up, then set the fundamental Jetty evironment variable <font face="Courier New, Courier, monospace">
         %JETTY_HOME%</font>. This must point to the directory into which 
you   installed   Jetty:<br>
                                                                        
                                  
          <blockquote> &nbsp; <font face="Courier New, Courier, monospace">
         set JETTY_HOME=&lt;jetty install directory&gt;</font><br>
                     </blockquote>
                     <i><b>Running a simple server</b><br>
                     </i><br>
         To verify Jetty on your system, type the following command to start
  a  very  simple one-page server:<br>
                                                                        
                                                    
            <blockquote> &nbsp; <font face="Courier New, Courier, monospace">
         %JETTY_HOME%\bin\jetty.bat</font><br>
                       </blockquote>
          Use your browser to go to the following location: <br>
                                                                        
                                                                      
              <blockquote> &nbsp; <font face="Courier New, Courier, monospace">
         http://localhost:8080</font><br>
                         <br>
                         </blockquote>
         If you have problems:<br>
                                                                        
                                                                        
               
                <ul>
                           <li>&nbsp;try installing Jetty in a path with
no  spaces    in the directory name.</li>
                           <li> &nbsp;check that the case of JETTY_HOME is
 exactly    the same as reported by your system </li>
                                                                        
                                                                        
               
                </ul>
         &nbsp;If you still cannot get the bat file to work, then try the 
                <a href="GettingStarted.html#Ant">
         Ant </a>option, or set it up <a href="#manual">manually</a>.<br>
                         <br>
                         <i><b>Running the Jetty demonstrations</b></i><br>
                         <br>
          To run the more sophisticated servlet demonstrations, execute the 
 following    command (if you are still running the previous example, don't 
 forget to  kill  it first):<br>
                                                                        
                                                                        
               
                <blockquote> &nbsp;<font face="Courier New, Courier, monospace">
         %JETTY_HOME%\bin\jetty.bat demo</font><br>
                           </blockquote>
          Use your browser to go to the following location: <br>
                                                                        
                                                                        
                                 
                  <blockquote><font face="Courier New, Courier, monospace">
         http://localhost:8080</font><br>
                             </blockquote>
         Select the <font face="Courier New, Courier, monospace">Demonstrations</font>
          link to explore the servlets provided. <a href="/jetty/demos.html">
         Here</a> is page you should see.<br>
                             <br>
                             <br>
          <br>
          <br>



 <big><b><a name="Ant"></a>Ant Quick Start</b></big><br>
<br>
You must have Ant already installed to use this method. The following examples assume the current directory is $JETTY_HOME.
                                                                       
<p>
                                                                        
<i><b>Running a simple server</b></i>
          <p>
          To verify Jetty on your system, type the following command to start a  very  simple one-page server:                                       
        <P>                                               
        <blockquote>
	 <small><b>Unix:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b> </small>
	 <code> ant run </code>
         <br>
	 <b><small>Windows:&nbsp;</small></b>
	 <code> ant.bat run </code>
        </blockquote>
                                                                        
         To view the demo, use your browser to browse to <code> http://localhost:8080</code>
                                                                        

<p>
         <i><b>Running the Jetty demonstrations</b></i>
         <p>
           To run the more sophisticated servlet demonstrations, execute the  following  command (if you are still running the previous example, don't   forget to kill  it first):<br>
                                                                        
                                                  
        <blockquote>
	 <small><b>Unix:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></small> <code> ant demo </code>
	 <br>
	 <small><b>Windows:&nbsp;</b></small> <code> ant.bat demo </code>
        </blockquote>

         To view the demonstrations, use your browser to go to  <code> http://localhost:8080 </code> and select the <code>Demonstrations</code> link to explore the servlets provided. <a href="/jetty/demos.html">
         This</a> is the page you should see.


                               
         <p><i><b>Running with JMX enabled</b></i>
         <p>
	To run Jetty with JMX instrumentation, execute:


	<blockquote>
         <b><small>Unix:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</small></b><code> ant demo.jmx</code>
	 <br>
         <b><small>Windows:&nbsp;</small></b><code>ant.bat demo.jmx </code>
         </blockquote>
	 <br>
         Use your browser to visit the JMX agent view by browsing to <code>> http://localhost:8082 </code>




          <br>
          <br>
          <a name="manual"></a><big><b><br> Manual configuration and execution<br>
                                                     <small><br>
         Configuration</small><br>
                                                     </b></big><br>
         Jetty requires a Java 1.2 environment to be installed. <br>
 <br>

If you are using jdk1.4, you should use the path (or non-unix equivalent):
<code>
<pre>
  CLASSPATH=\
    $JETTY_HOME/lib/org.mortbay.jetty.jar:\
    $JETTY_HOME/lib/javax.servlet.jar:\
    $JETTY_HOME/ext/jasper-runtime.jar:\
    $JETTY_HOME/ext/jasper-compiler.jar:\
    $JETTY_HOME/ext/xercesImpl.jar
</pre>
</code>


For jdk1.2 or jdk1.3 us the following classpath, you need to use the
alternative jetty jars and add the XML support. Thus the classpath 
to use is:

<code>
<pre>
  CLASSPATH=\
    $JETTY_HOME/lib/org.mortbay.jetty-jdk1.2.jar:\
    $JETTY_HOME/lib/javax.servlet.jar:\
    $JETTY_HOME/ext/jasper-runtime.jar:\
    $JETTY_HOME/ext/jasper-compiler.jar:\
    $JETTY_HOME/ext/xercesImpl.jar:\
    $JETTY_HOME/ext/xml-apis.jar:\
    $JETTY_HOME/ext/xmlParserAPIs.jar
</pre>
</code>


To use SSL you will also need to add the the jars below: (see <a href="/jetty/JsseSSL.html">here</a> for more details):<br>
<code>
<pre>
         $JETTY_HOME/ext/jnet.jar  (not needed for JDK1.4.1) 
         $JETTY_HOME/ext/jcert.jar
         $JETTY_HOME/ext/jsse.jar
</pre>
</code>

<BR>
To use JMX the classpath must also include:
<code>
<pre>
    $JETTY_HOME/ext/mx4j.jar
    $JETTY_HOME/ext/mx4j-tools.jar 
</pre>
</code>
For java &gt;=1.5 you will also need to add <code>
-Djavax.management.builder.initial=mx4j.server.MX4JMBeanServerBuilder
</code> to the command line to avoid a clash with the internal jmx implementation.

  <p>
To run JSP with the JDK compiler, you will also need to add the JDK <code>tools.jar</code>
jar, and the ant.jar file from jakarta-ant 1.5 or later.

<P>
          <b>Execution</b><br>
          <br>
         The execution examples are illustrated using Unix-style commands 
and   environment   variable specifications - adapt these as necessary to 
your  environment.<br>
                                                         <br>
         To run a Jetty server, the steps are:<br>
                                                                        
                                                                        
 <code>
 <pre>
         cd $JETTY_HOME
         java org.mortbay.jetty.Server &lt;xml configuration file&gt;
</pre>
</code>
                                                           <br>
                                                           </font></blockquote>
         The <font face="Courier New, Courier, monospace">&lt;xml configuration 
   file&gt;</font>   specifies the operation of the Jetty server. &nbsp;Some 
   examples of these  can be found in the <font face="Courier New, Courier, monospace">
   $JETTY_HOME/etc </font> directory.<br>
                                                           <br>
         For example, the simple one-page server mentioned in the Quick Start 
  sections   can be started by the following command:<font face="Courier New, Courier, monospace"><br>
                                                           </font>      
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
              
                                                  <blockquote><font face="Courier New, Courier, monospace">
         cd $JETTY_HOME</font><font face="Courier New, Courier, monospace"><br>
         java org.mortbay.jetty.Server etc/jetty.xml</font><br>
                                                             </blockquote>
         The servlet demonstration server is run by the following:<br>
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
                                               
                                                    <blockquote><font face="Courier New, Courier, monospace">
         cd $JETTY_HOME<br>
          java org.mortbay.jetty.Server etc/admin.xml etc/demo.xml</font><br>
                                                               </blockquote>
                                                               <br>
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
           
                                                      <table cellpadding="0" cellspacing="8" border="0" width="20%">
                 <tbody>
                   <tr>
                     <td valign="middle" bgcolor="#ccccff"><small><a href="index.html">
            BACK</a></small></td>
                     <td valign="middle" bgcolor="#ccccff"><small><a href="index.html">
               INDEX</a></small><br>
                     </td>
                     <td valign="middle" bgcolor="#ccccff"><small><a href="..">
           EXIT</a></small><br>
                     </td>
                     <td valign="middle" bgcolor="#ccccff"><small><a href="overview.html">
               NEXT</a></small><br>
                     </td>
                   </tr>
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
                                                     
                                                        </tbody>         
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
                                                      </table>
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
            
                                                      </body>
                                                      </html>