2013년 4월 26일 금요일

thrift socket 서버를 sevlet으로 올리기


protected void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        TIOStreamTransport client= new TIOStreamTransport(request.getInputStream(),response.getOutputStream());

        userItemService = new UserItemServiceImpl();
        processor = new UserItemService.Processor<UserItemServiceImpl>(userItemService);

        TTransport inputTransport = inputTransportFactory.getTransport(client);
        TTransport outputTransport = outputTransportFactory.getTransport(client);
        TProtocol inputProtocol = inputProtocolFactory.getProtocol(inputTransport);
        TProtocol outputProtocol = outputProtocolFactory.getProtocol(outputTransport);

        try {
            processor.process(inputProtocol, outputProtocol);
        } catch (TException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

    }

댓글 없음:

댓글 쓰기