IDEMPIERE-546 Integrate Apache Felix Web Console. Accessible at osgi/system/console using the administrator login.
This commit is contained in:
parent
1bcccc6431
commit
f830e2c469
|
@ -2,7 +2,7 @@
|
|||
<?artifactRepository version='1.1.0'?>
|
||||
<repository name='file:/home/hengsin/workspace/idempiere-trekglobal/lib/ - artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'>
|
||||
<properties size='2'>
|
||||
<property name='p2.timestamp' value='1353402021279'/>
|
||||
<property name='p2.timestamp' value='1357720877759'/>
|
||||
<property name='p2.compressed' value='false'/>
|
||||
</properties>
|
||||
<mappings size='3'>
|
||||
|
@ -10,7 +10,14 @@
|
|||
<rule filter='(& (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
|
||||
<rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/>
|
||||
</mappings>
|
||||
<artifacts size='3'>
|
||||
<artifacts size='6'>
|
||||
<artifact classifier='osgi.bundle' id='org.apache.felix.webconsole.plugins.packageadmin' version='1.0.0'>
|
||||
<properties size='3'>
|
||||
<property name='artifact.size' value='26195'/>
|
||||
<property name='download.size' value='26195'/>
|
||||
<property name='download.md5' value='0d0b1172a4bb948dc62b8fca8310c179'/>
|
||||
</properties>
|
||||
</artifact>
|
||||
<artifact classifier='osgi.bundle' id='org.apache.poi' version='3.7.0'>
|
||||
<properties size='3'>
|
||||
<property name='artifact.size' value='1651480'/>
|
||||
|
@ -18,6 +25,20 @@
|
|||
<property name='download.md5' value='982062b95e5299e63d25de5144f5b136'/>
|
||||
</properties>
|
||||
</artifact>
|
||||
<artifact classifier='osgi.bundle' id='org.apache.felix.webconsole.plugins.memoryusage' version='1.0.4'>
|
||||
<properties size='3'>
|
||||
<property name='artifact.size' value='50278'/>
|
||||
<property name='download.size' value='50278'/>
|
||||
<property name='download.md5' value='4efb370c95ffb8c3202bf5634208c313'/>
|
||||
</properties>
|
||||
</artifact>
|
||||
<artifact classifier='osgi.bundle' id='org.apache.felix.webconsole' version='4.0.0'>
|
||||
<properties size='3'>
|
||||
<property name='artifact.size' value='591992'/>
|
||||
<property name='download.size' value='591992'/>
|
||||
<property name='download.md5' value='8f1ea912ae02473b9fd84389ec6f647f'/>
|
||||
</properties>
|
||||
</artifact>
|
||||
<artifact classifier='osgi.bundle' id='com.springsource.javax.mail' version='1.4.5'>
|
||||
<properties size='3'>
|
||||
<property name='artifact.size' value='570498'/>
|
||||
|
|
130
lib/content.xml
130
lib/content.xml
|
@ -2,10 +2,10 @@
|
|||
<?metadataRepository version='1.1.0'?>
|
||||
<repository name='file:/home/hengsin/workspace/idempiere-trekglobal/lib/ - metadata' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'>
|
||||
<properties size='2'>
|
||||
<property name='p2.timestamp' value='1353402021281'/>
|
||||
<property name='p2.timestamp' value='1357720877761'/>
|
||||
<property name='p2.compressed' value='false'/>
|
||||
</properties>
|
||||
<units size='3'>
|
||||
<units size='6'>
|
||||
<unit id='com.springsource.javax.mail' version='1.4.5' singleton='false'>
|
||||
<update id='com.springsource.javax.mail' range='[0.0.0,1.4.5)' severity='0'/>
|
||||
<properties size='4'>
|
||||
|
@ -57,6 +57,132 @@
|
|||
</instructions>
|
||||
</touchpointData>
|
||||
</unit>
|
||||
<unit id='org.apache.felix.webconsole' version='4.0.0' singleton='false'>
|
||||
<update id='org.apache.felix.webconsole' range='[0.0.0,4.0.0)' severity='0'/>
|
||||
<properties size='4'>
|
||||
<property name='org.eclipse.equinox.p2.name' value='Apache Felix Web Management Console'/>
|
||||
<property name='org.eclipse.equinox.p2.description' value='Web Based Management Console for OSGi Frameworks. See http://felix.apache.org/site/apache-felix-web-console.html for more information on this bundle.'/>
|
||||
<property name='org.eclipse.equinox.p2.provider' value='The Apache Software Foundation'/>
|
||||
<property name='org.eclipse.equinox.p2.doc.url' value='http://felix.apache.org/site/apache-felix-web-console.html'/>
|
||||
</properties>
|
||||
<provides size='10'>
|
||||
<provided namespace='org.eclipse.equinox.p2.iu' name='org.apache.felix.webconsole' version='4.0.0'/>
|
||||
<provided namespace='osgi.bundle' name='org.apache.felix.webconsole' version='4.0.0'/>
|
||||
<provided namespace='java.package' name='org.apache.felix.webconsole' version='3.1.2'/>
|
||||
<provided namespace='java.package' name='org.json' version='0.0.0'/>
|
||||
<provided namespace='java.package' name='org.apache.commons.io' version='1.4.0'/>
|
||||
<provided namespace='java.package' name='org.apache.commons.io.output' version='1.4.0'/>
|
||||
<provided namespace='java.package' name='org.apache.commons.io.input' version='1.4.0'/>
|
||||
<provided namespace='java.package' name='org.apache.commons.io.filefilter' version='1.4.0'/>
|
||||
<provided namespace='java.package' name='org.apache.commons.io.comparator' version='1.4.0'/>
|
||||
<provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
|
||||
</provides>
|
||||
<requires size='21'>
|
||||
<required namespace='java.package' name='org.apache.felix.bundlerepository' range='[2.0.0,3.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.obr' range='[1.0.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.cm' range='[1.2.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.condpermadmin' range='[1.0.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.log' range='[1.3.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.metatype' range='[1.1.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.permissionadmin' range='[1.2.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.prefs' range='[1.1.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.wireadmin' range='[1.0.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='javax.servlet' range='2.4.0'/>
|
||||
<required namespace='java.package' name='javax.servlet.http' range='2.4.0'/>
|
||||
<required namespace='java.package' name='org.apache.commons.fileupload' range='[1.2.0,2.0.0)'/>
|
||||
<required namespace='java.package' name='org.apache.commons.fileupload.disk' range='[1.2.0,2.0.0)'/>
|
||||
<required namespace='java.package' name='org.apache.commons.fileupload.servlet' range='[1.2.0,2.0.0)'/>
|
||||
<required namespace='java.package' name='org.apache.felix.webconsole' range='[3.1.0,3.2.0)'/>
|
||||
<required namespace='java.package' name='org.osgi.framework' range='[1.4.0,2.0.0)'/>
|
||||
<required namespace='java.package' name='org.osgi.service.http' range='[1.2.0,2.0.0)'/>
|
||||
<required namespace='java.package' name='org.osgi.service.metatype' range='[1.1.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.packageadmin' range='[1.2.0,2.0.0)'/>
|
||||
<required namespace='java.package' name='org.osgi.service.startlevel' range='[1.1.0,2.0.0)'/>
|
||||
<required namespace='java.package' name='org.osgi.util.tracker' range='[1.3.0,2.0.0)'/>
|
||||
</requires>
|
||||
<artifacts size='1'>
|
||||
<artifact classifier='osgi.bundle' id='org.apache.felix.webconsole' version='4.0.0'/>
|
||||
</artifacts>
|
||||
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
|
||||
<touchpointData size='1'>
|
||||
<instructions size='1'>
|
||||
<instruction key='manifest'>
|
||||
Bundle-SymbolicName: org.apache.felix.webconsole
Bundle-Version: 4.0.0

