Feature Requests item #1245268, was opened at 2005-07-26 16:08
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684978&aid=1245268&group_id=119783

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Submitted By: timur11 (timur11)
Assigned to: Nobody/Anonymous (nobody)
Summary: Enable the use of Wicket in an OSGi container

Initial Comment:
This requires the following two changes to Wicket.

1. wicket.protocol.http.WicketServlet must separate
Class.forName(applicationClassName) from the base
init() methode:

  /**
   * instantiateApplication() separate from the init()
method, 
   * so that Class.forName can be executed in the
context of the  
   * OSGi bundle (and it's classloader)
   * 
   * @author Timur Mehrvarz
   */
  public Class instantiateApplication(String
applicationClassName)
               throws java.lang.ClassNotFoundException
  {
    return Class.forName(applicationClassName);
  }

  /**
   * Servlet initialization
   */
  public void init()
  {
    final String applicationClassName =
getInitParameter("applicationClassName");
    try
    {
//    final Class applicationClass =
Class.forName(applicationClassName);
      final Class applicationClass =
instantiateApplication(applicationClassName);

A servlet, that extends WicketServlet could implement
it's own instantiateApplication() methode and have
Class.forName() be executed in the context of it's own
OSGi classloader.


2. Provide a special implementation of
wicket.util.file.Path class to access documents (HTML
files) from within a JAR bundle

import wicket.util.file.Path;

/**
 * OSGiPath
 * 
 * @author Timur Mehrvarz
 */
  public final class OsgiPath extends Path
  {
    /**
     * Constructor
     */
    public OsgiPath()
    {
    }

    /**
     * Looks for a given file along this path in a OSGI
bundle
     * 
     * @param pathname
     *            The filename with possible path
     * @return The url located on the path
     */
    public URL find(final String pathname)
    {
      String resourcePathName = "/"+pathname;
      return getClass().getResource(resourcePathName);
    }
  }

The application that would extend
wicket.protocol.http.WebApplication would need to
set/configure the OsgiPath() class.




----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684978&aid=1245268&group_id=119783


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to