<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet><servlet-name>NettyTunnelingServlet</servlet-name><servlet-class>org.jboss.netty.channel.socket.http.HttpTunnelingServlet</servlet-class><init-param><param-name>endpoint</param-name><param-value>local:myLocalServer</param-value></init-param><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>NettyTunnelingServlet</servlet-name><url-pattern>/netty-tunnel</url-pattern></servlet-mapping></web-app>
part of client java code// Configure the client.ClientBootstrap bootstrap = new ClientBootstrap(// new HttpTunnelingClientSocketChannelFactory(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newCachedThreadPool()));// Set up the event pipeline factory.bootstrap.setPipelineFactory(new HttpClientPipelineFactory(ssl));// The host name of the HTTP serverbootstrap.setOption("serverName", host);//host="localhost"// The path to the HTTP tunneling Servlet, which was specified in in web.xmlbootstrap.setOption("serverPath", "contextPath/netty-tunnel");// Start the connection attempt.ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port));// Wait until the connection attempt succeeds or fails.Channel channel = future.awaitUninterruptibly().getChannel();if (!future.isSuccess()) {future.getCause().printStackTrace();bootstrap.releaseExternalResources();return;}
server java code:public class LocalEchoServerRegistration {private final ChannelFactory factory = new DefaultLocalServerChannelFactory();private volatile Channel serverChannel;public void start() {ServerBootstrap serverBootstrap = new ServerBootstrap(factory);serverBootstrap.getPipeline().addLast("handler", new HttpResponseHandler());// Note that "myLocalServer" is the endpoint which was specified in web.xml.serverChannel = serverBootstrap.bind(new LocalAddress("myLocalServer"));}public void stop() {serverChannel.close();}}but now can not communicate the server .I'm want to communicate to netty servlet by client or IE Browser(Firefox Browser),Can you give to the available and detailed java code, Thank you!