thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denuwanthi Hasanthika <denuwanthi.hasanth...@gmail.com>
Subject Re: Running a Thrift server inside Tomcat.
Date Mon, 15 Apr 2013 05:13:35 GMT
Thanks for the details.
I already tried using a ThriftServlet as the server side implementation.It
works fine. I am keeping it as an option too. Meanwhile I am getting
familiar with Spring framework to create a Thrift Server inside the
container (Tomcat), as you have pointed out.

Thanks,
Denuwanthi


On Thu, Apr 11, 2013 at 9:19 AM, Matthew Chambers <mchambers@wetafx.co.nz>wrote:

> Oh yeah, there is another trick you can do if you want to serve out Thrift
> JSON from Tomcat, or any other container.I expose the Binary/Framed thrift
> connection for C++ clients, but for javascript clients you can wrap your
> thrift server side implementation in a servet.
>
> https://github.com/sqlboy/**plow/blob/master/server/src/**
> main/java/com/breakersoft/**plow/thrift/ThriftServlet.java<https://github.com/sqlboy/plow/blob/master/server/src/main/java/com/breakersoft/plow/thrift/ThriftServlet.java>
>
> Then you get free Json over HTTP with about 10 lines of extra code. That
> example uses spring (sorry) but there is a wiki page with an example of
> exactly your stack here.
>
> http://wiki.apache.org/thrift/**Thrift%20%26%20Eclipse%20%26%**
> 20JUnit%20with%20TServlet<http://wiki.apache.org/thrift/Thrift%20%26%20Eclipse%20%26%20JUnit%20with%20TServlet>
>
>
>
> On 10/04/13 19:57, Denuwanthi Hasanthika wrote:
>
>> Thanks for the information.
>>
>> As I understood, your ServerConfiguration.java class is where the
>> ThriftServer gets invoked.
>> Can you please tell me how/where is the
>> https://github.com/sqlboy/**plow/blob/master/server/src/**
>> main/java/com/breakersoft/**plow/thrift/**ServerConfiguration.java<https://github.com/sqlboy/plow/blob/master/server/src/main/java/com/breakersoft/plow/thrift/ServerConfiguration.java>
>>
>> class is invoked?
>>
>> -Denuwanthi
>>
>>
>> On Wed, Apr 10, 2013 at 2:53 AM, Matthew Chambers <mchambers@wetafx.co.nz
>> >wrote:
>>
>>  Doesn't really matter what servlet container you are using, you do it
>>> pretty much the same way.  Since starting the server blocks you have to
>>> start it in a thread.
>>>
>>> Here is an example using Spring I did a long time ago, I'd probably do an
>>> anonymous runnable if I did it again.
>>> https://github.com/sqlboy/****plow/blob/master/server/src/**<https://github.com/sqlboy/**plow/blob/master/server/src/**>
>>> main/java/com/breakersoft/****plow/thrift/ThriftServer.java<**
>>> https://github.com/sqlboy/**plow/blob/master/server/src/**
>>> main/java/com/breakersoft/**plow/thrift/ThriftServer.java<https://github.com/sqlboy/plow/blob/master/server/src/main/java/com/breakersoft/plow/thrift/ThriftServer.java>
>>> >
>>> https://github.com/sqlboy/****plow/blob/master/server/src/**<https://github.com/sqlboy/**plow/blob/master/server/src/**>
>>> main/java/com/breakersoft/****plow/thrift/****ServerConfiguration.java<
>>> https**://github.com/sqlboy/plow/**blob/master/server/src/main/**
>>> java/com/breakersoft/plow/**thrift/ServerConfiguration.**java<https://github.com/sqlboy/plow/blob/master/server/src/main/java/com/breakersoft/plow/thrift/ServerConfiguration.java>
>>> >
>>>
>>>
>>> A non spring example would just initialize and wrap the serve() function
>>> in a thread.
>>>
>>> -Matt
>>>
>>>
>>>
>>> On 09/04/13 21:51, Denuwanthi Hasanthika wrote:
>>>
>>>  Hi,
>>>>
>>>> I want to run a Thrift server inside Apache Tomcat server.
>>>> As for now, I  implemented a Thrift Server and tested it with clients
>>>> .*But, I want to know wether there is a way to deploy a Thrift Server
>>>> inside
>>>> Tomcat? .*
>>>> *If not, is there a way to run a Thrift server inside a servlet deployed
>>>> in
>>>> Tomcat?.*
>>>>
>>>>    I tried doing that by calling the Thrift Server inside the init()
>>>> method
>>>> of the servlet. But, didn't work. I use Eclipse IDE in my development
>>>> work
>>>> and configured Tomcat to run from Eclipse.
>>>>
>>>>
>>>> Thanks,
>>>> Denuwanthi
>>>>
>>>>
>>>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message