Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created March 8, 2013 20:06
Show Gist options
  • Save kwhinnery/5119456 to your computer and use it in GitHub Desktop.
Save kwhinnery/5119456 to your computer and use it in GitHub Desktop.
package com.twilio;
import java.io.IOException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.twilio.sdk.verbs.Say;
import com.twilio.sdk.verbs.TwiMLResponse;
@SuppressWarnings("serial")
public class TwilioSandboxServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
try {
// Create a TwiML response and add our friendly message.
TwiMLResponse twiml = new TwiMLResponse();
Say say = new Say("Hello Monkey!");
twiml.append(say);
response.setContentType("application/xml");
response.getWriter().print(twiml.toXML());
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment