View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2013 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  import org.eclipse.jetty.osgi.boot.BundleWebAppProvider;
22  import org.eclipse.jetty.osgi.boot.internal.serverfactory.ServerInstanceWrapper;
23  import org.eclipse.jetty.osgi.boot.jasper.ContainerTldBundleDiscoverer;
24  import org.eclipse.jetty.osgi.boot.jasper.JSTLBundleDiscoverer;
25  import org.osgi.framework.BundleActivator;
26  import org.osgi.framework.BundleContext;
27  
28  /**
29   * FragmentActivator
30   * 
31   * Sets up support for jsp. All relevant jsp jars must also be installed
32   * into the osgi environment.
33   *  <p>
34   * Note that as this is part of a bundle fragment, this activator is NOT
35   * called by the OSGi environment. Instead, the org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminTracker
36   * simulates fragment activation and causes this class's start() method to
37   * be called.
38   * </p>
39   *  <p>
40   * The package of this class MUST match the Bundle-SymbolicName of this fragment
41   * in order for the PackageAdminTracker to find it.
42   * </p>
43   */
44  public class FragmentActivator implements BundleActivator
45  {
46      /**
47       * 
48       */
49      public void start(BundleContext context) throws Exception
50      {
51          //jsr199 compilation does not work in osgi
52          System.setProperty("org.apache.jasper.compiler.disablejsr199", Boolean.TRUE.toString());
53          
54          //set up some classes that will look for bundles with tlds that must be converted
55          //to urls and treated as if they are on the Jetty container's classpath so that 
56          //jasper can deal with them
57          ServerInstanceWrapper.addContainerTldBundleDiscoverer(new JSTLBundleDiscoverer());
58          ServerInstanceWrapper.addContainerTldBundleDiscoverer(new ContainerTldBundleDiscoverer());      
59      }
60  
61      /**
62       * 
63       */
64      public void stop(BundleContext context) throws Exception
65      {
66  
67      }
68  }