Note that there are some explanatory texts on larger screens.

plurals
  1. PONetty - Http , web browser ,web page didn't reveive anything
    text
    copied!<p>I have some problems during writing Netty http server that sends/receives data, And I would very appreciate anybody help or explanation.</p> <p>My client (html) code like this:</p> <p>></p> <pre><code> $.ajax({ type : "POST", url : "http://localhost:9999/MyTest/", data : {"servicename":"aptest","querymsg":{"wsid":"111" ,"telid":"1111","role":"1"}}, dataType:"json", timeout:100000, beforeSend: function(xhr) { //add header data }, success: function(rs) { alert("[success]" + rs); }, complete:function(XMLHttpRequest,textStatus){ if(XMLHttpRequest.readyState=="4"){ alert(XMLHttpRequest.responseText); } }, error: function(XMLHttpRequest,textStatus,errorThrown){ alert("error:"+textStatus); } }); </code></pre> <p>Server side code : </p> <blockquote> <p></p> </blockquote> <pre><code> ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool()) ); HttpServerPipelineFactory pipeline = new HttpServerPipelineFactory(); bootstrap.setPipelineFactory(pipeline); serverChannel = bootstrap.bind(new InetSocketAddress(Port)); </code></pre> <p>HttpRequestServerHandler:</p> <blockquote> <p>Blockquote</p> </blockquote> <pre><code> HttpResponse res = new DefaultHttpResponse(HTTP_1_1, HttpResponseStatus.OK); res.setContent( ChannelBuffers.copiedBuffer( "Test", CharsetUtil.UTF_8)); setContentLength(res, res.getContent().readableBytes()); res.setChunked(true); res.setHeader(HttpHeaders.Names.CONTENT_TYPE, "text/html; charset=UTF-8"); // Send the response and close the connection if necessary. ChannelFuture f = ctx.getChannel().write(res); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload