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.utils;
20  
21  import java.net.URL;
22  
23  import org.eclipse.jetty.deploy.DeploymentManager;
24  
25  
26  /**
27   * Fix various shortcomings with the way jasper parses the tld files.
28   */
29  public interface WebappRegistrationCustomizer
30  {
31      /**
32       * we could do something a lot more pluggable with a custom header in the
33       * manifest or some customer declarative services let's keep it simple for
34       * now. hopefully the rest of the world won't need to customize this.
35       */
36      public static final String CLASS_NAME = "org.eclipse.jetty.osgi.boot.jasper.WebappRegistrationCustomizerImpl";
37  
38      /**
39       * TODO: right now only the jetty-jsp bundle is scanned for common taglibs.
40       * Should support a way to plug more bundles that contain taglibs.
41       * 
42       * The jasper TldScanner expects a URLClassloader to parse a jar for the
43       * /META-INF/*.tld it may contain. We place the bundles that we know contain
44       * such tag-libraries. Please note that it will work if and only if the
45       * bundle is a jar (!) Currently we just hardcode the bundle that contains
46       * the jstl implemenation.
47       * 
48       * A workaround when the tld cannot be parsed with this method is to copy
49       * and paste it inside the WEB-INF of the webapplication where it is used.
50       * 
51       * Support only 2 types of packaging for the bundle: - the bundle is a jar
52       * (recommended for runtime.) - the bundle is a folder and contain jars in
53       * the root and/or in the lib folder (nice for PDE developement situations)
54       * Unsupported: the bundle is a jar that embeds more jars.
55       * 
56       * @return array of URLs
57       * @throws Exception
58       */
59      URL[] getJarsWithTlds(DeploymentManager manager, BundleFileLocatorHelper fileLocator) throws Exception;
60  
61  }