[
https://issues.apache.org/jira/browse/THRIFT-123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028446#comment-13028446
]
Dragan Okiljevic edited comment on THRIFT-123 at 5/3/11 9:36 PM:
-----------------------------------------------------------------
Short usage example for the submitted TZlibTransport class:
{code:title=Server.java|borderStyle=solid}
//server main
HelloTestHandler handler = new HelloTestHandler();
HelloTest.Processor processor = new HelloTest.Processor(handler);
TServerSocket tServerSocket = new TServerSocket(9090);
TTransportFactory tTransportFactory = new TZlibTransport.Factory();
TProtocolFactory tProtocolFactory = new TBinaryProtocol.Factory();
TServer server = new TThreadPoolServer(new
TThreadPoolServer.Args(tServerSocket).transportFactory(tTransportFactory).processor(processor).protocolFactory(tProtocolFactory));
System.out.println("Starting the server...");
server.serve();
{code}
{code:title=Client.java|borderStyle=solid}
//client main
TTransport wrappedTransport = new TSocket("localhost", 9090);
TTransport transport = new TZlibTransport(wrappedTransport);
TProtocol protocol = new TBinaryProtocol(transport);
HelloTest.Client client = new HelloTest.Client(protocol);
transport.open();
System.out.println("Attempt to send hello string");
client.sendHello1Req();
System.out.println("Hello string sent successfully");
transport.close();
{code}
was (Author: dragan.okiljevic):
Short usage example for the submitted TZlibTransport class:
{code:title=Server.java|borderStyle=solid}
//server main
HelloTestHandler handler = new HelloTestHandler();
HelloTest.Processor processor = new HelloTest.Processor(handler);
TServerSocket tServerSocket = new TServerSocket(9090);
TTransportFactory tTransportFactory = new TZlibTransport.Factory();
TProtocolFactory tProtocolFactory = new TBinaryProtocol.Factory();
TServer server = new TThreadPoolServer(new
TThreadPoolServer.Args(tServerSocket).transportFactory(tTransportFactory).processor(processor).protocolFactory(tProtocolFactory));
System.out.println("Starting the server...");
server.serve();
{code}
{code:title=Client.java|borderStyle=solid}
//client main
TTransport wrappedTransport = new TSocket("localhost", 9090);
TTransport transport = new TZlibTransport(wrappedTransport);
TProtocol protocol = new TBinaryProtocol(transport);
HelloTest.Client client = new HelloTest.Client(protocol);
transport.open();
System.out.println("attemp to send hello string");
client.sendHello1Req();
System.out.println("hello string sent succesfully");
transport.close();
{code}
> implement TZlibTransport in Java
> --------------------------------
>
> Key: THRIFT-123
> URL: https://issues.apache.org/jira/browse/THRIFT-123
> Project: Thrift
> Issue Type: New Feature
> Components: Java - Library
> Reporter: Pete Wyckoff
> Priority: Minor
> Attachments: thrift_java_tzlibtransport_added.patch
>
>
> TZlibTransport compatible with C++ version of TZlibTransport
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira