private static void handleService(final SockJsServiceFactory factory, final FullHttpRequest request, final ChannelHandlerContext ctx) throws Exception { if (logger.isDebugEnabled()) { logger.debug("RequestUri : [{}]", request.getUri()); } final String pathWithoutPrefix = request.getUri().replaceFirst(factory.config().prefix(), ""); final String path = new QueryStringDecoder(pathWithoutPrefix).path(); if (Greeting.matches(path)) { writeResponse(ctx.channel(), request, Greeting.response(request)); } else if (Info.matches(path)) { writeResponse(ctx.channel(), request, Info.response(factory.config(), request)); } else if (Iframe.matches(path)) { writeResponse(ctx.channel(), request, Iframe.response(factory.config(), request)); } else if (Transports.Type.WEBSOCKET.path().equals(path)) { addTransportHandler(new RawWebSocketTransport(factory.config(), factory.create()), ctx); ctx.fireChannelRead(request.retain()); } else { final PathParams sessionPath = matches(path); if (sessionPath.matches()) { handleSession(factory, request, ctx, sessionPath); } else { writeNotFoundResponse(request, ctx); } } }
private static void handleService(final SockJsServiceFactory factory, final FullHttpRequest request, final ChannelHandlerContext ctx) throws Exception { if (logger.isDebugEnabled()) { logger.debug("RequestUri : [{}]", request.getUri()); } final String pathWithoutPrefix = request.getUri().replaceFirst(factory.config().prefix(), ""); final String path = new QueryStringDecoder(pathWithoutPrefix).path(); if (Greeting.matches(path)) { writeResponse(ctx.channel(), request, Greeting.response(request)); } else if (Info.matches(path)) { writeResponse(ctx.channel(), request, Info.response(factory.config(), request)); } else if (Iframe.matches(path)) { writeResponse(ctx.channel(), request, Iframe.response(factory.config(), request)); } else if (Transports.Type.WEBSOCKET.path().equals(path)) { addTransportHandler(new RawWebSocketTransport(factory.config(), factory.create()), ctx); ctx.fireChannelRead(request.retain()); } else { final PathParams sessionPath = matches(path); if (sessionPath.matches()) { handleSession(factory, request, ctx, sessionPath); } else { writeNotFoundResponse(request, ctx); } } }