You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2004/02/02 04:29:23 UTC

cvs commit: avalon/merlin/facilities/http/test/src/java/test/http TestServlet.java package.html

mcconnell    2004/02/01 19:29:23

  Modified:    merlin/facilities/http/api project.xml
               merlin/facilities/http/impl project.xml
  Added:       merlin/facilities/http README.TXT
               merlin/facilities/http/test maven.xml project.xml
               merlin/facilities/http/test/conf kernel.xml test.block
               merlin/facilities/http/test/src/java/test/http
                        TestServlet.java package.html
  Removed:     merlin/facilities/http/conf kernel.xml test.block
  Log:
  One step further on the http content.
  
  Revision  Changes    Path
  1.1                  avalon/merlin/facilities/http/README.TXT
  
  Index: README.TXT
  ===================================================================
  
  After building merlin try the following:
  
    $ cd merlin\facilities\http\test
    $ merlin -execute -kernel conf\kernel.xml conf\test.xml
  
  All this does is launch (a) a http server as a facility and (b) a model listener (defined under kernel.xml).  The model listener needs to be updated to check if a component is a servlet and if so, get the context path that it should be added to - then register the component with the server.  
  
  Lots of little things still to be done - like:
  
    (a) servlet recognition, 
    (b) how do we associate a context at the <compoent> directive level
    (c) servlet/component registration
  
  Steve.
  
  
  
  1.2       +10 -0     avalon/merlin/facilities/http/api/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/facilities/http/api/project.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- project.xml	13 Jan 2004 12:46:54 -0000	1.1
  +++ project.xml	2 Feb 2004 03:29:22 -0000	1.2
  @@ -10,4 +10,14 @@
     <currentVersion>1.0-SNAPSHOT</currentVersion>
     <shortDescription>Avalon HTTP Server API</shortDescription>
   
  +  <dependencies>
  +    
  +    <dependency>
  +      <groupId>avalon-framework</groupId>
  +      <artifactId>avalon-framework-api</artifactId>
  +      <version>4.1.5</version>
  +    </dependency>
  +
  +  </dependencies>
  +
   </project>
  
  
  
  1.3       +23 -0     avalon/merlin/facilities/http/impl/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/facilities/http/impl/project.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- project.xml	14 Jan 2004 16:53:36 -0000	1.2
  +++ project.xml	2 Feb 2004 03:29:22 -0000	1.3
  @@ -17,6 +17,11 @@
         <artifactId>avalon-http-api</artifactId>
         <version>1.0-SNAPSHOT</version>
       </dependency>
  +    <dependency>
  +      <groupId>avalon-http</groupId>
  +      <artifactId>avalon-http-test</artifactId>
  +      <version>1.0-SNAPSHOT</version>
  +    </dependency>
   
       <dependency>
         <groupId>avalon-framework</groupId>
  @@ -39,6 +44,24 @@
         <groupId>servletapi</groupId>
         <artifactId>servletapi</artifactId>
         <version>2.3</version>
  +    </dependency>
  +
  +    <dependency>
  +      <groupId>avalon-meta</groupId>
  +      <artifactId>avalon-meta-api</artifactId>
  +      <version>1.3</version>
  +    </dependency>
  +
  +    <dependency>
  +      <groupId>avalon-composition</groupId>
  +      <artifactId>avalon-composition-api</artifactId>
  +      <version>2.0-SNAPSHOT</version>
  +    </dependency>
  +
  +    <dependency>
  +      <groupId>avalon-activation</groupId>
  +      <artifactId>avalon-activation-api</artifactId>
  +      <version>2.0-SNAPSHOT</version>
       </dependency>
   
       <dependency>
  
  
  
  1.1                  avalon/merlin/facilities/http/test/maven.xml
  
  Index: maven.xml
  ===================================================================
  <project default="jar:install">
  
    <preGoal name="java:compile">
      <attainGoal name="avalon:meta"/>
    </preGoal>
  
  </project>
  
  
  
  1.1                  avalon/merlin/facilities/http/test/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <project>
  
    <extend>${basedir}/../project.xml</extend>
  
    <id>avalon-http-test</id>
    <name>Avalon HTTP Test</name>
    <currentVersion>1.0-SNAPSHOT</currentVersion>
    <shortDescription>Avalon HTTP Test</shortDescription>
    <package>org.apache.avalon.http.impl</package>
  
    <dependencies>
      <dependency>
        <groupId>avalon-framework</groupId>
        <artifactId>avalon-framework-api</artifactId>
        <version>4.1.5</version>
      </dependency>
      <dependency>
        <groupId>servletapi</groupId>
        <artifactId>servletapi</artifactId>
        <version>2.3</version>
      </dependency>
    </dependencies>
    
  </project>
  
  
  
  1.1                  avalon/merlin/facilities/http/test/conf/kernel.xml
  
  Index: kernel.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <kernel>
  
     <logging priority="INFO" name="kernel">
        <category name="/logger" priority="WARN"/>
     </logging>
  
     <repository>
       <hosts>
         <host path="http://dpml.net/"/>
         <host path="http://ibiblio.org/maven/"/>
       </hosts>
     </repository>
  
     <facilities>
  
       <classloader>
         <classpath>
           <repository>
             <resource id="servletapi:servletapi" version="2.3"/>
             <resource id="jetty:org.mortbay.jetty" version="4.2.15"/>
             <resource id="avalon-http:avalon-http-api" version="1.0-SNAPSHOT"/>
             <resource id="avalon-http:avalon-http-impl" version="1.0-SNAPSHOT"/>
             <resource id="avalon-http:avalon-http-listener" version="1.0-SNAPSHOT"/>
             <resource id="xerces:xerces" version="2.4.0"/>
           </repository>
         </classpath>
       </classloader>
  
       <component name="http" 
           class="org.apache.avalon.http.impl.DefaultServer" 
           activation="startup">
         <categories priority="INFO"/>
       </component>
  
       <component name="http-listener" 
           class="org.apache.avalon.http.listener.DefaultHTTPModelListener" 
           activation="startup">
         <categories priority="INFO"/>
       </component>
  
     </facilities>
  
  </kernel>
  
  
  
  
  1.1                  avalon/merlin/facilities/http/test/conf/test.block
  
  Index: test.block
  ===================================================================
  
  <!-- definition of an embedded block -->
  
  <container name="test">
  
     <classloader>
       <classpath>
         <repository>
           <resource id="servletapi:servletapi" version="2.3"/>
           <resource id="avalon-http:avalon-http-test" version="1.0-SNAPSHOT"/>
         </repository>
       </classpath>
     </classloader>
  
     <component name="hello" class="test.http.TestServlet"/>
     
  </container>
  
  
  
  1.1                  avalon/merlin/facilities/http/test/src/java/test/http/TestServlet.java
  
  Index: TestServlet.java
  ===================================================================
  /* 
   * Copyright 2004 Apache Software Foundation
   * Licensed  under the  Apache License,  Version 2.0  (the "License");
   * you may not use  this file  except in  compliance with the License.
   * You may obtain a copy of the License at 
   * 
   *   http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed  under the  License is distributed on an "AS IS" BASIS,
   * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
   * implied.
   * 
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package test.http;
  
  import java.io.IOException;
  import java.io.PrintWriter;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  
  /**
   * Servlet that handles the establishment of a Merlin Kernel
   * and registration of the kernel base URL under the servlet 
   * context using the key.
   * 
   * @avalon.component name="test" lifestyle="transient"
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   */
  public class TestServlet extends HttpServlet
  {
      //----------------------------------------------------------
      // Servlet
      //----------------------------------------------------------
  
      /**
       * Initializes Servlet by the web server container.
       *
       * @exception ServletException if an error occurs
       */
      public void init()
          throws ServletException
      {
          System.out.println( "########### HELLO   ##############" );
      }
  
      /**
       * Disposes of container manager and container instance.
       */
      public void destroy()
      {
          System.out.println( "########### BYE BYE ##############" );
      }
  
      /**
       * Respond to a GET request for the content produced by
       * this servlet.  This method should be overidden in a
       *
       * @param request The servlet request we are processing
       * @param response The servlet response we are producing
       *
       * @exception IOException if an input/output error occurs
       * @exception ServletException if a servlet error occurs
       */
      public void doGet(HttpServletRequest request,
                        HttpServletResponse response)
        throws IOException, ServletException {
  
          response.setContentType("text/html");
          PrintWriter writer = response.getWriter();
          String context = request.getContextPath();
          writer.println("<html>");
          writer.println("<head>");
          writer.println("<title>Test Servlet Info</title>" );
          writer.println("</head>");
          writer.println("<body>" );
          writer.println("<p>I exist!!</p>");
          writer.println("</body>");
          writer.println("</html>");
      }
  }
  
  
  
  1.1                  avalon/merlin/facilities/http/test/src/java/test/http/package.html
  
  Index: package.html
  ===================================================================
  <body>
  <p>
     Servlet containing an embedded merlin kernel.
  </p>
  </body>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org