I'm using NanoHTTPD
's RouterNanoHTTPD
to add route mappings.
Calling addRoute(String uri, Class<?> handler, Object ... params)
does not call the parameterized constructor to instantiate an object of the Class<?> handler
. Has anyone been able to do this?
The problem is exactly the same as posted on this Github Issue of the NanoHTTPD.
public class SoapServer extends RouterNanoHTTPD {
@Override
public void addMappings() {
super.addMappings();
// works fine when there are no parameters passed
addRoute("/onvif/device_service", DeviceServiceHandler.class);
// MediaServiceHandler instantiated with empty constructor;
// it doesn't create the class with these arguments in the constructor
addRoute("/onvif/media_service", MediaServiceHandler.class,
systemServices, userRepository, authenticators);
}