You can use Ardulink. It's a java open source project of mine. It can control an Arduino boad. So you have just to write a servlet that call my library. That's it.
See this post to understand how install ardulink in a PI: http://www.ardulink.org/how-to-install-arduino-pc-link-on-raspberry-pi/
You can read a sample code that sends some messages to Arduino you can read this post: http://www.ardulink.org/how-to-blink-a-led/
The most important statement is Link link = Link.getDefaultInstance();
Link is the Ardulink class you need to send (and receive) messages.