View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
4   //  ------------------------------------------------------------------------
5   //  All rights reserved. This program and the accompanying materials
6   //  are made available under the terms of the Eclipse Public License v1.0
7   //  and Apache License v2.0 which accompanies this distribution.
8   //
9   //      The Eclipse Public License is available at
10  //      http://www.eclipse.org/legal/epl-v10.html
11  //
12  //      The Apache License v2.0 is available at
13  //      http://www.opensource.org/licenses/apache2.0.php
14  //
15  //  You may elect to redistribute this code under either of these licenses.
16  //  ========================================================================
17  //
18  
19  package org.eclipse.jetty.osgi.boot.jsp;
20  
21  
22  import org.eclipse.jetty.osgi.boot.internal.serverfactory.ServerInstanceWrapper;
23  import org.eclipse.jetty.osgi.boot.jasper.ContainerTldBundleDiscoverer;
24  import org.osgi.framework.BundleActivator;
25  import org.osgi.framework.BundleContext;
26  
27  /**
28   * FragmentActivator
29   * 
30   * Sets up support for jsp and jstl. All relevant jsp jars must also be installed
31   * into the osgi environment.
32   *  <p>
33   * Note that as this is part of a bundle fragment, this activator is NOT
34   * called by the OSGi environment. Instead, the org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminTracker
35   * simulates fragment activation and causes this class's start() method to
36   * be called.
37   * </p>
38   *  <p>
39   * The package of this class MUST match the Bundle-SymbolicName of this fragment
40   * in order for the PackageAdminTracker to find it.
41   * </p>
42   */
43  public class FragmentActivator implements BundleActivator
44  {
45      /**
46       * 
47       */
48      public void start(BundleContext context) throws Exception
49      {
50          //jsr199 compilation does not work in osgi
51          System.setProperty("org.apache.jasper.compiler.disablejsr199", Boolean.TRUE.toString());
52          
53          //set up some classes that will look for bundles with tlds that must be converted
54          //to urls and treated as if they are on the Jetty container's classpath so that 
55          //jasper can deal with them
56          ServerInstanceWrapper.addContainerTldBundleDiscoverer(new ContainerTldBundleDiscoverer());      
57      }
58  
59      /**
60       * 
61       */
62      public void stop(BundleContext context) throws Exception
63      {
64  
65      }
66  }