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]