|
||||
</instruction>
|
||||
</instructions>
|
||||
</touchpointData>
|
||||
</unit>
|
||||
<unit id='org.apache.felix.webconsole.plugins.packageadmin' version='1.0.0' singleton='false'>
|
||||
<update id='org.apache.felix.webconsole.plugins.packageadmin' range='[0.0.0,1.0.0)' severity='0'/>
|
||||
<properties size='4'>
|
||||
<property name='org.eclipse.equinox.p2.name' value='Apache Felix Web Console Package Admin Service Plugin'/>
|
||||
<property name='org.eclipse.equinox.p2.description' value='Plugin providing support to query the Package Admin service for various details; e.g. finding duplicate package exports or finding bundles exporting given packages'/>
|
||||
<property name='org.eclipse.equinox.p2.provider' value='The Apache Software Foundation'/>
|
||||
<property name='org.eclipse.equinox.p2.doc.url' value='http://www.apache.org/'/>
|
||||
</properties>
|
||||
<provides size='3'>
|
||||
<provided namespace='org.eclipse.equinox.p2.iu' name='org.apache.felix.webconsole.plugins.packageadmin' version='1.0.0'/>
|
||||
<provided namespace='osgi.bundle' name='org.apache.felix.webconsole.plugins.packageadmin' version='1.0.0'/>
|
||||
<provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
|
||||
</provides>
|
||||
<requires size='8'>
|
||||
<required namespace='java.package' name='javax.servlet' range='0.0.0'/>
|
||||
<required namespace='java.package' name='javax.servlet.http' range='0.0.0'/>
|
||||
<required namespace='java.package' name='org.apache.commons.io' range='[1.4.0,2.0.0)'/>
|
||||
<required namespace='java.package' name='org.apache.felix.webconsole' range='[3.1.0,4.0.0)'/>
|
||||
<required namespace='java.package' name='org.json' range='0.0.0'/>
|
||||
<required namespace='java.package' name='org.osgi.framework' range='[1.3.0,2.0.0)'/>
|
||||
<required namespace='java.package' name='org.osgi.service.packageadmin' range='[1.2.0,2.0.0)'/>
|
||||
<required namespace='java.package' name='org.osgi.util.tracker' range='[1.3.0,2.0.0)'/>
|
||||
</requires>
|
||||
<artifacts size='1'>
|
||||
<artifact classifier='osgi.bundle' id='org.apache.felix.webconsole.plugins.packageadmin' version='1.0.0'/>
|
||||
</artifacts>
|
||||
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
|
||||
<touchpointData size='1'>
|
||||
<instructions size='1'>
|
||||
<instruction key='manifest'>
|
||||
Bundle-SymbolicName: org.apache.felix.webconsole.plugins.packageadmin
Bundle-Version: 1.0.0

