felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From don...@apache.org
Subject svn commit: r536512 - in /felix/sandbox/donsez/http.webadmin: ./ doc/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/felix/ src/main/java/org/apache/felix/http/ src/main/java/org/apache/felix/http/ut...
Date Wed, 09 May 2007 13:21:31 GMT
Author: donsez
Date: Wed May  9 06:21:29 2007
New Revision: 536512

URL: http://svn.apache.org/viewvc?view=rev&rev=536512
Log:
creation of the bundle http.webadmin

Added:
    felix/sandbox/donsez/http.webadmin/
    felix/sandbox/donsez/http.webadmin/doc/
    felix/sandbox/donsez/http.webadmin/doc/url.txt   (with props)
    felix/sandbox/donsez/http.webadmin/pom.xml   (with props)
    felix/sandbox/donsez/http.webadmin/src/
    felix/sandbox/donsez/http.webadmin/src/main/
    felix/sandbox/donsez/http.webadmin/src/main/java/
    felix/sandbox/donsez/http.webadmin/src/main/java/org/
    felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/
    felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/
    felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/
    felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/
    felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/GenericHttpContext.java   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/MIMETypeUtil.java   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/webadmin/
    felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/webadmin/WebAdmin.java   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/
    felix/sandbox/donsez/http.webadmin/src/main/resources/OSGI-INF/
    felix/sandbox/donsez/http.webadmin/src/main/resources/OSGI-INF/component.xml   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/WEB-INF/
    felix/sandbox/donsez/http.webadmin/src/main/resources/WEB-INF/mimetype.txt   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/README.txt   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/Thumbs.db   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/active.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/cancel.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/info.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/installed.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/resolved.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/start.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/starting.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/stop.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/stopping.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/uninstall.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/uninstalled.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/update.png   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/index.html   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/json.js   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/logofelix.jpg   (with props)
    felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/style.css   (with props)

Added: felix/sandbox/donsez/http.webadmin/doc/url.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/doc/url.txt?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/doc/url.txt (added)
+++ felix/sandbox/donsez/http.webadmin/doc/url.txt Wed May  9 06:21:29 2007
@@ -0,0 +1,9 @@
+Try those URLs in your web browser !
+
+http://localhost:8080/admin/bundles
+
+http://localhost:8080/admin/index.html
+http://localhost:8080/admin/bundles?mimetype=text/javascript
+The 2 last ones do not work fine with IE
+
+

