Mantis - Resin
Viewing Issue Advanced Details
2683 minor always 05-19-08 16:44 06-05-08 15:59
ferg  
ferg  
normal  
closed 3.1.6  
fixed  
none    
none 3.2.0  
0002683: ports available in servlet init
(rep by Vinod Mehra)


        ResinMXBean resinMXBean = Resin.getCurrent().getAdmin(); // perhaps mbean lookup will be better
        if (resinMXBean == null) throw new IllegalStateException("ResinMXBean not initialized yet");
 
        PortMXBean[] ports = serverMXBean.getPorts();
        if (ports == null || ports.length < 1) return -1;
 
        for (PortMXBean port : ports) {
            if (port.getProtocolName().equals("http")) return port.getPort();
        }
        return -1;
 
Also I moved the initialization to servlet-context listener. But it doesn't work. The reason is com.caucho.server.cluster.Server is initialized only after the listeners, filters and servlets etc are initialized. Is there anyother way I can find the port number?
 


Notes
(0003145)
ferg   
06-05-08 15:59   
server/2793