Fix errors from small osgi refactor; comment out some test code

This commit is contained in:
Jan Bartel 2013-05-28 15:10:12 +10:00
parent 82b0ae2c63
commit 5df7ab401d
3 changed files with 32 additions and 13 deletions

View File

@ -115,24 +115,24 @@ public class TagLibOSGiConfiguration extends TagLibConfiguration
{ {
atLeastOneTldFound = true; atLeastOneTldFound = true;
URL oriUrl = en.nextElement(); URL oriUrl = en.nextElement();
URL url = BundleFileLocatorHelperFactory.getFactory().getHelper().getLocalURL(oriUrl);
Resource tldResource;
try try
{ {
URL url = BundleFileLocatorHelperFactory.getFactory().getHelper().getLocalURL(oriUrl);
Resource tldResource;
tldResource = Resource.newResource(url); tldResource = Resource.newResource(url);
tlds.add(tldResource);
} }
catch (IOException e) catch (Exception e)
{ {
throw new IllegalArgumentException("Unable to locate the " + "tld resource in '" throw new IllegalArgumentException("Unable to locate the " + "tld resource in '"
+ url.toString() + oriUrl.toString()
+ "' in the bundle '" + "' in the bundle '"
+ bs[0].getSymbolicName() + bs[0].getSymbolicName()
+ "' while registering the " + "' while registering the "
+ OSGiWebappConstants.REQUIRE_TLD_BUNDLE + OSGiWebappConstants.REQUIRE_TLD_BUNDLE
+ " of the manifest of " + " of the manifest of "
+ bundle.getSymbolicName(), e); + bundle.getSymbolicName(), e);
} }
tlds.add(tldResource);
} }
if (!atLeastOneTldFound) if (!atLeastOneTldFound)
{ {

View File

@ -46,7 +46,7 @@ public class Util
* @throws MalformedURLException * @throws MalformedURLException
*/ */
public static List<URL> fileNamesAsURLs(String val, String delims) public static List<URL> fileNamesAsURLs(String val, String delims)
throws MalformedURLException throws Exception
{ {
String separators = DEFAULT_DELIMS; String separators = DEFAULT_DELIMS;
if (delims == null) if (delims == null)

View File

@ -46,11 +46,30 @@ public class Activator implements BundleActivator
*/ */
public void start(BundleContext context) throws Exception public void start(BundleContext context) throws Exception
{ {
String serverName = "defaultJettyServer";
/* Uncomment to create a different server instance to deploy to. Also change
* TestJettyOSGiBootWebAppAsService to use the port 9999
Server server = new Server();
//do any setup on Server in here
serverName = "fooServer";
Dictionary serverProps = new Hashtable();
//define the unique name of the server instance
serverProps.put("managedServerName", serverName);
serverProps.put("jetty.port", "9999");
//let Jetty apply some configuration files to the Server instance
serverProps.put("jetty.etc.config.urls", "file:/opt/jetty/etc/jetty.xml,file:/opt/jetty/etc/jetty-selector.xml,file:/opt/jetty/etc/jetty-deployer.xml");
//register as an OSGi Service for Jetty to find
context.registerService(Server.class.getName(), server, serverProps);
*/
//Create a webapp context as a Service and target it at the Server created above
WebAppContext webapp = new WebAppContext(); WebAppContext webapp = new WebAppContext();
Dictionary props = new Hashtable(); Dictionary props = new Hashtable();
props.put("war","."); props.put("war",".");
props.put("contextPath","/acme"); props.put("contextPath","/acme");
//uiProps.put(OSGiServerConstants.MANAGED_JETTY_SERVER_NAME, serverName); props.put("managedServerName", serverName);
context.registerService(ContextHandler.class.getName(),webapp,props); context.registerService(ContextHandler.class.getName(),webapp,props);
} }