Tag: server

在头文件中发送params并在服务器端获取它们 – java

我正在使用泽西岛,我希望从请求标题中获取参数; 这是我的java服务器端代码: @GET @Path(“/usersForMobile”) @Produces({ MediaType.APPLICATION_JSON + “;charset=utf-8” }) public Response getUsersForMobile(@Context UriInfo info) { String rashutId ; String userName ; String password; List inspectorList= new ArrayList(); try { rashutId = info.getQueryParameters().getFirst(“rashutId”); userName = info.getQueryParameters().getFirst(“userName”); password = info.getQueryParameters().getFirst(“password”); inspectorList = LoginService.getInspectorsList(userName,password,rashutId); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if(!inspectorList.isEmpty()) return […]

以编程方式关闭netty

我正在使用netty 4.0.24.Final。 我需要以编程方式启动/停止netty服务器。 启动服务器时,线程被阻止 f.channel().closeFuture().sync() 请帮助提供一些提示如何正确执行此操作。 下面是Main类调用的EchoServer。 谢谢。 package nettytests; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; public class EchoServer { private final int PORT = 8007; private EventLoopGroup bossGroup; private EventLoopGroup workerGroup; public void start() throws Exception { // Configure the […]