Created
March 8, 2013 20:06
-
-
Save kwhinnery/5119456 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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