Last active
December 18, 2015 02:28
-
-
Save MarkMenard/5710668 to your computer and use it in GitHub Desktop.
This Servelet listener is to work around https://github.com/jruby/jruby/issues/788 Written by bbrowning.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this as a listener in your web.xml file prior to loading jruby-rack. | |
// | |
// | |
// <listener> | |
// <listener-class>lib.JnrConstantHackListener</listener-class> | |
// </listener> | |
// <listener> | |
// <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class> | |
// </listener> | |
package lib; | |
import javax.servlet.ServletContextEvent; | |
import javax.servlet.ServletContextListener; | |
import jnr.constants.ConstantSet; | |
public class JnrConstantHackListener implements ServletContextListener { | |
public void contextInitialized(final ServletContextEvent event) { | |
ConstantSet.getConstantSet( "AddressFamily" ); | |
ConstantSet.getConstantSet( "Errno" ); | |
ConstantSet.getConstantSet( "Fcntl" ); | |
ConstantSet.getConstantSet( "INAddr" ); | |
ConstantSet.getConstantSet( "IPProto" ); | |
ConstantSet.getConstantSet( "NameInfo" ); | |
ConstantSet.getConstantSet( "OpenFlags" ); | |
ConstantSet.getConstantSet( "PRIO" ); | |
ConstantSet.getConstantSet( "ProtocolFamily" ); | |
ConstantSet.getConstantSet( "RLIM" ); | |
ConstantSet.getConstantSet( "RLIMIT" ); | |
ConstantSet.getConstantSet( "Shutdown" ); | |
ConstantSet.getConstantSet( "Signal" ); | |
ConstantSet.getConstantSet( "Sock" ); | |
ConstantSet.getConstantSet( "SocketLevel" ); | |
ConstantSet.getConstantSet( "SocketOption" ); | |
ConstantSet.getConstantSet( "Sysconf" ); | |
ConstantSet.getConstantSet( "TCP" ); | |
ConstantSet.getConstantSet( "WaitFlags" ); | |
} | |
public void contextDestroyed(final ServletContextEvent event) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment