1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.acme.osgi;
20
21 import java.util.Dictionary;
22 import java.util.Hashtable;
23
24 import org.eclipse.jetty.server.Server;
25 import org.eclipse.jetty.server.handler.ContextHandler;
26 import org.osgi.framework.Bundle;
27 import org.osgi.framework.BundleActivator;
28 import org.osgi.framework.BundleContext;
29 import org.osgi.framework.BundleException;
30 import org.osgi.framework.FrameworkUtil;
31 import org.osgi.framework.ServiceRegistration;
32 import org.osgi.util.tracker.BundleTracker;
33
34
35
36
37
38
39 public class Activator implements BundleActivator
40 {
41
42
43
44
45
46 public void start(BundleContext context) throws Exception
47 {
48 ContextHandler ch = new ContextHandler();
49 Dictionary props = new Hashtable();
50 props.put("contextPath","/acme");
51 props.put("Jetty-ContextFilePath", "acme.xml");
52 context.registerService(ContextHandler.class.getName(),ch,props);
53 }
54
55
56
57
58
59
60
61 public void stop(BundleContext context) throws Exception
62 {
63 }
64 }