Hi Igor,

The main problem I see here is that there is not a single approach on building a wicket based OSGi application. For instance, we have taken a different approach to the one described in a previous e-mail. Moreover, as we had some code base already working when we decided go OSGi what we did was to look for a "fast" way to get that code base working on an OSGi environment: we simply couldn't go the PAX way because that would mean re-writing an existing code base. As we were using Eclipse as development tool the way we found to get back on track is eclipse dependent (in fact, equinox dependent, which is eclipses implementation of OSGi). As I mentioned before almost all problems we found boiled down to classloading issues. We have solved then using a "technique" called buddy class loading (equinox has an extension that makes it very easy to solve these problems). All this code is property of the company I work for, so it is not up to me to disclose it (or part of it).

If you (and/or others) think it could be useful I could try to build a very simple (equinox depended) quick start sample application, maybe containing one or two bundles to illustrate how to solve classloading problems on equinox, as well as a README explaining how to get on track.

Best regards,

Ernesto


Igor Vaynberg wrote:
perhaps one of the groups who are using wicket and osgi successfully
can put together an example project that demonstrates all these
concepts so the community does not have to reinvent the wheel and
solve problems that have already been solved by others...thats what
this is all about afterall

-igor


On Nov 16, 2007 5:37 AM, dado <[EMAIL PROTECTED]> wrote:
Edgar and all,

I am new to wicket but have built an application using Velocity and Equinox
OSGi.  I am hoping to switch from Velocity to Wicket.  Edgar's code below is
most helpful!  Do you or anyone have any other code to share?  Bundles?  For
example, this code would be helpful as well
"you have to register an OsgiWicketServlet instance in the HttpService".

Thanks for your help!
David



Edgar Poce wrote:
Hi,

 I ran a helloworld application in osgi, the only problem I found was
a classloader issue, I had to use a custom IWebApplicationFactory. I
copy the code bellow.
 In order to make it work you have to register an OsgiWicketServlet
instance in the HttpService.

hope it helps,
Edgar


public class OsgiWebApplicationFactory implements IWebApplicationFactory {

      private Class webApplication;

      public OsgiWebApplicationFactory(Class webApplication) {
              super();
              this.webApplication = webApplication;
      }

      public WebApplication createApplication(WicketFilter filter) {
              try {
                      return (WebApplication) this.webApplication.newInstance();
              } catch (Exception e) {
                      throw new RuntimeException("unable to start application", 
e);
              }
      }

}

public class OsgiWicketFilter extends WicketFilter {

      private Class webApplication;

      public OsgiWicketFilter(Class webApplication) {
              super();
              this.webApplication = webApplication;
      }

      @Override
      protected IWebApplicationFactory getApplicationFactory() {
              return new OsgiWebApplicationFactory(this.webApplication);
      }

}

public class OsgiWicketServlet extends WicketServlet {

      private String name;

      private Class webApplication;

      public OsgiWicketServlet(Class webApplication) {
              super();
              this.webApplication = webApplication;
      }

      @Override
      protected WicketFilter newWicketFilter() {
              return new OsgiWicketFilter(this.webApplication);
      }

      /**
       * The servlet name can't contain * characters because Wicket uses the
name
       * of the servlet to create a temporary folder.
       */
      public String getServletName() {
              if (name == null) {
                      synchronized (this) {
                              name = super.getServletName();
                              if (name.endsWith("*")) {
                                      name = name.substring(0, name.length() - 
1);
                              }
                      }
              }
              return name;
      }

}

On Nov 14, 2007 11:46 AM, Thies Edeling <[EMAIL PROTECTED]> wrote:
Hello all,

Does anyone have any experience with using Wicket and OSGi? I'm looking
for the most flexible way of composing an application and deploying
Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the
Pax Wicket project but am not sure how stable that is.

regards,
Thies

--
http://www.ehour.nl/
http://blog.ehour.nl/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
View this message in context: 
http://www.nabble.com/Wicket---OSGi-tf4805767.html#a13793200
Sent from the Wicket - User mailing list archive at Nabble.com.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to