svn commit: rev 36166 - in avalon/trunk/planet/facilities/http/blocks: . examples examples/etc examples/src examples/src/deliverables examples/src/main examples/src/main/org examples/src/main/org/apache examples/src/main/org/apache/avalon examples/src/main/org/apache/avalon/examples examples/src/main/org/apache/avalon/examples/servlets servlet servlet/etc

[email protected] 10 Aug 2004 09:17:03 -0000
Newsgroups gmane.comp.jakarta.avalon.cvs
Message-ID <[email protected]>
Author: niclas
Date: Tue Aug 10 02:17:02 2004
New Revision: 36166

Added:
   avalon/trunk/planet/facilities/http/blocks/examples/
   avalon/trunk/planet/facilities/http/blocks/examples/build.properties   (contents, props changed)
   avalon/trunk/planet/facilities/http/blocks/examples/build.xml   (contents, props changed)
   avalon/trunk/planet/facilities/http/blocks/examples/etc/
   avalon/trunk/planet/facilities/http/blocks/examples/etc/config.xml   (contents, props changed)
   avalon/trunk/planet/facilities/http/blocks/examples/src/
   avalon/trunk/planet/facilities/http/blocks/examples/src/deliverables/
   avalon/trunk/planet/facilities/http/blocks/examples/src/deliverables/hello.jsp
   avalon/trunk/planet/facilities/http/blocks/examples/src/main/
   avalon/trunk/planet/facilities/http/blocks/examples/src/main/org/
   avalon/trunk/planet/facilities/http/blocks/examples/src/main/org/apache/
   avalon/trunk/planet/facilities/http/blocks/examples/src/main/org/apache/avalon/
   avalon/trunk/planet/facilities/http/blocks/examples/src/main/org/apache/avalon/examples/
   avalon/trunk/planet/facilities/http/blocks/examples/src/main/org/apache/avalon/examples/servlets/
   avalon/trunk/planet/facilities/http/blocks/examples/src/main/org/apache/avalon/examples/servlets/HelloServlet.java   (contents, props changed)
   avalon/trunk/planet/facilities/http/blocks/servlet/
   avalon/trunk/planet/facilities/http/blocks/servlet/build.properties   (contents, props changed)
   avalon/trunk/planet/facilities/http/blocks/servlet/build.xml   (contents, props changed)
   avalon/trunk/planet/facilities/http/blocks/servlet/etc/
   avalon/trunk/planet/facilities/http/blocks/servlet/etc/config.xml   (contents, props changed)
Modified:
   avalon/trunk/planet/facilities/http/blocks/index.xml
Log:
Added a servlet configured context, and a HelloServlet.

Added: avalon/trunk/planet/facilities/http/blocks/examples/build.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/examples/build.properties	Tue Aug 10 02:17:02 2004
@@ -0,0 +1,2 @@
+project.system = ../../../../../central/system
+project.home = ..

Added: avalon/trunk/planet/facilities/http/blocks/examples/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/examples/build.xml	Tue Aug 10 02:17:02 2004
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-http-examples" default="install" basedir="." 
+    xmlns:x="antlib:org.apache.avalon.tools">
+
+  <property file="build.properties"/>
+  <import file="${project.system}/build/standard.xml"/>
+
+  <target name="build" depends="standard.build">
+    <x:block name="demo">
+      <x:include name="server" artifact="block:avalon/http/avalon-http-server#SNAPSHOT"/>
+      <x:include name="context" artifact="block:avalon/http/avalon-http-servlet#SNAPSHOT"/>
+    </x:block>
+  </target>
+
+</project>

Added: avalon/trunk/planet/facilities/http/blocks/examples/etc/config.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/examples/etc/config.xml	Tue Aug 10 02:17:02 2004
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<targets>
+  <target path="/demo/context/servlets">
+    <configuration>
+      <servlets>
+      
+        <servlet>
+          <path>/hello</path>
+          <name>HelloWorld</name>
+          <classname>org.apache.avalon.examples.servlets.HelloServlet</classname>
+        </servlet>
+        
+        <servlet>
+          <path>/jsp</path>
+          <name>hello.jsp</name>
+          <classname>org.apache.jasper.servlet.JspServlet</classname>
+        </servlet>
+        
+      </servlets>
+    </configuration>
+  </target>
+</targets>

