I do not think this is a good idea, if you're really looking to write code in Java I would suggest maybe using Netty and writing a simple proxy that way as opposed to using trafficserver. Alternatively, you could take advantage of remapping to just rewrite the url to a special endpoint that will fetch the original content and return a modified response to trafficserver.


On Fri, Mar 8, 2013 at 5:08 PM, Anil J <anilj.mailing@gmail.com> wrote:
Hello Brian,

I like the idea of writing a module to do a message passing to a java application e.g. a HTTP Servlet hosted in Tomcat. I am thinking of using libcurl, which is a C HTTP client API, to interface with this servlet.

With this approach, my module would remain in the HTTP response path and would offload the processing to a HTTP Servlet for specific tasks (e.g. image processing). The processed information then can be attached back to the HTTP response that is waiting to go back to the client (user's browser). 

Do you think this approach/implementation will work given the way traffic server works?


On Tue, Mar 5, 2013 at 8:40 PM, Anil Jangam <anilj.mailing@gmail.com> wrote:
Thanks Brian for your reply. 

On Tue, Mar 5, 2013 at 8:09 PM, Brian Geffon <briang@apache.org> wrote:
It would be incredibly difficult as Traffic Server is written in C++; you could write a plugin that does message passing to a java application but that would be clunky and weird. I'm also not sure about how feasible it would be to use JNI/JNX to write the plugin as I'm not a java programmer. There is a Lua API that might be helpful...


On Tue, Mar 5, 2013 at 4:35 PM, Anil Jangam <anilj.mailing@gmail.com> wrote:
Thanks Brian for your reply. 

I guess Java perhaps isn't there on the road-map at all, but how difficult/easy it would be to write modules in Java? Or is there any other mechanism where one can write a module/application logic in Java, which gives more flexibility from a development point of view?


On Tue, Mar 5, 2013 at 7:30 PM, Brian Geffon <briang@apache.org> wrote:
You can check out the cpp11api in lib/ which is checked into master on git. But, I'm currently working on a c++ api with another person that we're hoping to get contributed back to trafficserver within a few weeks.


On Tue, Mar 5, 2013 at 4:24 PM, Anil Jangam <anilj.mailing@gmail.com> wrote:
Hi Team,

Is is possible to write the Traffic Server modules either in C++ or Java? How much do traffic server recommends this approach?

If not Java, I guess implementing in C++ should be possible.

Can anyone comment on this?