Return-Path: Delivered-To: apmail-incubator-sling-commits-archive@locus.apache.org Received: (qmail 12814 invoked from network); 8 Jan 2008 13:17:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Jan 2008 13:17:11 -0000 Received: (qmail 86454 invoked by uid 500); 8 Jan 2008 13:17:00 -0000 Delivered-To: apmail-incubator-sling-commits-archive@incubator.apache.org Received: (qmail 86411 invoked by uid 500); 8 Jan 2008 13:17:00 -0000 Mailing-List: contact sling-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sling-dev@incubator.apache.org Delivered-To: mailing list sling-commits@incubator.apache.org Received: (qmail 86402 invoked by uid 99); 8 Jan 2008 13:17:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jan 2008 05:17:00 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jan 2008 13:16:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 603BF1A9850; Tue, 8 Jan 2008 05:16:46 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r609964 - in /incubator/sling/trunk/usling: usling-servlets/ usling-servlets/src/ usling-servlets/src/main/ usling-servlets/src/main/java/ usling-servlets/src/main/java/org/ usling-servlets/src/main/java/org/apache/ usling-servlets/src/main... Date: Tue, 08 Jan 2008 13:16:45 -0000 To: sling-commits@incubator.apache.org From: bdelacretaz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080108131646.603BF1A9850@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bdelacretaz Date: Tue Jan 8 05:16:38 2008 New Revision: 609964 URL: http://svn.apache.org/viewvc?rev=609964&view=rev Log: SLING-149 - usling-servlets module added, OSGi bundle meant for usling standard servlets Added: incubator/sling/trunk/usling/usling-servlets/ incubator/sling/trunk/usling/usling-servlets/pom.xml (with props) incubator/sling/trunk/usling/usling-servlets/src/ incubator/sling/trunk/usling/usling-servlets/src/main/ incubator/sling/trunk/usling/usling-servlets/src/main/java/ incubator/sling/trunk/usling/usling-servlets/src/main/java/org/ incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/ incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/ incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/ incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/ incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java (with props) incubator/sling/trunk/usling/usling-servlets/src/main/resources/ incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/ incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/ incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties (with props) Modified: incubator/sling/trunk/usling/usling-webapp/ (props changed) incubator/sling/trunk/usling/usling-webapp/pom.xml Added: incubator/sling/trunk/usling/usling-servlets/pom.xml URL: http://svn.apache.org/viewvc/incubator/sling/trunk/usling/usling-servlets/pom.xml?rev=609964&view=auto ============================================================================== --- incubator/sling/trunk/usling/usling-servlets/pom.xml (added) +++ incubator/sling/trunk/usling/usling-servlets/pom.xml Tue Jan 8 05:16:38 2008 @@ -0,0 +1,78 @@ + + + + 4.0.0 + + org.apache.sling + sling + 1-incubator-SNAPSHOT + ../../parent/pom.xml + + + org.apache.sling.usling.servlets + bundle + 2.0.0-incubator-SNAPSHOT + + µsling Web Application + The µsling servlets implement the standard µsling behaviour. See SLING-149. + + + scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/usling/usling-servlets + scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/usling/usling-servlets + http://svn.apache.org/viewvc/incubator/sling/trunk/usling/usling-servlets + + + + + + org.apache.felix + maven-scr-plugin + + + + org.apache.felix + maven-bundle-plugin + true + + + org.apache.sling.usling.servlets.* + + + + + + + + + org.osgi + osgi_R4_core + + + org.osgi + osgi_R4_compendium + + + javax.servlet + servlet-api + + + + Propchange: incubator/sling/trunk/usling/usling-servlets/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java URL: http://svn.apache.org/viewvc/incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java?rev=609964&view=auto ============================================================================== --- incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java (added) +++ incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java Tue Jan 8 05:16:38 2008 @@ -0,0 +1,95 @@ +package org.apache.sling.usling.servlets; + +import java.io.IOException; +import java.util.Date; +import java.util.Dictionary; + +import javax.servlet.GenericServlet; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.service.component.ComponentContext; +import org.osgi.service.http.HttpService; +import org.osgi.service.log.LogService; + +/** usling main servlet + * + * @scr.component immediate="true" + * label="%UslingMainServlet.name" + * description="%UslingMainServlet.description" + * @scr.property name="service.vendor" value="The Apache Software Foundation" + * @scr.property name="service.description" value="usling main servlet" + * + */ +public class UslingMainServlet extends GenericServlet { + + private static final long serialVersionUID = 6895263078698789849L; + + /** + * HttpService, provided by OSGi, with which we register + * this servlet. + * + * @scr.reference + */ + private HttpService httpService; + + /** + * OSGi LogService + * @scr.reference + */ + private LogService logService; + + /** + * @scr.property value="/" + */ + private static final String PROP_SERVLET_MOUNT_POINT = "servlet.mount.point"; + private String mountPoint; + + /** Process a servlet request */ + public void service(ServletRequest sReq, ServletResponse sResp) + throws ServletException, IOException { + + final HttpServletRequest req = (HttpServletRequest) sReq; + final HttpServletResponse resp = (HttpServletResponse) sResp; + + resp.setContentType("text/plain"); + String msg = getClass().getName() + " - this Servlet does nothing useful yet"; + msg += " - it is now " + new Date(); + resp.getOutputStream().write(msg.getBytes()); + resp.getOutputStream().flush(); + } + + /** Called by OSGi to activate this service */ + protected void activate(ComponentContext context) throws Exception { + final Dictionary config = context.getProperties(); + mountPoint = getProperty(config, PROP_SERVLET_MOUNT_POINT, "/"); + logService.log(LogService.LOG_INFO, "Registering " + getClass().getSimpleName() + " on mount point " + mountPoint); + httpService.registerServlet(mountPoint, this, config, null); + } + + /** Called by OSGi to deactivate this service */ + protected void deactivate(ComponentContext context) throws Exception { + logService.log(LogService.LOG_INFO, "Unregistering " + getClass().getSimpleName() + " from mount point " + mountPoint); + httpService.unregister(mountPoint); + } + + /** + * Returns the named property from the given configuration, or + * def if the value does not exist. + */ + private String getProperty(Dictionary config, String name, String def) { + final Object value = config.get(name); + if (value instanceof String) { + return (String) value; + } + + if (value == null) { + return def; + } + + return String.valueOf(value); + } +} Propchange: incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/sling/trunk/usling/usling-servlets/src/main/java/org/apache/sling/usling/servlets/UslingMainServlet.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Rev URL Added: incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties URL: http://svn.apache.org/viewvc/incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=609964&view=auto ============================================================================== --- incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties (added) +++ incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties Tue Jan 8 05:16:38 2008 @@ -0,0 +1,26 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +# +# This file contains localization strings for configuration labels and +# descriptions as used in the metatype.xml descriptor generated by the +# the Sling SCR plugin + +UslingMainServlet.name = µsling main servlet +UslingMainServlet.description = Routes HTTP request to the µsling default servlets \ No newline at end of file Propchange: incubator/sling/trunk/usling/usling-servlets/src/main/resources/OSGI-INF/metatype/metatype.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/sling/trunk/usling/usling-webapp/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Tue Jan 8 05:16:38 2008 @@ -3,3 +3,4 @@ .classpath sling target +.externalToolBuilders Modified: incubator/sling/trunk/usling/usling-webapp/pom.xml URL: http://svn.apache.org/viewvc/incubator/sling/trunk/usling/usling-webapp/pom.xml?rev=609964&r1=609963&r2=609964&view=diff ============================================================================== --- incubator/sling/trunk/usling/usling-webapp/pom.xml (original) +++ incubator/sling/trunk/usling/usling-webapp/pom.xml Tue Jan 8 05:16:38 2008 @@ -57,7 +57,23 @@ - + + + + maven-clean-plugin + + + + sling + + + + + + org.mortbay.jetty maven-jetty-plugin 6.1.5 @@ -81,12 +97,12 @@ - org.apache.maven.plugins maven-dependency-plugin + unpack-dependencies unpack-dependencies @@ -99,6 +115,20 @@ true + + + copy-dependencies + + copy-dependencies + + + ${project.build.directory}/${project.build.finalName}/WEB-INF/resources/bundles + true + + + org.apache.sling.usling.servlets + + @@ -139,6 +169,7 @@ + @@ -170,7 +201,6 @@ org.apache.sling.launcher.app 2.0.0-incubator-SNAPSHOT - org.eclipse.equinox.http servlet @@ -184,13 +214,12 @@ servlet-api - org.apache.sling - org.apache.sling.osgi.console.web + org.apache.sling.usling.servlets 2.0.0-incubator-SNAPSHOT - +