java - How to programmatically configure custom host in jetty server (8.1.8.v20121106) with SslSelectChannelConnector? -
i want access servlet https connection following address "https://ip-address:port/servletpath" . using sslselectchannelconnector jetty server (version 8.1.8.v20121106).
i generated self signed certificate using keytool following information,
cn=localhost, ou=<myorg>, o=<myorg>, l=trivandrum, st=kerala, c=in
i have configured jetty server - sslselectchannelconnector follows,
sslcontextfactory sslfactory = new sslcontextfactory(); sslfactory.setkeystorepath("<path of generated key store keytool>"); sslfactory.setkeystorepassword("mypassword"); sslfactory.setkeymanagerpassword("mypassword"); sslfactory.settruststore("<path of signed trust store keytool>"); sslfactory.settruststorepassword("mypassword"); sslselectchannelconnector sslselectconnector = new sslselectchannelconnector(sslfactory); sslselectconnector.setport(5443);
registered servlet path => servletpath follows,
servletholder holder = new servletholder(httpservlet); this.servletcontexthandler.addservlet(holder, servletpath);
when start server, getting console follows,
info [main] (abstractconnector.java:338) - started sslselectchannelconnector@0.0.0.0:5443 debug [main] (abstractlifecycle.java:172) - started sslselectchannelconnector@0.0.0.0:5443
when try access following address, //localhost:5433/servletpath => servlet getting invoked - executed successfully.
in case need access => //192.168.27.29:5433/servletpath.
i tried set host "sslselectconnector.sethost("192.168.27.29"); ". when start server got console follows
info [main] (abstractconnector.java:338) - started sslselectchannelconnector@192.168.27.29:5443 debug [main] (abstractlifecycle.java:172) - started sslselectchannelconnector@192.168.27.29:5443
- but when try access following address, //192.168.27.29:5433/servletpath => exection failed exception,
so, how bind custom port jetty server, suggestions.
Comments
Post a Comment