|
||||
</instruction>
|
||||
</instructions>
|
||||
</touchpointData>
|
||||
</unit>
|
||||
<unit id='org.apache.felix.webconsole.plugins.memoryusage' version='1.0.4' singleton='false'>
|
||||
<update id='org.apache.felix.webconsole.plugins.memoryusage' range='[0.0.0,1.0.4)' severity='0'/>
|
||||
<properties size='4'>
|
||||
<property name='org.eclipse.equinox.p2.name' value='Apache Felix Web Console Memory Usage Plugin'/>
|
||||
<property name='org.eclipse.equinox.p2.description' value='Plugin providing plugins to the Felix Shell and Web Console to observe the VMs memory use and cause try to get thread dumps etc.'/>
|
||||
<property name='org.eclipse.equinox.p2.provider' value='The Apache Software Foundation'/>
|
||||
<property name='org.eclipse.equinox.p2.doc.url' value='http://www.apache.org/'/>
|
||||
</properties>
|
||||
<provides size='3'>
|
||||
<provided namespace='org.eclipse.equinox.p2.iu' name='org.apache.felix.webconsole.plugins.memoryusage' version='1.0.4'/>
|
||||
<provided namespace='osgi.bundle' name='org.apache.felix.webconsole.plugins.memoryusage' version='1.0.4'/>
|
||||
<provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
|
||||
</provides>
|
||||
<requires size='9'>
|
||||
<required namespace='java.package' name='org.osgi.service.log' range='[1.3.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.cm' range='[1.2.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.osgi.service.metatype' range='[1.1.0,2.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='javax.servlet' range='[2.3.0,4.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='javax.servlet.http' range='[2.3.0,4.0.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.apache.felix.webconsole' range='[3.0.0,3.2.0)' optional='true'/>
|
||||
<required namespace='java.package' name='org.apache.felix.shell' range='[1.0.0,1.1.0)' optional='true'/>
|
||||
<required namespace='java.package' name='javax.management' range='0.0.0'/>
|
||||
<required namespace='java.package' name='org.osgi.framework' range='[1.3.0,2.0.0)'/>
|
||||
</requires>
|
||||
<artifacts size='1'>
|
||||
<artifact classifier='osgi.bundle' id='org.apache.felix.webconsole.plugins.memoryusage' version='1.0.4'/>
|
||||
</artifacts>
|
||||
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
|
||||
<touchpointData size='1'>
|
||||
<instructions size='1'>
|
||||
<instruction key='manifest'>
|
||||
Bundle-SymbolicName: org.apache.felix.webconsole.plugins.memoryusage
Bundle-Version: 1.0.4

|
||||
</instruction>
|
||||
</instructions>
|
||||
</touchpointData>
|
||||
</unit>
|
||||
<unit id='com.springsource.javax.activation' version='1.1.1' singleton='false'>
|
||||
<update id='com.springsource.javax.activation' range='[0.0.0,1.1.1)' severity='0'/>
|
||||
<properties size='2'>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
package org.eclipse.equinox.http.servlet.internal;
|
||||
|
||||
import java.util.*;
|
||||
import javax.servlet.ServletConfig;
|
||||
import org.eclipse.equinox.http.servlet.ExtendedHttpService;
|
||||
import org.osgi.framework.*;
|
||||
import org.osgi.service.http.HttpService;
|
||||
|
@ -25,52 +24,22 @@ public class Activator implements BundleActivator {
|
|||
private static final String[] HTTP_SERVICES_CLASSES = new String[] {HttpService.class.getName(), ExtendedHttpService.class.getName()};
|
||||
|
||||
private static BundleContext context;
|
||||
private static Map<Object, ServiceRegistration<?>> serviceRegistrations = new HashMap<Object, ServiceRegistration<?>>();
|
||||
private static ServiceRegistration<?> serviceRegistration;
|
||||
|
||||
public void start(BundleContext bundleContext) throws Exception {
|
||||
startHttpServiceProxy(bundleContext);
|
||||
context = bundleContext;
|
||||
serviceRegistration = startHttpServiceProxy(bundleContext);
|
||||
}
|
||||
|
||||
public void stop(BundleContext bundleContext) throws Exception {
|
||||
stopHttpServiceProxy(bundleContext);
|
||||
}
|
||||
|
||||
private static synchronized void startHttpServiceProxy(BundleContext bundleContext) {
|
||||
context = bundleContext;
|
||||
Object[] proxyServlets = serviceRegistrations.keySet().toArray();
|
||||
for (int i = 0; i < proxyServlets.length; ++i) {
|
||||
ServiceRegistration<?> registration = registerHttpService((ProxyServlet) proxyServlets[i]);
|
||||
serviceRegistrations.put(proxyServlets[i], registration);
|
||||
}
|
||||
}
|
||||
|
||||
private static synchronized void stopHttpServiceProxy(BundleContext bundleContext) {
|
||||
Object[] proxyServlets = serviceRegistrations.keySet().toArray();
|
||||
for (int i = 0; i < proxyServlets.length; ++i) {
|
||||
ServiceRegistration<?> registration = serviceRegistrations.put(proxyServlets[i], null);
|
||||
registration.unregister();
|
||||
}
|
||||
context = null;
|
||||
}
|
||||
|
||||
static synchronized void addProxyServlet(ProxyServlet proxyServlet) {
|
||||
ServiceRegistration<?> registration = null;
|
||||
if (context != null)
|
||||
registration = registerHttpService(proxyServlet);
|
||||
private static synchronized ServiceRegistration<?> startHttpServiceProxy(BundleContext bundleContext) {
|
||||
HttpServiceProxyFactory factory = new HttpServiceProxyFactory();
|
||||
|
||||
serviceRegistrations.put(proxyServlet, registration);
|
||||
}
|
||||
|
||||
private static ServiceRegistration<?> registerHttpService(ProxyServlet proxyServlet) {
|
||||
HttpServiceFactory factory = new HttpServiceFactory(proxyServlet);
|
||||
Dictionary<String, String> serviceProperties = new Hashtable<String, String>(2);
|
||||
ServletConfig config = proxyServlet.getServletConfig();
|
||||
Enumeration<String> initparameterNames = config.getInitParameterNames();
|
||||
while (initparameterNames.hasMoreElements()) {
|
||||
String name = (String) initparameterNames.nextElement();
|
||||
serviceProperties.put(name, config.getInitParameter(name));
|
||||
}
|
||||
|
||||
if (serviceProperties.get(Constants.SERVICE_VENDOR) == null)
|
||||
serviceProperties.put(Constants.SERVICE_VENDOR, DEFAULT_SERVICE_VENDOR);
|
||||
|
||||
|
@ -80,9 +49,15 @@ public class Activator implements BundleActivator {
|
|||
return context.registerService(HTTP_SERVICES_CLASSES, factory, serviceProperties);
|
||||
}
|
||||
|
||||
private static synchronized void stopHttpServiceProxy(BundleContext bundleContext) {
|
||||
serviceRegistration.unregister();
|
||||
}
|
||||
|
||||
static synchronized void addProxyServlet(ProxyServlet proxyServlet) {
|
||||
HttpServiceProxyFactory.registerServletDelegate(proxyServlet.getHttpContext(), proxyServlet);
|
||||
}
|
||||
//
|
||||
static synchronized void removeProxyServlet(ProxyServlet proxyServlet) {
|
||||
ServiceRegistration<?> registration = serviceRegistrations.remove(proxyServlet);
|
||||
if (registration != null)
|
||||
registration.unregister();
|
||||
HttpServiceProxyFactory.unregisterServletDelegate(proxyServlet);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,223 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Heng Sin Low *
|
||||
* Copyright (C) 2013 Trek Global *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.eclipse.equinox.http.servlet.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Dictionary;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.eclipse.equinox.http.servlet.ExtendedHttpService;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.service.http.HttpContext;
|
||||
import org.osgi.service.http.HttpService;
|
||||
import org.osgi.service.http.NamespaceException;
|
||||
|
||||
/**
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class HttpServiceProxy implements HttpService, ExtendedHttpService {
|
||||
|
||||
private Bundle bundle;
|
||||
|
||||
private Map<Filter, ExtendedHttpService> filterMap = new HashMap<Filter, ExtendedHttpService>();
|
||||
private HttpServiceProxyFactory factory;
|
||||
private List<FilterEntry> filters = new ArrayList<HttpServiceProxy.FilterEntry>();
|
||||
private List<ServletEntry> servlets = new ArrayList<HttpServiceProxy.ServletEntry>();
|
||||
private List<ResourceEntry> resources = new ArrayList<HttpServiceProxy.ResourceEntry>();
|
||||
|
||||
public HttpServiceProxy(Bundle bundle, HttpServiceProxyFactory httpServiceProxyFactory) {
|
||||
this.bundle = bundle;
|
||||
this.factory = httpServiceProxyFactory;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.equinox.http.servlet.ExtendedHttpService#registerFilter(java.lang.String, javax.servlet.Filter, java.util.Dictionary, org.osgi.service.http.HttpContext)
|
||||
*/
|
||||
@Override
|
||||
public void registerFilter(String alias, Filter filter,
|
||||
Dictionary<String, String> initparams, HttpContext context)
|
||||
throws ServletException, NamespaceException {
|
||||
String httpContextClass = context != null ? context.getClass().getName() : DefaultHttpContext.class.getName();
|
||||
HttpService delegate = factory.getHttpServiceDelegate(bundle, httpContextClass);
|
||||
if (delegate != null && delegate instanceof ExtendedHttpService) {
|
||||
((ExtendedHttpService)delegate).registerFilter(alias, filter, initparams, context);
|
||||
filterMap.put(filter, (ExtendedHttpService) delegate);
|
||||
} else {
|
||||
filters.add(new FilterEntry(alias, filter, initparams, context));
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.equinox.http.servlet.ExtendedHttpService#unregisterFilter(javax.servlet.Filter)
|
||||
*/
|
||||
@Override
|
||||
public void unregisterFilter(Filter filter) {
|
||||
ExtendedHttpService service = filterMap.get(filter);
|
||||
if (service != null) {
|
||||
service.unregisterFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.osgi.service.http.HttpService#registerServlet(java.lang.String, javax.servlet.Servlet, java.util.Dictionary, org.osgi.service.http.HttpContext)
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void registerServlet(String alias, Servlet servlet,
|
||||
Dictionary initparams, HttpContext context)
|
||||
throws ServletException, NamespaceException {
|
||||
String httpContextClass = context != null ? context.getClass().getName() : DefaultHttpContext.class.getName();
|
||||
HttpService delegate = factory.getHttpServiceDelegate(bundle, httpContextClass);
|
||||
if (delegate != null ) {
|
||||
delegate.registerServlet(alias, servlet, initparams, context);
|
||||
} else {
|
||||
servlets.add(new ServletEntry(alias, servlet, initparams, context));
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.osgi.service.http.HttpService#registerResources(java.lang.String, java.lang.String, org.osgi.service.http.HttpContext)
|
||||
*/
|
||||
@Override
|
||||
public void registerResources(String alias, String name, HttpContext context)
|
||||
throws NamespaceException {
|
||||
String httpContextClass = context != null ? context.getClass().getName() : DefaultHttpContext.class.getName();
|
||||
HttpService delegate = factory.getHttpServiceDelegate(bundle, httpContextClass);
|
||||
if (delegate != null ) {
|
||||
delegate.registerResources(alias, name, context);
|
||||
} else {
|
||||
resources.add(new ResourceEntry(alias, name, context));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* process registration that happens before the start of http service delegate
|
||||
* @param httpContext
|
||||
* @throws ServletException
|
||||
* @throws NamespaceException
|
||||
*/
|
||||
protected void processPendingRegistration(String httpContext) throws ServletException, NamespaceException {
|
||||
if (!filters.isEmpty()) {
|
||||
List<FilterEntry> list = new ArrayList<HttpServiceProxy.FilterEntry>();
|
||||
list.addAll(filters);
|
||||
filters.clear();
|
||||
for (FilterEntry e : list) {
|
||||
if (e.getHttpContext().equals(httpContext)) {
|
||||
registerFilter(e.alias, e.filter, e.initparams, e.context);
|
||||
} else {
|
||||
filters.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!servlets.isEmpty()) {
|
||||
List<ServletEntry> list = new ArrayList<HttpServiceProxy.ServletEntry>();
|
||||
list.addAll(servlets);
|
||||
servlets.clear();
|
||||
for (ServletEntry e : list) {
|
||||
if (e.getHttpContext().equals(httpContext)) {
|
||||
registerServlet(e.alias, e.servlet, e.initparams, e.context);
|
||||
} else {
|
||||
servlets.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!resources.isEmpty()) {
|
||||
List<ResourceEntry> list = new ArrayList<HttpServiceProxy.ResourceEntry>();
|
||||
list.addAll(resources);
|
||||
resources.clear();
|
||||
for (ResourceEntry e : list) {
|
||||
if (e.getHttpContext().equals(httpContext)) {
|
||||
registerResources(e.alias, e.name, e.context);
|
||||
} else {
|
||||
resources.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.osgi.service.http.HttpService#unregister(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void unregister(String alias) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.osgi.service.http.HttpService#createDefaultHttpContext()
|
||||
*/
|
||||
@Override
|
||||
public HttpContext createDefaultHttpContext() {
|
||||
return new DefaultHttpContext(bundle);
|
||||
}
|
||||
|
||||
class Entry {
|
||||
protected HttpContext context;
|
||||
|
||||
protected Entry(HttpContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
protected String getHttpContext() {
|
||||
return context != null ? context.getClass().getName() : DefaultHttpContext.class.getName();
|
||||
}
|
||||
}
|
||||
|
||||
class FilterEntry extends Entry {
|
||||
protected String alias;
|
||||
protected Filter filter;
|
||||
protected Dictionary<String, String> initparams;
|
||||
|
||||
protected FilterEntry(String alias, Filter filter,
|
||||
Dictionary<String, String> initparams, HttpContext context) {
|
||||
super(context);
|
||||
this.alias = alias;
|
||||
this.filter = filter;
|
||||
this.initparams = initparams;
|
||||
}
|
||||
}
|
||||
|
||||
class ServletEntry extends Entry {
|
||||
protected String alias;
|
||||
protected Servlet servlet;
|
||||
protected Dictionary<?,?> initparams;
|
||||
protected ServletEntry(String alias, Servlet servlet,
|
||||
Dictionary<?, ?> initparams, HttpContext context) {
|
||||
super(context);
|
||||
this.alias = alias;
|
||||
this.servlet = servlet;
|
||||
this.initparams = initparams;
|
||||
this.context = context;
|
||||
}
|
||||
}
|
||||
|
||||
class ResourceEntry extends Entry {
|
||||
protected String alias;
|
||||
protected String name;
|
||||
|
||||
protected ResourceEntry(String alias, String name, HttpContext context) {
|
||||
super(context);
|
||||
this.alias = alias;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2013 Heng Sin Low *
|
||||
* Copyright (C) 2013 Trek Global *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.eclipse.equinox.http.servlet.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.ServiceFactory;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
import org.osgi.service.http.HttpService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class HttpServiceProxyFactory implements ServiceFactory<HttpService> {
|
||||
|
||||
private static Map<String, ProxyServlet> delegateMap = new HashMap<String, ProxyServlet>();
|
||||
private static List<HttpServiceProxy> proxies = new ArrayList<HttpServiceProxy>();
|
||||
|
||||
@Override
|
||||
public HttpService getService(Bundle bundle,
|
||||
ServiceRegistration<HttpService> registration) {
|
||||
HttpServiceProxy service = new HttpServiceProxy(bundle, this);
|
||||
proxies.add(service);
|
||||
return service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ungetService(Bundle bundle,
|
||||
ServiceRegistration<HttpService> registration, HttpService service) {
|
||||
proxies.remove(service);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param httpContext
|
||||
* @param proxy
|
||||
* @return the previous value associated with the key or null if there was no mapping for key
|
||||
*/
|
||||
public static synchronized ProxyServlet registerServletDelegate(String httpContext, ProxyServlet proxy) {
|
||||
ProxyServlet old = delegateMap.put(httpContext, proxy);
|
||||
for(HttpServiceProxy p : proxies) {
|
||||
try {
|
||||
p.processPendingRegistration(httpContext);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
return old;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param proxy
|
||||
* @return the proxy if it have been register previously
|
||||
*/
|
||||
public static synchronized ProxyServlet unregisterServletDelegate(ProxyServlet proxy) {
|
||||
return delegateMap.remove(proxy.getHttpContext());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param bundle
|
||||
* @param httpContext
|
||||
* @return http service delegate for httpContext ( if any )
|
||||
*/
|
||||
public HttpService getHttpServiceDelegate(Bundle bundle, String httpContext) {
|
||||
ProxyServlet proxy = delegateMap.get(httpContext);
|
||||
if (proxy != null)
|
||||
return new HttpServiceImpl(bundle, proxy);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -35,10 +35,14 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
|||
|
||||
private Map<Filter, FilterRegistration> filterRegistrations = new HashMap<Filter, FilterRegistration>(); //filter --> filter registration;
|
||||
private ProxyContext proxyContext;
|
||||
private String httpContext;
|
||||
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
super.init(config);
|
||||
proxyContext = new ProxyContext(config.getServletContext());
|
||||
httpContext = config.getInitParameter("HttpContext.ClassName");
|
||||
if (httpContext == null)
|
||||
httpContext = DefaultHttpContext.class.getName();
|
||||
Activator.addProxyServlet(this);
|
||||
}
|
||||
|
||||
|
@ -317,4 +321,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
|||
|
||||
}
|
||||
|
||||
public String getHttpContext() {
|
||||
return httpContext;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,22 +11,14 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.equinox.http.servletbridge.internal;
|
||||
|
||||
import org.eclipse.equinox.http.servlet.HttpServiceServlet;
|
||||
import org.eclipse.equinox.servletbridge.BridgeServlet;
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
public class Activator implements BundleActivator {
|
||||
|
||||
private HttpServiceServlet httpServiceServlet;
|
||||
|
||||
public void start(BundleContext context) throws Exception {
|
||||
httpServiceServlet = new HttpServiceServlet();
|
||||
BridgeServlet.registerServletDelegate(httpServiceServlet);
|
||||
}
|
||||
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
BridgeServlet.unregisterServletDelegate(httpServiceServlet);
|
||||
httpServiceServlet = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt:
|
|||
idge;tag=v20100503
|
||||
Bundle-Version: 1.2.0.v20100503
|
||||
Export-Package: org.eclipse.equinox.servletbridge;version="1.1.0"
|
||||
Import-Package: javax.servlet;version="2.3.0",javax.servlet.http;versi
|
||||
on="2.3.0"
|
||||
Import-Package: javax.servlet;version="2.3.0",
|
||||
javax.servlet.http;version="2.3.0",
|
||||
org.eclipse.equinox.http.servlet;version="1.1.0"
|
||||
Bundle-ManifestVersion: 2
|
||||
|
|
|
@ -17,6 +17,8 @@ import java.io.IOException;
|
|||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
|
||||
import org.eclipse.equinox.http.servlet.HttpServiceServlet;
|
||||
|
||||
/**
|
||||
* The BridgeServlet provides a means to bridge the servlet and OSGi
|
||||
* runtimes. This class has 3 main responsibilities:
|
||||
|
@ -31,12 +33,9 @@ public class BridgeServlet extends HttpServlet {
|
|||
static final String INCLUDE_PATH_INFO_ATTRIBUTE = "javax.servlet.include.path_info"; //$NON-NLS-1$
|
||||
|
||||
private static final long serialVersionUID = 2825667412474494674L;
|
||||
private static BridgeServlet instance;
|
||||
private static HttpServlet servletDelegateInstance;
|
||||
private HttpServlet delegate;
|
||||
// true if current HttpServlet is an HTTP Filter and false otherwise.
|
||||
private static boolean delegateIsFilter;
|
||||
private int delegateReferenceCount;
|
||||
private boolean delegateIsFilter;
|
||||
|
||||
/**
|
||||
* init() is called by the Servlet Container and used to instantiate the frameworkLauncher which MUST be an instance of FrameworkLauncher.
|
||||
|
@ -44,14 +43,17 @@ public class BridgeServlet extends HttpServlet {
|
|||
*/
|
||||
public void init() throws ServletException {
|
||||
super.init();
|
||||
setInstance(this);
|
||||
initDelegate();
|
||||
}
|
||||
|
||||
/**
|
||||
* destroy() is called by the Servlet Container and used to first stop and then destroy the framework.
|
||||
*/
|
||||
public void destroy() {
|
||||
setInstance(null);
|
||||
try {
|
||||
initDelegate();
|
||||
} catch (ServletException e) {
|
||||
}
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
|
@ -94,7 +96,7 @@ public class BridgeServlet extends HttpServlet {
|
|||
}
|
||||
}
|
||||
|
||||
HttpServlet servletReference = acquireDelegateReference();
|
||||
HttpServlet servletReference = delegate;
|
||||
if (servletReference == null) {
|
||||
// Cannot find the HttpServletService from OSGi registry services :
|
||||
if (chain != null) {
|
||||
|
@ -106,14 +108,10 @@ public class BridgeServlet extends HttpServlet {
|
|||
resp.sendError(HttpServletResponse.SC_NOT_FOUND, "BridgeServlet: " + req.getRequestURI()); //$NON-NLS-1$
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (delegateIsFilter && chain != null) {
|
||||
((Filter) servletReference).doFilter(req, resp, chain);
|
||||
} else {
|
||||
servletReference.service(req, resp);
|
||||
}
|
||||
} finally {
|
||||
releaseDelegateReference();
|
||||
if (delegateIsFilter && chain != null) {
|
||||
((Filter) servletReference).doFilter(req, resp, chain);
|
||||
} else {
|
||||
servletReference.service(req, resp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,93 +128,10 @@ public class BridgeServlet extends HttpServlet {
|
|||
return lastSegment.indexOf('.') != -1;
|
||||
}
|
||||
|
||||
private static synchronized void setInstance(BridgeServlet servlet) {
|
||||
if ((instance != null) && (servlet != null))
|
||||
throw new IllegalStateException("instance already set"); //$NON-NLS-1$
|
||||
instance = servlet;
|
||||
if (instance == null)
|
||||
servletDelegateInstance = null;
|
||||
else if (servletDelegateInstance != null)
|
||||
registerServletDelegate(servletDelegateInstance);
|
||||
}
|
||||
|
||||
private synchronized void releaseDelegateReference() {
|
||||
--delegateReferenceCount;
|
||||
notifyAll();
|
||||
}
|
||||
|
||||
private synchronized HttpServlet acquireDelegateReference() {
|
||||
if (delegate != null)
|
||||
++delegateReferenceCount;
|
||||
return delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* registerServletDelegate is the hook method called from inside the OSGi runtime to register
|
||||
* a servlet for which all future servlet calls will be delegated. If not null and no delegate
|
||||
* is currently registered, init(ServletConfig) will be called on the servletDelegate before
|
||||
* returning.
|
||||
* @param servletDelegate - the servlet to register for delegation
|
||||
*/
|
||||
public static synchronized void registerServletDelegate(HttpServlet servletDelegate) {
|
||||
if (instance == null) {
|
||||
servletDelegateInstance = servletDelegate;
|
||||
return;
|
||||
}
|
||||
|
||||
servletDelegateInstance = null;
|
||||
|
||||
if (servletDelegate == null)
|
||||
throw new NullPointerException("cannot register a null servlet delegate"); //$NON-NLS-1$
|
||||
|
||||
synchronized (instance) {
|
||||
if (instance.delegate != null)
|
||||
throw new IllegalStateException("A Servlet Proxy is already registered"); //$NON-NLS-1$
|
||||
|
||||
try {
|
||||
// cache the flag if HttpServlet servlet delegate is an HTTP Filter.
|
||||
BridgeServlet.delegateIsFilter = (servletDelegate instanceof Filter);
|
||||
// initialize the servlet delegate.
|
||||
servletDelegate.init(instance.getServletConfig());
|
||||
} catch (ServletException e) {
|
||||
instance.getServletContext().log("Error initializing servlet delegate", e); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
instance.delegate = servletDelegate;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* unregisterServletDelegate is the hook method called from inside the OSGi runtime to unregister a delegate.
|
||||
* If the servletDelegate matches the current registered delegate destroy() is called on the servletDelegate.
|
||||
* destroy() will not be called until the delegate is finished servicing any previous requests.
|
||||
* @param servletDelegate - the servlet to unregister
|
||||
*/
|
||||
public static synchronized void unregisterServletDelegate(HttpServlet servletDelegate) {
|
||||
if (instance == null) {
|
||||
// shutdown already
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (instance) {
|
||||
if (instance.delegate == null)
|
||||
throw new IllegalStateException("No servlet delegate is registered"); //$NON-NLS-1$
|
||||
|
||||
if (instance.delegate != servletDelegate)
|
||||
throw new IllegalStateException("Servlet delegate does not match registered servlet delegate"); //$NON-NLS-1$
|
||||
|
||||
HttpServlet oldProxy = instance.delegate;
|
||||
instance.delegate = null;
|
||||
BridgeServlet.delegateIsFilter = false;
|
||||
while (instance.delegateReferenceCount != 0) {
|
||||
try {
|
||||
instance.wait();
|
||||
} catch (InterruptedException e) {
|
||||
// keep waiting for all requests to finish
|
||||
}
|
||||
}
|
||||
oldProxy.destroy();
|
||||
}
|
||||
private void initDelegate() throws ServletException {
|
||||
delegate = new HttpServiceServlet();
|
||||
delegate.init(getServletConfig());
|
||||
delegateIsFilter = (delegate instanceof Filter);
|
||||
}
|
||||
|
||||
static class ExtensionMappingRequest extends HttpServletRequestWrapper {
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
id="org.eclipse.gemini.web.feature"
|
||||
version="0.0.0"/>
|
||||
|
||||
<includes
|
||||
id="org.idempiere.felix.webconsole"
|
||||
version="0.0.0"/>
|
||||
|
||||
<requires>
|
||||
<import feature="org.adempiere.base" version="1.0.0" match="compatible"/>
|
||||
</requires>
|
||||
|
@ -322,4 +326,11 @@
|
|||
version="1.4.5"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.equinox.cm"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
|
@ -35,9 +35,9 @@
|
|||
|
||||
<configurations>
|
||||
<plugin id="org.adempiere.base" autoStart="true" startLevel="4" />
|
||||
<plugin id="org.adempiere.eclipse.equinox.http.servlet" autoStart="true" startLevel="0" />
|
||||
<plugin id="org.adempiere.eclipse.equinox.http.servletbridge" autoStart="true" startLevel="0" />
|
||||
<plugin id="org.adempiere.eclipse.equinox.servletbridge" autoStart="true" startLevel="0" />
|
||||
<plugin id="org.adempiere.eclipse.equinox.http.servlet" autoStart="true" startLevel="4" />
|
||||
<plugin id="org.adempiere.eclipse.equinox.http.servletbridge" autoStart="true" startLevel="4" />
|
||||
<plugin id="org.adempiere.eclipse.equinox.servletbridge" autoStart="true" startLevel="4" />
|
||||
<plugin id="org.adempiere.install" autoStart="true" startLevel="4" />
|
||||
<plugin id="org.adempiere.replication.server" autoStart="true" startLevel="4" />
|
||||
<plugin id="org.adempiere.report.jasper.webapp" autoStart="true" startLevel="4" />
|
||||
|
@ -53,6 +53,8 @@
|
|||
<plugin id="org.eclipse.gemini.web.extender" autoStart="true" startLevel="4" />
|
||||
<plugin id="org.eclipse.gemini.web.tomcat" autoStart="true" startLevel="4" />
|
||||
<plugin id="org.eclipse.osgi.services" autoStart="true" startLevel="3" />
|
||||
<plugin id="org.idempiere.felix.webconsole" autoStart="true" startLevel="0" />
|
||||
<plugin id="org.apache.felix.webconsole" autoStart="true" startLevel="0" />
|
||||
<plugin id="org.idempiere.hazelcast.service" autoStart="true" startLevel="0" />
|
||||
<plugin id="org.restlet" autoStart="true" startLevel="3" />
|
||||
<property name="org.eclipse.update.reconcile" value="false" />
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,100 +3,120 @@
|
|||
<plugin>
|
||||
<extension
|
||||
point="org.eclipse.equinox.http.registry.servlets">
|
||||
<serviceSelector
|
||||
filter="(bundleSymbolicName=org.adempiere.webstore)">
|
||||
</serviceSelector>
|
||||
<servlet
|
||||
alias="/advertisementServlet"
|
||||
class="org.compiere.wstore.AdvertisementServlet">
|
||||
class="org.compiere.wstore.AdvertisementServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/assetServlet"
|
||||
class="org.compiere.wstore.AssetServlet">
|
||||
class="org.compiere.wstore.AssetServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/basketServlet"
|
||||
class="org.compiere.wstore.BasketServlet">
|
||||
class="org.compiere.wstore.BasketServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/checkOutServlet"
|
||||
class="org.compiere.wstore.CheckOutServlet">
|
||||
class="org.compiere.wstore.CheckOutServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/click"
|
||||
class="org.compiere.wstore.Click">
|
||||
class="org.compiere.wstore.Click"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/expenseServlet"
|
||||
class="org.compiere.wstore.ExpenseServlet">
|
||||
class="org.compiere.wstore.ExpenseServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/counter"
|
||||
class="org.compiere.wstore.Counter">
|
||||
class="org.compiere.wstore.Counter"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/infoServlet"
|
||||
class="org.compiere.wstore.InfoServlet">
|
||||
class="org.compiere.wstore.InfoServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/invoiceServlet"
|
||||
class="org.compiere.wstore.InvoiceServlet">
|
||||
class="org.compiere.wstore.InvoiceServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/locationServlet"
|
||||
class="org.compiere.wstore.LocationServlet">
|
||||
class="org.compiere.wstore.LocationServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/loginServlet"
|
||||
class="org.compiere.wstore.LoginServlet">
|
||||
class="org.compiere.wstore.LoginServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/noteServlet"
|
||||
class="org.compiere.wstore.NoteServlet">
|
||||
class="org.compiere.wstore.NoteServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/orderServlet"
|
||||
class="org.compiere.wstore.OrderServlet">
|
||||
class="org.compiere.wstore.OrderServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/paymentServlet"
|
||||
class="org.compiere.wstore.PaymentServlet">
|
||||
class="org.compiere.wstore.PaymentServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/productServlet"
|
||||
class="org.compiere.wstore.ProductServlet">
|
||||
class="org.compiere.wstore.ProductServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/registrationServlet"
|
||||
class="org.compiere.wstore.RegistrationServlet">
|
||||
class="org.compiere.wstore.RegistrationServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/requestServlet"
|
||||
class="org.compiere.wstore.RequestServlet">
|
||||
class="org.compiere.wstore.RequestServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/rfqServlet"
|
||||
class="org.compiere.wstore.RfQServlet">
|
||||
class="org.compiere.wstore.RfQServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/searchServlet"
|
||||
class="org.compiere.wstore.SearchServlet">
|
||||
class="org.compiere.wstore.SearchServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/updateServlet"
|
||||
class="org.compiere.wstore.UpdateServlet">
|
||||
class="org.compiere.wstore.UpdateServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/workflowServlet"
|
||||
class="org.compiere.wstore.WorkflowServlet">
|
||||
class="org.compiere.wstore.WorkflowServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/emailServlet"
|
||||
class="org.compiere.wstore.EMailServlet">
|
||||
class="org.compiere.wstore.EMailServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
<servlet
|
||||
alias="/issueReportServlet"
|
||||
class="org.compiere.wstore.IssueReportServlet">
|
||||
class="org.compiere.wstore.IssueReportServlet"
|
||||
httpcontextId="org.adempiere.webstore">
|
||||
</servlet>
|
||||
</extension>
|
||||
|
||||
|
|
|
@ -49,4 +49,7 @@ Import-Package: javax.servlet;version="2.5.0",
|
|||
org.apache.taglibs.standard.tlv;version="1.1.2",
|
||||
org.eclipse.equinox.http.registry;version="1.0.0",
|
||||
org.eclipse.equinox.http.servlet;version="1.1.0",
|
||||
org.eclipse.equinox.servletbridge;version="1.1.0"
|
||||
org.eclipse.equinox.servletbridge;version="1.1.0",
|
||||
org.osgi.framework;version="1.6.0",
|
||||
org.osgi.service.http;version="1.2.1"
|
||||
Bundle-Activator: org.adempiere.webstore.Activator
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
<filter-name>equinoxBridgeFilter</filter-name>
|
||||
<filter-class>org.eclipse.equinox.servletbridge.BridgeFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>bundleSymbolicName</param-name>
|
||||
<param-value>org.adempiere.webstore</param-value>
|
||||
<param-name>HttpContext.ClassName</param-name>
|
||||
<param-value>org.adempiere.webstore.DefaultHttpContext</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
output.. = build/
|
||||
bin.includes = META-INF/,\
|
||||
*.*,\
|
||||
WEB-INF/
|
||||
WEB-INF/,\
|
||||
plugin.xml
|
||||
bin.excludes = src/**,\
|
||||
build/**,\
|
||||
.settings/**,\
|
||||
.classpath,\
|
||||
.project,\
|
||||
build.properties
|
||||
source.. = src/
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.eclipse.equinox.http.registry.httpcontexts">
|
||||
<httpcontext
|
||||
class="org.adempiere.webstore.DefaultHttpContext"
|
||||
id="org.adempiere.webstore">
|
||||
</httpcontext>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.adempiere.webstore;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class Activator implements BundleActivator {
|
||||
|
||||
static BundleContext bundleContext;
|
||||
|
||||
/**
|
||||
* default constructor
|
||||
*/
|
||||
public Activator() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
bundleContext = context;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
bundleContext = null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package org.adempiere.webstore;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.osgi.service.http.HttpContext;
|
||||
|
||||
public class DefaultHttpContext implements HttpContext {
|
||||
|
||||
public DefaultHttpContext() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleSecurity(HttpServletRequest request,
|
||||
HttpServletResponse response) throws IOException {
|
||||
// default behaviour assumes the container has already performed authentication
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getResource(String name) {
|
||||
return Activator.bundleContext.getBundle().getResource(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMimeType(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.idempiere.felix.webconsole-feature</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1 @@
|
|||
bin.includes = feature.xml
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feature
|
||||
id="org.idempiere.felix.webconsole"
|
||||
label="Felix Web Console Feature"
|
||||
version="1.0.0.qualifier">
|
||||
|
||||
<description url="http://www.example.com/description">
|
||||
[Enter Feature Description here.]
|
||||
</description>
|
||||
|
||||
<copyright url="http://www.example.com/copyright">
|
||||
[Enter Copyright Description here.]
|
||||
</copyright>
|
||||
|
||||
<license url="http://www.example.com/license">
|
||||
[Enter License Description here.]
|
||||
</license>
|
||||
|
||||
<plugin
|
||||
id="org.apache.felix.webconsole"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.apache.felix.webconsole.plugins.memoryusage"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.apache.felix.webconsole.plugins.packageadmin"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.idempiere.felix.webconsole"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.idempiere.felix.webconsole</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ds.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -0,0 +1,3 @@
|
|||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
|
@ -0,0 +1,29 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Web Console
|
||||
Bundle-SymbolicName: org.idempiere.felix.webconsole
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: org.idempiere.felix.webconsole.Activator
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: javax.servlet;version="2.5.0",
|
||||
javax.servlet.http;version="2.5.0",
|
||||
javax.servlet.jsp;version="2.1.0",
|
||||
javax.servlet.jsp.el;version="2.1.0",
|
||||
javax.servlet.jsp.jstl.core;version="1.1.2",
|
||||
javax.servlet.jsp.jstl.fmt;version="1.1.2",
|
||||
javax.servlet.jsp.jstl.sql;version="1.1.2",
|
||||
javax.servlet.jsp.jstl.tlv;version="1.1.2",
|
||||
javax.servlet.jsp.resources;version="2.1.0",
|
||||
javax.servlet.jsp.tagext;version="2.1.0",
|
||||
javax.servlet.resources;version="2.5.0",
|
||||
org.apache.felix.webconsole;version="3.1.2",
|
||||
org.compiere.model,
|
||||
org.compiere.util,
|
||||
org.eclipse.equinox.http.registry;version="1.0.0",
|
||||
org.eclipse.equinox.http.servlet;version="1.1.0",
|
||||
org.eclipse.equinox.servletbridge;version="1.1.0",
|
||||
org.osgi.framework;version="1.6.0",
|
||||
org.osgi.service.http;version="1.2.1"
|
||||
Web-ContextPath: osgi
|
||||
Service-Component: OSGI-INF/securityprovider.xml
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.felix.webconsole.security.provider">
|
||||
<implementation class="org.idempiere.felix.webconsole.SecurityProviderImpl"/>
|
||||
<service>
|
||||
<provide interface="org.apache.felix.webconsole.WebConsoleSecurityProvider"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
|
||||
version="2.4">
|
||||
<display-name>Web Console</display-name>
|
||||
<description></description>
|
||||
<filter id="bridge">
|
||||
<filter-name>equinoxBridgeFilter</filter-name>
|
||||
<filter-class>org.eclipse.equinox.servletbridge.BridgeFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>HttpContext.ClassName</param-name>
|
||||
<param-value>org.apache.felix.webconsole.internal.servlet.OsgiManagerHttpContext</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>equinoxBridgeFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<!--
|
||||
This is required if your application bundles expose JSPs.
|
||||
-->
|
||||
<filter-mapping>
|
||||
<filter-name>equinoxBridgeFilter</filter-name>
|
||||
<url-pattern>*.jsp</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<session-config>
|
||||
<session-timeout>30</session-timeout>
|
||||
</session-config>
|
||||
|
||||
<mime-mapping>
|
||||
<extension>css</extension>
|
||||
<mime-type>text/css</mime-type>
|
||||
</mime-mapping>
|
||||
|
||||
</web-app>
|
|
@ -0,0 +1,7 @@
|
|||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
WEB-INF/,\
|
||||
OSGI-INF/securityprovider.xml
|
||||
src.includes = WEB-INF/
|
||||
source.. = src/
|
|
@ -0,0 +1,30 @@
|
|||
package org.idempiere.felix.webconsole;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
public class Activator implements BundleActivator {
|
||||
|
||||
private static BundleContext context;
|
||||
|
||||
static BundleContext getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext bundleContext) throws Exception {
|
||||
Activator.context = bundleContext;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext bundleContext) throws Exception {
|
||||
Activator.context = null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.idempiere.felix.webconsole;
|
||||
|
||||
import org.apache.felix.webconsole.WebConsoleSecurityProvider;
|
||||
import org.compiere.model.MUser;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class SecurityProviderImpl implements WebConsoleSecurityProvider {
|
||||
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.felix.webconsole.WebConsoleSecurityProvider#authenticate(java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Object authenticate(String username, String password) {
|
||||
MUser user = MUser.get(Env.getCtx(), username, password);
|
||||
if (user == null)
|
||||
{
|
||||
log.warning ("User not found: '" + username);
|
||||
return null;
|
||||
}
|
||||
if (!user.isAdministrator())
|
||||
{
|
||||
log.warning ("Not a Sys Admin = " + username);
|
||||
return null;
|
||||
}
|
||||
log.info ("Name=" + username);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.felix.webconsole.WebConsoleSecurityProvider#authorize(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean authorize(Object resource, String role) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -236,15 +236,15 @@ Export-Package: Lib,
|
|||
optparse,
|
||||
org.apache.commons.el,
|
||||
org.apache.commons.el.parser,
|
||||
org.apache.commons.fileupload,
|
||||
org.apache.commons.fileupload.disk,
|
||||
org.apache.commons.fileupload.portlet,
|
||||
org.apache.commons.fileupload.servlet,
|
||||
org.apache.commons.fileupload.util,
|
||||
org.apache.commons.io,
|
||||
org.apache.commons.io.filefilter,
|
||||
org.apache.commons.io.input,
|
||||
org.apache.commons.io.output,
|
||||
org.apache.commons.fileupload;version="1.2.2",
|
||||
org.apache.commons.fileupload.disk;version="1.2.2",
|
||||
org.apache.commons.fileupload.portlet;version="1.2.2",
|
||||
org.apache.commons.fileupload.servlet;version="1.2.2",
|
||||
org.apache.commons.fileupload.util;version="1.2.2",
|
||||
org.apache.commons.io;version="2.1.0",
|
||||
org.apache.commons.io.filefilter;version="2.1.0",
|
||||
org.apache.commons.io.input;version="2.1.0",
|
||||
org.apache.commons.io.output;version="2.1.0",
|
||||
org.apache.html.dom,
|
||||
org.apache.wml,
|
||||
org.apache.wml.dom,
|
||||
|
|
Loading…
Reference in New Issue