Propchange: felix/sandbox/donsez/http.webadmin/doc/url.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/http.webadmin/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/pom.xml?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/pom.xml (added)
+++ felix/sandbox/donsez/http.webadmin/pom.xml Wed May  9 06:21:29 2007
@@ -0,0 +1,122 @@
+<!--
+ 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.
+-->
+<project>
+
+	<properties>
+		<repositoryLocation>http://www-adele.imag.fr/users/Didier.Donsez/dev/felix/sandbox/</repositoryLocation>
+		<description>provides a HTML GUI to manage the framework.</description>
+	</properties>  
+            
+  <parent>
+    <groupId>org.apache.felix</groupId>
+    <artifactId>felix</artifactId>
+    <version>0.9.0-incubator-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>bundle</packaging>
+  <name>Apache Felix WebAdmin</name>
+  <artifactId>org.apache.felix.http.webadmin</artifactId>
+  <description>${description}</description>
+  <dependencies>
+
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    
+<!--
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.apache.felix.shell</artifactId>
+      <version>${pom.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.apache.felix.bundlerepository</artifactId>
+      <version>${pom.version}</version>
+      <scope>provided</scope>
+    </dependency>
+-->
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>javax.servlet</artifactId>
+      <version>${pom.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    
+    
+    
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>          
+          	<!-- docs in http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html and http://cwiki.apache.org/FELIX/osgi-plugin-for-maven-2.html -->
+          	
+            <Private-Package>org.apache.felix.http.*</Private-Package>
+            <Import-Package>*</Import-Package>
+            
+            
+            <Import-Service>org.osgi.service.http.HttpService</Import-Service>
+
+			<Service-Component>OSGI-INF/component.xml</Service-Component>            
+
+            <Bundle-DocURL>${repositoryLocation}${pom.artifactId}/index.html</Bundle-DocURL>
+            <Bundle-Url>${repositoryLocation}${pom.artifactId}/${pom.artifactId}-${pom.version}.jar</Bundle-Url>
+            <Bundle-Source>${repositoryLocation}${pom.artifactId}/${pom.artifactId}-${pom.version}-src.jar</Bundle-Source>
+
+            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+            <Bundle-Description>${description}</Bundle-Description>
+            <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <!--
+  <repositories>
+    <repository>
+      <id>apache.m2.incubator</id>
+      <name>Apache M2 Incubator Repository</name>
+      <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+    </repository>
+  </repositories>
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache.m2.incubator</id>
+      <name>Apache M2 Incubator Repository</name>
+      <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+    </pluginRepository>
+  </pluginRepositories>
+  -->
+</project>

Propchange: felix/sandbox/donsez/http.webadmin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/GenericHttpContext.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/GenericHttpContext.java?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/GenericHttpContext.java (added)
+++ felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/GenericHttpContext.java Wed May  9 06:21:29 2007
@@ -0,0 +1,82 @@
+package org.apache.felix.http.util;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osgi.service.http.HttpContext;
+
+/**
+ * provides a generic Http Context to register servlets and static docs
+ * @author Didier Donsez
+ */
+public class GenericHttpContext implements HttpContext {
+
+	
+	private Map extensionToMimeTypeMap;
+	// TODO 
+	private Map credentials;
+	
+	/**
+	 * @param is
+	 */
+	public GenericHttpContext(InputStream is){
+		extensionToMimeTypeMap=MIMETypeUtil.getExtensionToMimeTypeMap(is);
+	}
+
+	public GenericHttpContext(){
+		extensionToMimeTypeMap=MIMETypeUtil.getExtensionToMimeTypeMap();
+	}
+
+
+	public void resetExtensionToMimeTypeMap() {
+		extensionToMimeTypeMap=MIMETypeUtil.getExtensionToMimeTypeMap();
+	}
+
+	public void setExtensionToMimeTypeMap(InputStream stream) {
+		Map temp=MIMETypeUtil.getExtensionToMimeTypeMap(stream);
+		if(temp==null) return; // do nothing
+		extensionToMimeTypeMap=temp;
+	}
+
+	public void addExtensionToMimeType(String extension, String mimetype) {
+		extensionToMimeTypeMap.put(extension,mimetype);
+	}
+
+	public void removeExtensionToMimeType(String extension) {
+		extensionToMimeTypeMap.remove(extension);
+	}
+
+	public void removeAllExtensionToMimeTypes() {
+		extensionToMimeTypeMap=new HashMap();
+	}
+
+	
+	public String getMimeType(String name) {
+		int pos=name.lastIndexOf('.');
+		if(pos==-1 || pos==0 || pos==name.length()-1)
+			return null;
+		String extension=name.substring(pos+1);
+		return (String)extensionToMimeTypeMap.get(extension);
+		
+	}
+
+	/**
+	 * TODO add a simple textfile security realm 
+	 * for instance http://httpd.apache.org/docs/2.0/howto/htaccess.html
+	 */
+	public boolean handleSecurity(
+		HttpServletRequest req,
+		HttpServletResponse resp) {
+		return true;
+	}
+
+	public URL getResource(String name) {
+		URL u = this.getClass().getResource(name);
+		return u;
+	}
+}

Propchange: felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/GenericHttpContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/MIMETypeUtil.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/MIMETypeUtil.java?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/MIMETypeUtil.java (added)
+++ felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/MIMETypeUtil.java Wed May  9 06:21:29 2007
@@ -0,0 +1,66 @@
+package org.apache.felix.http.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+/**
+ * TODO
+ * <p>For more information about MIME types
+ * please read RFC 2045, 2046, 2047, 2048, and 2077. 
+ * @author Didier Donsez
+ *
+ */
+public class MIMETypeUtil {
+
+	static public Map getExtensionToMimeTypeMap(InputStream inputStream){
+		// TODO skip #, "", ...
+		Map map=new HashMap();
+		BufferedReader bf=null;
+		try {
+			bf= new BufferedReader(new InputStreamReader(inputStream) );
+			String line;
+			while ((line = bf.readLine())!=null){
+				// TODO skip #, "", ...
+				if(line.length()==0 || line.startsWith("#") || line.startsWith(" "))
+					continue;
+				StringTokenizer st=new StringTokenizer(line," \t");
+				if(st.countTokens()==1)
+					continue;
+				String mimetype=st.nextToken();
+				while(st.hasMoreTokens()){
+					map.put(st.nextToken(),mimetype);
+				}
+			}
+		} catch (Exception e) {
+			e.printStackTrace(System.err);
+			return null;
+		} finally {
+			try {
+				bf.close();
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		return map;
+	}
+
+	static public Map getExtensionToMimeTypeMap(){
+		Map map=new HashMap();
+		map.put("htm","text/html");
+		map.put("html","text/html");
+		map.put("xml","text/xml");
+		map.put("xsl","text/xml");
+		map.put("css","text/css");
+		map.put("js","text/javascript");
+		map.put("jpg","image/jpeg");
+		map.put("jpeg","image/jpeg");
+		map.put("png","image/png");
+		map.put("gif","image/gif");
+		return map;
+	}
+}

Propchange: felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/util/MIMETypeUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/webadmin/WebAdmin.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/webadmin/WebAdmin.java?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/webadmin/WebAdmin.java (added)
+++ felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/webadmin/WebAdmin.java Wed May  9 06:21:29 2007
@@ -0,0 +1,582 @@
+package org.apache.felix.http.webadmin;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.felix.http.util.GenericHttpContext;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.log.LogService;
+
+/**
+ * Servlet to manage the framework. It is also a SCR component.
+ * <p>TODOLIST
+ * <ul>
+ * <li>improve CSS default style</li>
+ * <li>add a info action displaying the bundle details (popup div, message div, ... ?)</li>
+ * <li>add a shell page</li>
+ * <li>add a obr page</li>
+ * </ul>
+ * @author Didier Donsez
+ *
+ */
+public class WebAdmin extends HttpServlet {
+
+	private static final boolean TRACE=true;
+	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	
+	private final static String WEBROOT = "/webroot";
+	private final static String WEBROOT_ALIAS = "/admin";
+	private final static String SERVLET_ALIAS = "/admin/bundles";
+
+	
+	// set in activate() !!
+	private BundleContext bundleContext;
+	
+    private HttpService httpService=null;
+    private Servlet myServlet=null;
+    private Dictionary myServletInitParams=null;
+
+    private HttpContext myHttpContext=null;
+
+    // set in init()
+    private ServletConfig servletConfig=null;    
+    
+    public WebAdmin() {
+        myServlet=this;
+
+        myServletInitParams=new Hashtable();
+        // there are only samples !
+        myServletInitParams.put("webinf.dir","/WEB-INF");
+        myServletInitParams.put("webroot.dir","/webroot");
+        myServletInitParams.put("mimetype.file","/WEB-INF/mimetype.txt");
+        myServletInitParams.put("htaccess.file","/WEB-INF/.htaccess");
+        myServletInitParams.put("icons.uri","icons");
+        
+        myHttpContext = new GenericHttpContext();
+        // MIME types defined in /WEB-INF/mimetype.txt are loaded 
+        // during activate() call just after bindHttpService() calls   	
+    }
+    
+    // callback methods for <requires service="org.osgi.service.http.HttpService" ...
+    
+    public void bindHttpService(HttpService ref){
+    	httpService=ref;
+    	try {    		
+    		// remark: before activate() invocation, myHttpContext does not deal
+    		// with the MIME type defined in /WEB-INF/mimetype.txt
+    		// This is a limit of the SCR !
+	    	httpService.registerServlet(SERVLET_ALIAS, myServlet, myServletInitParams, myHttpContext);
+	    	httpService.registerResources(WEBROOT_ALIAS, WEBROOT, myHttpContext);
+    	} catch (Exception e) {
+    		if(logService!=null) {
+    			logService.log(LogService.LOG_ERROR,"error while servlet registration",e);
+    		} else {
+    			e.printStackTrace(System.err);
+    		}
+    	}
+    }
+
+    public void unbindHttpService(HttpService ref){
+    	httpService.unregister(SERVLET_ALIAS);
+    	httpService.unregister(WEBROOT_ALIAS);
+    	httpService=null;
+    }
+
+
+    // callback methods for <requires service="org.osgi.service.log.LogService" ...
+    private LogService logService = null;
+
+    public void bindLogService(LogService ref){
+    	logService=ref;
+    }
+
+    public void unbindLogService(LogService ref){
+    	logService=null;
+    }
+
+	/**
+	 * @param componentContext
+	 */
+	public void activate(ComponentContext componentContext) {
+		trace(this.toString()+": call activate()");
+		bundleContext=componentContext.getBundleContext();
+		try {
+			((GenericHttpContext)myHttpContext).setExtensionToMimeTypeMap(bundleContext.getBundle().getResource("/WEB-INF/mimetype.txt").openStream());
+		} catch(Exception e) {
+			// do nothing
+		}
+	}
+
+	/**
+	 * @param componentContext
+	 */
+	public void deactivate(ComponentContext componentContext) {
+		trace(this.toString()+": call desactivate()");
+	}
+	
+	/* 
+	 * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
+	 */
+	public void init(ServletConfig servletConfig){
+		trace(this.toString()+": call init()");
+		Enumeration enumeration=servletConfig.getInitParameterNames();
+		if(!enumeration.hasMoreElements())
+			trace(this.toString()+": no init parameters");
+		else {
+			trace(this.toString()+": init parameters are :");
+			while(enumeration.hasMoreElements()){
+				String name=(String) enumeration.nextElement();
+				trace(name+"="+servletConfig.getInitParameter(name));				
+			}
+		}
+	}
+	
+	/*
+	 * @see javax.servlet.Servlet#destroy()
+	 */
+	public void destroy(){
+		trace(this.toString()+": call destroy()");
+		// make persistent some variables by using bundleContext.getDataFile("/STATE-INF/state.save.txt") !
+		// here or in deactivate()
+	}
+	
+	/**
+	 *  Handle a GET call from the client
+	 *
+	 * @param request HTTP request information from the client
+	 * @param response HTTP channel back to the client browser
+	 * @throws IOException If there is an IO problem
+	 * @throws ServletException if there is a proble with the servlet processing
+	 **/
+	public void doGet(HttpServletRequest request, HttpServletResponse response)
+		throws IOException, ServletException {
+		trace(this.toString()+": call doGet()");
+		doPostGet(request, response);
+	}
+
+	/**
+	 *  Handle a POST call from the client
+	 *
+	 * @param request HTTP request information from the client
+	 * @param response HTTP channel back to the client browser
+	 * @throws IOException If there is an IO problem
+	 * @throws ServletException if there is a proble with the servlet processing
+	 **/
+	public void doPost(
+			HttpServletRequest request,
+			HttpServletResponse response)
+			throws IOException, ServletException {
+		trace(this.toString()+": call doPost()");
+		doPostGet(request, response);
+	}
+	
+	/**
+	 *  Handle a POST and GET call from the client
+	 *
+	 * @param request HTTP request information from the client
+	 * @param response HTTP channel back to the client browser
+	 * @throws IOException If there is an IO problem
+	 * @throws ServletException if there is a proble with the servlet processing
+	 **/
+	protected void doPostGet(
+		HttpServletRequest request,
+		HttpServletResponse response)
+		throws IOException, ServletException {
+
+		// text/html, text/xml, text/vnd.wap.wml, text/plain, text/csv (ie Column Separated Values)...
+		String mimetype = request.getParameter("mimetype");
+		
+		if(mimetype!=null && mimetype.equals("text/javascript")) {
+			doPostJSON(request,response);
+		} else 	if(mimetype!=null && mimetype.equals("text/xml")) {
+			doPostXML(request,response);
+		} else {
+			doPostHTML(request,response);			
+		}	
+	}
+
+	/**
+	 *  Handle a POST call from the AJAX client
+	 *
+	 * @param request HTTP request information from the client
+	 * @param response HTTP channel back to the client browser
+	 * @throws IOException If there is an IO problem
+	 * @throws ServletException if there is a proble with the servlet processing
+	 **/
+	private void doPostJSON(
+		HttpServletRequest request,
+		HttpServletResponse response)
+		throws IOException, ServletException {
+	
+		final String mimetype="text/javascript";
+		String action = request.getParameter("action");
+		String bidstr = request.getParameter("bid");
+		String url = request.getParameter("url"); // for install
+
+		doAction(action,bidstr,url,mimetype);
+		
+		response.setHeader("Cache-Control", "no-cache");
+		// for JSON
+		response.setContentType(mimetype);
+		PrintWriter pw=new PrintWriter(response.getWriter());		
+		
+		Bundle[] bundles=bundleContext.getBundles();
+		pw.println("{\"bundles\": [");
+		for (int i = 0; i < bundles.length; i++) {
+			Bundle bundle = bundles[i];
+			if(i!=0) pw.println(",");
+			pw.println("{");
+
+			long bid=bundle.getBundleId();
+			Dictionary headers=bundle.getHeaders();
+			
+			pw.print("\"id\":");
+			pw.print(bid);
+			pw.println(",");
+
+			pw.print("\"state\":");
+			pw.print(bundle.getState());
+			pw.println(",");
+
+			pw.print("\"name\":\"");
+			pw.print(headers.get(Constants.BUNDLE_NAME));
+			pw.println("\",");
+			
+			pw.print("\"symbolicname\":\"");
+			pw.print(bundle.getSymbolicName());
+			pw.println("\",");
+
+			pw.print("\"location\":\"");
+			pw.print(bundle.getLocation());
+			pw.println("\",");
+
+			pw.print("\"lastModified\":");
+			pw.print(bundle.getLastModified());
+			pw.println();				
+			
+			pw.println("}");				
+		}			
+		pw.println("]}");
+	}
+
+	private String getStateStr(int state){
+		String stateStr=null;
+		switch(state){
+			case Bundle.ACTIVE: stateStr="ACTIVE"; break;
+			case Bundle.INSTALLED: stateStr="INSTALLED"; break;
+			case Bundle.RESOLVED: stateStr="RESOLVED"; break;
+			case Bundle.STARTING: stateStr="STARTING"; break;
+			case Bundle.STOPPING: stateStr="STOPPING"; break;
+			case Bundle.UNINSTALLED: stateStr="UNINSTALLED"; break;
+			default: stateStr="UNKNOWN STATE"; break;
+		}
+		return stateStr;
+	}
+
+	private String getStateStrIcon(int state){
+		StringBuffer stateStr=new StringBuffer();
+		stateStr.append("<img src='icons/");
+		switch(state){
+			case Bundle.ACTIVE: stateStr.append("active.png' alt='ACTIVE'"); break;
+			case Bundle.INSTALLED: stateStr.append("installed.png' alt='INSTALLED'"); break;
+			case Bundle.RESOLVED: stateStr.append("resolved.png' alt='RESOLVED'"); break;
+			case Bundle.STARTING: stateStr.append("starting.png' alt='STARTING'"); break;
+			case Bundle.STOPPING: stateStr.append("stopping.png' alt='STOPPING'"); break;
+			case Bundle.UNINSTALLED: stateStr.append("uninstalled.png' alt='UNINSTALLED'"); break;
+			default: stateStr.append("unknown.png' alt='UNKNOWN STATE'"); break;
+		}
+		stateStr.append(">");
+		return stateStr.toString();
+	}
+	
+	
+	/**
+	 *  Handle a POST call from the Web browser client
+	 *
+	 * @param request HTTP request information from the client
+	 * @param response HTTP channel back to the client browser
+	 * @throws IOException If there is an IO problem
+	 * @throws ServletException if there is a proble with the servlet processing
+	 **/
+	private void doPostHTML(
+		HttpServletRequest request,
+		HttpServletResponse response)
+		throws IOException, ServletException {
+	
+		final String mimetype="text/html";
+		String xslt = request.getParameter("xslt"); // TODO: only with text/xml
+	
+		String css = request.getParameter("css"); // only with text/html
+		if(css==null) css=WEBROOT_ALIAS+"/style.css";
+	
+		
+		String title = request.getParameter("title");
+		if(title==null){
+			title="Web Admin";
+		}
+	
+		String action = request.getParameter("action");
+		String bidstr = request.getParameter("bid"); // for start,stop,update,install
+		String url = request.getParameter("url"); // for install
+	
+		response.setHeader("Cache-Control", "no-cache");
+		
+		response.setContentType("text/html");
+		PrintWriter pw = response.getWriter();
+		pw.println("<html>");
+		pw.println("<head>");
+		pw.print("<title>");
+		pw.print(title);
+		pw.println("</title>");
+		if (css != null)
+			pw.println(
+				"<link rel='stylesheet' type='text/css' href='"
+					+ css
+					+ "'>");
+		pw.println("</head>");
+		pw.println("<body>");
+
+		// should be replaced by a CSS
+		pw.println("<center>");
+
+		pw.println("<h1>");
+		String vendor=bundleContext.getProperty(Constants.FRAMEWORK_VENDOR);
+		if(vendor!=null && vendor.startsWith("Apache"))
+			pw.print("<img src='"+WEBROOT_ALIAS+"/logofelix.jpg'> ");
+		pw.print(title);
+		pw.println("</h1>");
+
+		
+		pw.println("<form name='install' method='POST' action='"+SERVLET_ALIAS+"'>");
+		pw.println("<input name='url' type='text' size='60' value='http://'>");
+		pw.println("<button type='submit' name='action' value='install'>Install</button>");
+		pw.println("</form>");
+
+		pw.println("<form name='refresh' method='POST' action='"+SERVLET_ALIAS+"'>");
+		pw.println("<button type='submit' name='action' value='refresh'>Refresh</button>");
+		pw.println("</form>");
+				
+
+		pw.println("<div id='message'");
+		String message=doAction(action,bidstr,url,mimetype);
+		if(message.length()!=0) {
+			pw.println("<hr class='message'>");
+			if(message.startsWith("Error")) pw.println("<font color='red'>");
+			pw.println(message);
+			if(message.startsWith("Error")) pw.println("</font>");
+			pw.println("<hr class='message'>");
+		}
+		pw.println("</div>");
+		
+		
+		pw.println("<table class='bundles'>");
+		
+		Bundle[] bundles=bundleContext.getBundles();
+		for (int i = 0; i < bundles.length; i++) {
+			Bundle bundle = bundles[i];
+			pw.println("<tr>");
+			
+			long bid=bundle.getBundleId();
+			Dictionary headers=bundle.getHeaders();
+			
+			pw.println("<td class='id'>");
+			pw.println(bid);
+			pw.println("</td>");
+			
+			pw.println("<td class='state'>");
+			// Should be replaced by open-source icons (with alt) : for instance red, orange, green, and anim gif for starting and stopping !
+			pw.println(getStateStrIcon(bundle.getState()));
+			pw.println("</td>");
+			
+			pw.println("<td class='name'>");
+			pw.println(headers.get(Constants.BUNDLE_NAME)) ; // something null
+			String version=(String)headers.get(Constants.BUNDLE_VERSION);
+			if(version!= null) {
+				pw.println(" <font size='-1'>(");
+				pw.println(version);
+				pw.println(")</font>");
+			}
+			pw.println("<br>");
+			
+			pw.println(headers.get("Bundle-SymbolicName"));
+			//pw.println(bundle.getSymbolicName());  // something null and not supported by R3 !
+
+			pw.println("</td>");
+			
+			
+			// Should be replaced by open-source icons (with alt)
+			pw.println("<td class='action'>");
+			pw.println(getActionFormIcon(bid));
+			pw.println("</td>");
+			
+			pw.println("</tr>");				
+		}			
+		pw.println("</table>");
+		
+		// should be replaced by a CSS
+		pw.println("</center>");
+
+		pw.print("</body>");			
+		pw.print("</html>");			
+	
+	}
+
+	/**
+	 * TODO give various info on the gateway
+	 * @return
+	 */
+	private String getGatewayInfo(){
+//		Constants.FRAMEWORK_VERSION - The OSGi Framework version. 
+//		Constants.FRAMEWORK_VENDOR - The Framework implementation vendor. 
+//		Constants.FRAMEWORK_LANGUAGE - The language being used. See ISO 639 for possible values. 
+//		Constants.FRAMEWORK_OS_NAME - The host computer operating system. 
+//		Constants.FRAMEWORK_OS_VERSION - The host computer operating system version number. 
+//		Constants.FRAMEWORK_PROCESSOR - The host computer processor name. 
+		
+// 		HOSTNAME, ...		
+		
+		return null;
+	}
+	
+	private String getActionForm(long bid) {
+		StringBuffer sb=new StringBuffer();
+		sb.append("<a href='"+SERVLET_ALIAS+"?action=start&bid="+bid+"'>Start</a>");
+		sb.append("|");
+		sb.append("<a href='"+SERVLET_ALIAS+"?action=stop&bid="+bid+"'>Stop</a>");
+		sb.append("|");
+		sb.append("<a href='"+SERVLET_ALIAS+"?action=update&bid="+bid+"'>Update</a>");
+		sb.append("|");
+		sb.append("<a href='"+SERVLET_ALIAS+"?action=uninstall&bid="+bid+"'>Uninstall</a>");
+		sb.append("|");
+		sb.append("<a href='"+SERVLET_ALIAS+"?action=info&bid="+bid+"'>Info</a>");
+		return sb.toString();
+	}
+
+	private String getActionFormIcon(long bid) {
+		StringBuffer sb=new StringBuffer();
+		sb.append("<a href='"+SERVLET_ALIAS+"?action=start&bid="+bid+"'><img src='icons/start.png' alt='Start' border='0'></a>");
+		sb.append("<a href='"+SERVLET_ALIAS+"?action=stop&bid="+bid+"'><img src='icons/stop.png' alt='Stop' border='0'></a>");
+		sb.append("<a href='"+SERVLET_ALIAS+"?action=update&bid="+bid+"'><img src='icons/update.png' alt='Update' border='0'></a>");
+		sb.append("<a href='"+SERVLET_ALIAS+"?action=uninstall&bid="+bid+"'><img src='icons/uninstall.png' alt='Uninstall' border='0'></a>");
+		sb.append("<a href='"+SERVLET_ALIAS+"?action=info&bid="+bid+"'><img src='icons/info.png' alt='Info' border='0'></a>");
+		return sb.toString();
+	}
+
+	/**
+	 * do the action (start,stop,install,update,uninstall the bundle or nothing)
+	 * <p>TODO the mimetype differenciation
+	 * @param action action to do
+	 * @param bidstr bundle id to start,stop,install or update
+	 * @param url url of the bundle to install
+	 * @param mimetype the expected MIME type for the output
+	 * @return a message to display
+	 */
+	private String doAction(String action, String bidstr, String url, String mimetype) {
+		StringBuffer message=new StringBuffer();
+		if(action!=null && !action.equalsIgnoreCase("refresh")){
+			if(action.equalsIgnoreCase("install")){
+				if(url!=null) {
+					try {
+						Bundle bundle=bundleContext.installBundle(url);
+						if(bundle==null) message.append("Error: the bundle is not installed");
+					} catch (BundleException e) {
+						message.append("Error: "+e.getMessage());
+					}											
+				} else {
+					message.append("Error: fill the url");						
+				}
+			} else {
+				if(bidstr==null) {
+				}
+				try {
+					long bid;
+					bid=Long.parseLong(bidstr);						
+
+					Bundle bundle=bundleContext.getBundle(bid);
+					if(bundle==null) {
+						message.append("Error: Unknown or uninstalled bundle");
+					} else
+					try {					
+						if(action.equals("start")){
+								bundle.start();
+						} else if(action.equals("stop")){
+							bundle.stop();
+						} else if(action.equals("update")){
+							bundle.update();
+						} else if(action.equals("uninstall")){
+							bundle.uninstall();				
+						} else if(action.equals("info")){
+							message.append("Error: Unimplemented action");
+						} else {
+							message.append("Error: Unknown action");
+						}
+					} catch (BundleException e) {
+						message.append("Error: "+e.getMessage());
+					}
+				
+				} catch (NumberFormatException e) {
+					message.append("Error: Bad format number for bundle id");
+				}					
+			}
+		}
+		return message.toString();
+	}
+
+	/**
+	 *  Handle a POST call from the XML client (AJAX, ...)
+	 *
+	 * @param request HTTP request information from the client
+	 * @param response HTTP channel back to the client browser
+	 * @throws IOException If there is an IO problem
+	 * @throws ServletException if there is a proble with the servlet processing
+	 **/
+	private void doPostXML(
+		HttpServletRequest request,
+		HttpServletResponse response)
+		throws IOException, ServletException {
+	
+		String xslt = request.getParameter("xslt"); // TODO: only with text/xml
+	
+		String action = request.getParameter("action");
+		String bidstr = request.getParameter("bid");
+		String url = request.getParameter("url"); // for install
+	
+		response.setHeader("Cache-Control", "no-cache");
+		
+//			response.setContentType("text/xml");
+			response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
+//			PrintWriter pw = response.getWriter();
+//			pw.println("<?xml version='1.0' encoding='UTF-8' standalone='yes|no'...?>");			
+//			pw.println("<!DOCTYPE rootelement PRIVATE ".." "http://../webadmin.dtd">");			
+//			pw.println("<bundles>");			
+//			pw.print("</bundles>");			
+	
+	}
+	
+	// should be replaced by the log !!
+	private void trace(String message){
+		if(TRACE)
+			System.out.println(message);
+	}
+}
+

Propchange: felix/sandbox/donsez/http.webadmin/src/main/java/org/apache/felix/http/webadmin/WebAdmin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/OSGI-INF/component.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/OSGI-INF/component.xml?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/src/main/resources/OSGI-INF/component.xml (added)
+++ felix/sandbox/donsez/http.webadmin/src/main/resources/OSGI-INF/component.xml Wed May  9 06:21:29 2007
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component name="WebAdmin" immediate="true">
+	<!-- for immediate="true", see 112.5.4 Delayed Component -->
+
+	<implementation class="org.apache.felix.http.webadmin.WebAdmin"/>
+
+	<!-- No provided services -->
+		
+	<reference
+		name="HTTP"
+		interface="org.osgi.service.http.HttpService"
+		cardinality="1..1"
+		policy="static"
+		bind="bindHttpService" 
+		unbind="unbindHttpService"
+	/>
+<!--
+	
+	// TODO
+	<reference
+		name="OBR"
+		interface="org.osgi.service.obr.RepositoryAdmin"
+		cardinality="0..1"
+		policy="dynamic"
+		bind="bindRepositoryAdmin" 
+		unbind="unbindRepositoryAdmin"
+	/>
+
+	// TODO
+	<reference
+		name="OBR"
+		interface="org.apache.felix.shell.ShellService"
+		cardinality="0..1"
+		policy="dynamic"
+		bind="bindShellService" 
+		unbind="unbindShellService"
+	/>
+
+	<reference
+		name="LOG"
+		interface="org.osgi.service.log.LogService"
+		cardinality="0..1"
+		policy="dynamic"
+		bind="bindLogService" 
+		unbind="unbindLogService"
+	/>
+	
+	-->
+</component>
+
+

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/OSGI-INF/component.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/WEB-INF/mimetype.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/WEB-INF/mimetype.txt?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/src/main/resources/WEB-INF/mimetype.txt (added)
+++ felix/sandbox/donsez/http.webadmin/src/main/resources/WEB-INF/mimetype.txt Wed May  9 06:21:29 2007
@@ -0,0 +1,135 @@
+# This is a dump of a typical MIME type file on a Linux/Unix server. This file controls what MIME types are sent to the client for the given file extensions. Sending the correct MIME type to the client is important so they know how to handle the content of the file. Extra types can either be added here or by using an AddType directive in your config files.
+# For more information about MIME types
+# please read RFC 2045, 2046, 2047, 2048, and 2077. 
+
+# see http://fr.selfhtml.org/divers/typesmime.htm
+
+# MIME type Extension
+application/activemessage
+application/andrew-inset
+application/applefile
+application/atomicmail
+application/dca-rft
+application/dec-dx
+application/mac-binhex40 hqx
+application/mac-compactpro cpt
+application/macwriteii
+application/msword doc
+application/news-message-id
+application/news-transmission
+application/octet-stream bin dms lha lzh exe class
+application/oda oda
+application/pdf pdf
+application/postscript ai eps ps
+application/powerpoint ppt
+application/remote-printing
+application/rtf rtf
+application/slate
+application/smil smi smil sml
+application/wita
+application/wordperfect5.1
+application/x-bcpio bcpio
+application/x-cdlink vcd
+application/x-compress
+application/x-cpio cpio
+application/x-csh csh
+application/x-director dcr dir dxr
+application/x-dvi dvi
+application/x-gtar gtar
+application/x-gzip
+application/x-hdf hdf
+application/x-javascript js
+application/x-koan skp skd skt skm
+application/x-latex latex
+application/x-mif mif
+application/x-netcdf nc cdf
+application/x-sh sh
+application/x-shar shar
+application/x-stuffit sit
+application/x-sv4cpio sv4cpio
+application/x-sv4crc sv4crc
+application/x-tar tar
+application/x-tcl tcl
+application/x-tex tex
+application/x-texinfo texinfo texi
+application/x-troff t tr roff
+application/x-troff-man man
+application/x-troff-me me
+application/x-troff-ms ms
+application/x-ustar ustar
+application/x-wais-source src
+application/zip zip
+audio/basic au snd
+audio/midi midi kar
+audio/x-midi mid
+audio/mpeg mpga mp2 mp3
+audio/x-aiff aif aiff aifc
+audio/x-pn-realaudio ram
+audio/x-pn-realaudio-plugin rpm
+audio/x-realaudio ra
+audio/x-wav wav
+chemical/x-pdb pdb xyz
+image/gif gif
+image/ief ief
+image/jpeg jpeg jpg jpe
+image/png png
+image/tiff tiff tif
+image/x-cmu-raster ras
+image/x-portable-anymap pnm
+image/x-portable-bitmap pbm
+image/x-portable-graymap pgm
+image/x-portable-pixmap ppm
+image/x-rgb rgb
+image/x-xbitmap xbm
+image/x-xpixmap xpm
+image/x-xwindowdump xwd
+message/external-body
+message/news
+message/partial
+message/rfc822
+model/iges igs iges
+model/vrml wrl vrml
+model/mesh msh mesh silo
+multipart/alternative
+multipart/appledouble
+multipart/digest
+multipart/mixed
+multipart/parallel
+text/css css
+text/html html htm
+text/plain txt
+text/richtext rtx
+text/tab-separated-values tsv
+text/x-setext etx
+text/x-sgml sgml sgm
+text/xml xml dtd
+video/mpeg mpeg mpg mpe
+video/quicktime qt mov
+video/x-msvideo avi
+video/x-sgi-movie movie
+x-conference/x-cooltalk ice
+
+# More mapping !
+
+application/x-shockwave-flash swf
+
+text/javascript js
+# application/x-javascript js
+
+text/json json
+# text/x-json json
+# application/json
+
+text/csv csv
+# text/comma-separated-values 
+# application/csv 
+# application/excel 
+# application/vnd.ms-excel 
+# application/vnd.msexcel 
+
+# WAP forum
+text/vnd.wap.wml wml 
+text/vnd.wap.wmlscript wmls 
+image/vnd.wap.wbmp wbmp 
+application/vnd.wap.wmlc wmlc 
+application/vnd.wap.wmlscriptc wmlsc 

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/WEB-INF/mimetype.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/README.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/README.txt?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/README.txt (added)
+++ felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/README.txt Wed May  9 06:21:29 2007
@@ -0,0 +1,3 @@
+Those icons come from http://www.everaldo.com/crystal.html
+
+TODO : check the licence for usage !
\ No newline at end of file

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/Thumbs.db
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/Thumbs.db?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/Thumbs.db
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/active.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/active.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/active.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/cancel.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/cancel.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/cancel.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/info.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/info.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/info.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/installed.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/installed.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/installed.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/resolved.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/resolved.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/resolved.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/start.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/start.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/start.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/starting.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/starting.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/starting.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/stop.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/stop.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/stop.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/stopping.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/stopping.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/stopping.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/uninstall.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/uninstall.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/uninstall.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/uninstalled.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/uninstalled.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/uninstalled.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/update.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/update.png?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/icons/update.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/index.html
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/index.html?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/index.html (added)
+++ felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/index.html Wed May  9 06:21:29 2007
@@ -0,0 +1,300 @@
+<html>
+<head>
+
+<script language="JavaScript" src="json.js">
+<!-- The open source code of a JSON parser and JSON stringifier is available on http://www.json.org/json.js -->
+</script>
+
+<script type='text/javascript'>
+var req=null;
+
+var console=null;
+var bundles=null;
+
+var READY_STATE_UNINITIALIZED=0;
+var READY_STATE_LOADING=1;
+var READY_STATE_LOADED=2;
+var READY_STATE_INTERACTIVE=3;
+var READY_STATE_COMPLETE=4;
+
+function loadDoc(url) {
+    if (window.XMLHttpRequest) {
+        req = new XMLHttpRequest();
+    } else if (window.ActiveXObject) {
+        req = new ActiveXObject("Microsoft.XMLHTTP");
+    }
+    if (req) {
+        req.onreadystatechange = processReqChange;
+        req.open("GET", url, true);
+        req.send(null);
+    }
+}
+
+function processReqChange(){
+  var ready=req.readyState;
+  var trace=null;
+  var data=null;
+  if (ready==READY_STATE_COMPLETE){
+    data=req.responseText;
+  	displayData(data);
+  } else {
+    trace="loading...["+ready+"]";
+  	displayTrace(trace);
+  }
+}
+
+function displayTrace(trace){
+//  if(console!=null)
+    var newline=document.createElement("div");
+    console.appendChild(newline);
+    var txt=document.createTextNode(trace);
+    newline.appendChild(txt);
+//  }
+}
+
+
+// see http://fr.selfhtml.org/javascript/objets/node.htm
+// for node processing
+
+function displayDataInDiv(data){
+
+	displayTrace(data);
+	var myObject = data.parseJSON();
+
+	// loop	
+	var b=myObject.bundles;
+	for (var i=0;i<b.length;i++){
+	    var newline=document.createElement("div");
+	    bundles.appendChild(newline);
+	    var txt=document.createTextNode(
+	    		b[i].id
+	    	+	" "
+	    	+	b[i].state
+	    	+	" "
+	    	+	b[i].name
+	    	+	" "
+	    	+	b[i].symbolicname
+	    );
+	    newline.appendChild(txt);    
+    }
+}
+
+
+var ACTIVE=32;
+var INSTALLED=2;
+var RESOLVED=4;
+var STARTING=8;
+var STOPPING=16;
+var UNINSTALLED=1;
+
+function getStateStr(state){
+	    var stateStr;
+	    switch (state){
+ 				case ACTIVE: stateStr="ACTIVE"; break;
+				case INSTALLED: stateStr="INSTALLED"; break;
+				case RESOLVED: stateStr="RESOLVED"; break;
+				case STARTING: stateStr="STARTING"; break;
+				case STOPPING: stateStr="STOPPING"; break;
+				case UNINSTALLED: stateStr="UNINSTALLED"; break;
+				default: stateStr="UNKNOWN STATE"; break;
+		} 
+		return stateStr;
+}
+
+
+function createTr(id,state,name,symbolicname){
+		    newtr=document.createElement("tr");
+		    newtr.setAttribute("id",id);
+
+		    var newtd;
+		    var txt;
+		    
+		    newtd=document.createElement("td");
+		    newtd.setAttribute("class","id");
+		    newtr.appendChild(newtd);
+		    txt=document.createTextNode(id);
+		    newtd.appendChild(txt);
+	
+		    newtd=document.createElement("td");
+		    newtd.setAttribute("class","state");
+		    newtr.appendChild(newtd);		    
+		    txt=document.createTextNode(getStateStr(state));
+		    newtd.appendChild(txt);
+	
+		    newtd=document.createElement("td");
+		    newtd.setAttribute("class","name");
+		    newtr.appendChild(newtd);
+		    txt=document.createTextNode(name);
+		    newtd.appendChild(txt);
+		    
+		    newtd=document.createElement("td");
+		    newtd.setAttribute("class","symbolicname");
+		    newtr.appendChild(newtd);
+		    txt=document.createTextNode(symbolicname);
+		    newtd.appendChild(txt);
+		    
+		    newtd=document.createElement("td");
+		    newtd.setAttribute("class","action");
+		    newtr.appendChild(newtd);
+
+			var newa;
+
+		    newa=document.createElement("a");
+		    newa.setAttribute("href","/admin/bundle?action=start&mimetype=text/javascript&id="+id);
+		    txt=document.createTextNode("Start");
+		    newa.appendChild(txt);
+		    newtd.appendChild(newa);
+
+		    txt=document.createTextNode("|");
+		    newtd.appendChild(txt);
+
+		    newa=document.createElement("a");
+		    newa.setAttribute("href","/admin/bundle?action=stop&mimetype=text/javascript&id="+id);
+		    txt=document.createTextNode("Stop");
+		    newa.appendChild(txt);
+		    newtd.appendChild(newa);
+
+		    txt=document.createTextNode("|");
+		    newtd.appendChild(txt);
+
+		    newa=document.createElement("a");
+		    newa.setAttribute("href","/admin/bundle?action=update&mimetype=text/javascript&id="+id);
+		    txt=document.createTextNode("Update");
+		    newa.appendChild(txt);
+		    newtd.appendChild(newa);
+
+		    txt=document.createTextNode("|");
+		    newtd.appendChild(txt);
+
+		    newa=document.createElement("a");
+		    newa.setAttribute("href","/admin/bundle?action=uninstall&mimetype=text/javascript&id="+id);
+		    txt=document.createTextNode("Uninstall");
+		    newa.appendChild(txt);
+		    newtd.appendChild(newa);
+
+	return newtr;
+}
+
+function replaceTr(tr,id,state,name,symbolicname){
+    // tr.setAttribute("id",id);
+	// tr.childNodes[0].value=id;
+	tr.childNodes[1].value=getStateStr(state);
+	tr.childNodes[2].value=name;
+	tr.childNodes[3].value=symbolicname;
+	// TODO url value !
+}
+
+
+// TO CHECK
+function displayData(data){
+
+	displayTrace(data);
+	var myObject = data.parseJSON();
+
+	// loop	
+	var b=myObject.bundles;
+	var trs=bundles.childNodes;
+	
+	var i=0;
+	while (i<b.length){
+
+			bid=b[i].id;
+			
+			var newtr=createTr(b[i].id,b[i].state,b[i].name,b[i].symbolicname);
+			bundles.appendChild(newtr);		    
+
+			i++;
+	}
+}
+
+
+function displayDatabyAddingAndReplacing(data){
+
+	displayTrace(data);
+	var myObject = data.parseJSON();
+
+	// loop	
+	var b=myObject.bundles;
+	var trs=bundles.childNodes;
+	
+	var i=0;
+	var j=0;
+	while (i<b.length && j<trs.length){
+		trid=trs[j].getAttribute("id");
+		if(trid==null) {
+			j++; // for instance headers, ...
+		} else {
+			bid=b[i].id;
+			
+			if(bid==trid) {
+		    	replaceTr(trs[j],b[i].id,b[i].state,b[i].name,b[i].symbolicname);
+			}
+			if(bid<trid) {
+			    var newtr=createTr(b[i].id,b[i].state,b[i].name,b[i].symbolicname);
+			    bundles.insertBefore(newtr,trs[j]);		    
+			}
+			if(bid>trid) {
+			    bundles.removeChild(trs[j]);		    
+			}
+			j++;i++;
+		}
+	}
+	while(j<trs.length){
+		bundles.removeChild(trs[j]);		    
+		j++;			
+	}
+	while(i<b.length){
+		var newtr=createTr(b[i].id,b[i].state,b[i].name,b[i].symbolicname);
+		bundles.appendChild(newtr);
+		i++;
+	}
+}
+
+var timerId=0;
+function periodicLoadDoc(url,time){
+
+	loadDoc(url);
+	timerId=setTimeout("periodicLoadDoc('"+url+"',"+time")",time);
+	// do nothing with timerId ?
+}
+
+window.onload=function(){
+  bundles=document.getElementById("bundles");
+  console=document.getElementById("console");
+  //periodicLoadDoc("/admin/bundles?mimetype=text/javascript",10000); // every 10 sec
+  loadDoc("/admin/bundles?mimetype=text/javascript");
+}
+</script>
+
+<title>Web Admin</title>
+<link rel='stylesheet' type='text/css' href='/admin/style.css'>
+
+</head>
+
+<body>
+
+<h1><img src='/admin/logofelix.jpg'> Web Admin</h1>
+<form name='install' method='GET' action='/admin/bundles?mimetype=text/javascript'>
+<input name='url' type='text' size='50' value='http://'>
+<button type='submit' name='action' value='install'>Install</button>
+</form>
+<div id='message'></div>
+
+<!--
+<div id='bundles'>
+
+</div>
+-->
+
+<table id='bundles'>
+<tr><td>Id</td><td>State</td><td>Name</td><td>Symbolic Name</td></tr>
+</table>
+
+
+<!-- for debugging -->
+<div id='console'>
+</div>
+
+</body>
+</html>
+

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/json.js
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/json.js?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/json.js (added)
+++ felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/json.js Wed May  9 06:21:29 2007
@@ -0,0 +1,120 @@
+/*
+    json.js
+    2006-04-28
+
+    This file adds these methods to JavaScript:
+
+        object.toJSONString()
+
+            This method produces a JSON text from an object. The
+            object must not contain any cyclical references.
+
+        array.toJSONString()
+
+            This method produces a JSON text from an array. The
+            array must not contain any cyclical references.
+
+        string.parseJSON()
+
+            This method parses a JSON text to produce an object or
+            array. It will return false if there is an error.
+*/
+(function () {
+    var m = {
+            '\b': '\\b',
+            '\t': '\\t',
+            '\n': '\\n',
+            '\f': '\\f',
+            '\r': '\\r',
+            '"' : '\\"',
+            '\\': '\\\\'
+        },
+        s = {
+            array: function (x) {
+                var a = ['['], b, f, i, l = x.length, v;
+                for (i = 0; i < l; i += 1) {
+                    v = x[i];
+                    f = s[typeof v];
+                    if (f) {
+                        v = f(v);
+                        if (typeof v == 'string') {
+                            if (b) {
+                                a[a.length] = ',';
+                            }
+                            a[a.length] = v;
+                            b = true;
+                        }
+                    }
+                }
+                a[a.length] = ']';
+                return a.join('');
+            },
+            'boolean': function (x) {
+                return String(x);
+            },
+            'null': function (x) {
+                return "null";
+            },
+            number: function (x) {
+                return isFinite(x) ? String(x) : 'null';
+            },
+            object: function (x) {
+                if (x) {
+                    if (x instanceof Array) {
+                        return s.array(x);
+                    }
+                    var a = ['{'], b, f, i, v;
+                    for (i in x) {
+                        v = x[i];
+                        f = s[typeof v];
+                        if (f) {
+                            v = f(v);
+                            if (typeof v == 'string') {
+                                if (b) {
+                                    a[a.length] = ',';
+                                }
+                                a.push(s.string(i), ':', v);
+                                b = true;
+                            }
+                        }
+                    }
+                    a[a.length] = '}';
+                    return a.join('');
+                }
+                return 'null';
+            },
+            string: function (x) {
+                if (/["\\\x00-\x1f]/.test(x)) {
+                    x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
+                        var c = m[b];
+                        if (c) {
+                            return c;
+                        }
+                        c = b.charCodeAt();
+                        return '\\u00' +
+                            Math.floor(c / 16).toString(16) +
+                            (c % 16).toString(16);
+                    });
+                }
+                return '"' + x + '"';
+            }
+        };
+
+    Object.prototype.toJSONString = function () {
+        return s.object(this);
+    };
+
+    Array.prototype.toJSONString = function () {
+        return s.array(this);
+    };
+})();
+
+String.prototype.parseJSON = function () {
+    try {
+        return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
+                this.replace(/"(\\.|[^"\\])*"/g, ''))) &&
+            eval('(' + this + ')');
+    } catch (e) {
+        return false;
+    }
+};

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/json.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/logofelix.jpg
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/logofelix.jpg?view=auto&rev=536512
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/logofelix.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/style.css
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/style.css?view=auto&rev=536512
==============================================================================
--- felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/style.css (added)
+++ felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/style.css Wed May  9 06:21:29 2007
@@ -0,0 +1,224 @@
+
+
+body {
+	margin-top:4px;
+	margin-left:4px;
+}
+
+
+p {
+	color:black;
+  	font-size: 12px;
+	font-family: verdana;
+	font-weight:normal;
+	line-height:15px;
+}
+
+table.bundles {
+	border-style:solid; 
+	border-width:1px; 
+	border-color:black;
+	width:90%;
+	border-collapse:collapse;
+	margin:auto;
+}
+
+td {
+	color:black;
+  	font-size: 12px;
+	font-family: verdana;
+	font-weight:normal;
+	line-height:15px;
+	border-top: solid 1px;
+}
+
+td.action {
+	color:black;
+  	font-size: 9px;
+	font-family: verdana;
+	font-weight:normal;
+	text-align: right;
+	border-top: solid 1px;
+}
+
+a:link {
+  color:#00669C; 
+  font-weight:bold;
+  text-decoration: none; 
+}
+a:visited {
+  color:#00669C; 
+  text-decoration: none; 
+  font-weight:bold;
+}
+a:hover {
+  color:#A00000; 
+  font-weight:bold;
+  text-decoration: underline; 
+}
+a.mem:link {
+  font-size: 12px;
+  color:#00669C; 
+  text-decoration: underline; 
+}
+a.mem:visited {
+  font-size: 12px;
+  color:#00669C; 
+  text-decoration: underline; 
+}
+a.mem:hover {
+  font-size: 12px;
+  color:#00669C; 
+  text-decoration: underline; 
+}
+a.mem:active {
+  font-size: 12px;
+  color:#00669C; 
+  text-decoration: underline; 
+}
+.page-title {
+	color:black;
+  	font-size: 17px;
+	font-weight: bold;
+	font-family: verdana;
+	padding-top:12px;
+	padding-bottom:4px;
+}
+.page-sub-title {
+	color:#00669C; 
+ 	font-weight:bold;
+  	text-decoration: none; 
+  	font-size: 15px;
+	font-weight: bold;
+	font-family: verdana;
+	padding-top:12px;
+	padding-bottom:4px;
+}
+.default {
+	color:black;
+  	font-size: 12px;
+	font-family: verdana;
+	line-height:15px;
+}
+.small {
+	color:gray;
+  	font-size: 10px;
+	font-family: verdana;
+	padding-bottom:5px;
+}
+.to-do {
+	color:red;
+  	font-size: 12px;
+	font-family: verdana;
+	font-weight:normal;
+	line-height:15px;
+	font-style:italic;
+	padding-top:12px;
+	padding-bottom:12px;
+}
+
+.box-header {
+  font-family: verdana;
+  color:#FFFFFF;
+  font-size: 11px;
+  font-weight: bold;
+  margin-top : 16px;
+  margin-left : 12px;
+  background-image:url("images/bg0.gif");
+  background-repeat:repeat;
+  height:24px;
+  width:174px;
+  vertical-align:middle;
+}
+.box {
+  text-align: left;
+  font-family: verdana;
+  color:#0;
+  font-size: 11px;
+  height:100px;
+  padding:6px;
+  margin-left:12px;
+  border:1px solid #A5BDDE;
+  width:174px;
+  vertical-align:top;
+  text-align:center;
+}
+.left-nav-menu {
+  text-align: left;
+  font-family: verdana;
+  color:#00669C;
+  font-size: 11px;
+  font-weight: bold;
+  background-image:url("images/bg0.gif");
+  background-repeat:repeat;
+  padding:7px;
+}
+a.left-nav-menu:hover {
+  text-decoration: none; 
+}
+.left-nav-gradient {
+  background-image:url("images/bg0_gradient.jpg");
+  background-repeat:repeat-x;
+}
+
+.footer {
+  font-family: verdana;
+  color:#00669C;
+  font-size: 11px;
+  font-weight: bold;
+}
+a.footer:hover {
+	color:#800000;
+	text-decoration: underline;
+}
+h1 {
+	color:black;
+  	font-size: 18px;
+	font-weight: bold;
+	font-family: verdana;
+	padding-top:12px;
+	padding-bottom:4px;
+    text-align:center;    
+	border:1px 
+	solid #B5B5B5
+}
+h2 {
+	color:white;
+  	font-size: 16px;
+	font-weight: bold;
+	font-family: verdana;
+  	margin-top:5px;
+  	margin-bottom:0px;
+	padding-top:6px;
+    padding-left:2px;
+	padding-bottom:6px;
+    background-image:url("/images/background-blue.gif");
+}
+h3 {
+	color:black;
+  	font-size: 14px;
+	font-weight: bold;
+	font-family: verdana;
+	padding-top:12px;
+	padding-bottom:4px;
+    text-decoration: underline; 
+}
+h4 {
+	color:black;
+  	font-size: 14px;
+	font-weight: bold;
+	font-family: verdana;
+    text-decoration: none; 
+}
+.box1 { 
+	font-size:14px; 
+	font-family:  verdana; 
+	border:1px 
+	solid #B5B5B5
+}
+.box2 { 
+	font-size:10px; 
+	font-family:  verdana; 
+	border:1px 
+	solid #B5B5B5
+}
\ No newline at end of file

Propchange: felix/sandbox/donsez/http.webadmin/src/main/resources/webroot/style.css
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message