I've finally decided on how I'm going to implement the OSGi
HttpService and I have a few questions:
To begin with I going to have to implement a GrizzlyAdapter (which I
knew I was going to have to do) but I want to reuse as much of the
existing code as I can. In particular the current Servlet invocation
code. But to make that work I need to either:
1) Make some minor mods to the current implementation because I have
to do some things a little different. Not very many but still a
modification. These mods would be very minor basiclly create a new
constructor that would take a flag indicating that the implementation
is running as a OSGi implementation then use that flag in the methods
that need to change for execution in the OSGi environment. For
instance:
// NOTE would have to also implement a default constructor so the
existing code would not break.
public HttpServletRequestImpl(boolean osgiFlag) {
this.osgiFlag = osgiFlag;
}
And used like so:
public String getAuthType() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
if(osgiFlag) {
// get OSGi security type out of the HTTP header
} else {
return request.getAuthType();
}
}
Or
2) Extend the current implementations and override the methods I need
to change.
Personally I would prefer option one mostly because it keeps all the
code in one place.
I have a bunch of other questions but I want to get them clear in my
head first before asking them.
Thanks
Richard