Added: avalon/trunk/planet/facilities/http/blocks/examples/src/deliverables/hello.jsp
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/examples/src/deliverables/hello.jsp	Tue Aug 10 02:17:02 2004
@@ -0,0 +1,25 @@
+<html>
+<!--   
+    Copyright 1999-2004 The 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.
+-->
+<body bgcolor="white">
+
+<h1>
+I have been invoked by
+<% out.print (request.getAttribute("servletName").toString()); %>
+Servlet.
+</h1>
+
+</html>
\ No newline at end of file

Added: avalon/trunk/planet/facilities/http/blocks/examples/src/main/org/apache/avalon/examples/servlets/HelloServlet.java
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/examples/src/main/org/apache/avalon/examples/servlets/HelloServlet.java	Tue Aug 10 02:17:02 2004
@@ -0,0 +1,31 @@
+
+package org.apache.avalon.examples.servlets;
+
+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;
+
+public class HelloServlet extends HttpServlet {
+
+    public void doGet(HttpServletRequest request, HttpServletResponse response)
+    throws IOException, ServletException
+    {
+        response.setContentType("text/html");
+        PrintWriter out = response.getWriter();
+        out.println("<html>");
+        out.println("<body>");
+        out.println("<head>");
+        out.println("<title>Hello Merlin!</title>");
+        out.println("</head>");
+        out.println("<body>");
+        out.println("<h1>Hello Merlin!</h1>");
+        out.println("</body>");
+        out.println("</html>");
+    }
+}
+  

Modified: avalon/trunk/planet/facilities/http/blocks/index.xml
==============================================================================
--- avalon/trunk/planet/facilities/http/blocks/index.xml	(original)
+++ avalon/trunk/planet/facilities/http/blocks/index.xml	Tue Aug 10 02:17:02 2004
@@ -112,5 +112,31 @@
     </dependencies>
   </project>
 
+  <project basedir="servlet">
+    <info>
+      <group>avalon/http</group>
+      <name>avalon-http-servlet</name>
+      <type>block</type>
+      <version>1.0.0</version>
+      <status>SNAPSHOT</status> 
+    </info>
+    <dependencies>
+      <include key="avalon-http-impl" />
+      <include key="servletapi" />
+    </dependencies>
+  </project>
+
+  <project basedir="examples">
+    <info>
+      <group>avalon/http</group>
+      <name>avalon-http-examples</name>
+      <version>1.0.0</version>
+      <status>SNAPSHOT</status> 
+    </info>
+    <dependencies>
+      <include key="servletapi" />
+      <include key="avalon-http-servlet" />
+    </dependencies>
+  </project>
 </index>
  

Added: avalon/trunk/planet/facilities/http/blocks/servlet/build.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/servlet/build.properties	Tue Aug 10 02:17:02 2004
@@ -0,0 +1,2 @@
+project.system = ../../../../../central/system
+project.home = ..

Added: avalon/trunk/planet/facilities/http/blocks/servlet/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/servlet/build.xml	Tue Aug 10 02:17:02 2004
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-http-servlet" default="install" basedir="." 
+    xmlns:x="antlib:org.apache.avalon.tools">
+
+  <property file="build.properties"/>
+  <import file="${project.system}/build/standard.xml"/>
+
+  <target name="build" depends="standard.build">
+    <x:block name="static">
+      <x:component name="context" class="org.apache.avalon.http.impl.HttpContextImpl"/>
+      <x:component name="security-handler" class="org.apache.avalon.http.impl.SecurityHandler"/>
+      <x:component name="servlets" class="org.apache.avalon.http.impl.ServletHandler" />
+      <x:component name="resource-handler" class="org.apache.avalon.http.impl.ResourceHandler">
+        <x:parameters>
+          <x:parameter name="allow-directory" value="true"/>
+          <x:parameter name="allow-methods" value="GET"/>
+        </x:parameters>
+      </x:component>
+      <x:component name="notfound-handler" class="org.apache.avalon.http.impl.NotFoundHandler"/>
+      <x:component name="request-log" class="org.apache.avalon.http.impl.NcsaRequestLog">
+        <x:parameters>
+          <x:parameter name="filename" value="static_request.log"/>
+          <x:parameter name="append" value="true"/>
+          <x:parameter name="extended" value="true"/>
+        </x:parameters>
+      </x:component>
+    </x:block>
+  </target>
+
+</project>

Added: avalon/trunk/planet/facilities/http/blocks/servlet/etc/config.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/blocks/servlet/etc/config.xml	Tue Aug 10 02:17:02 2004
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<targets>
+
+  <target path="/demo/context">
+    <configuration>
+      <context-path>/servlet</context-path>
+      <resource-base>.</resource-base>
+    </configuration>
+  </target>
+  
+</targets>