kahilw 0 Newbie Poster

The function below is sending audio that has been converted into bytes and then placed into a byte array, after which it is placed in the DataoutputStream and sent to a servlet. My question is How do I make a servlet that will receive this data and then turn it back into a format that can play audio?

Please help me!!!

void sendPostRequest(byte[] requestaudio) 
   {
        HttpConnection hc = null;
        DataInputStream dis = null;
        DataOutputStream dos = null;

//URL to servlet 
private static String defaultURL = 
"http://localhost:8080/Speech/WEB-INF/classes/Speech";


// Open up a http connection with the [URL="http://www.daniweb.com/techtalkforums/thread79223.html#"]Web server[/URL]
            // for both send and receive operations
            hc = (HttpConnection)
            Connector.open(defaultURL, Connector.READ_WRITE);

            // Set the request method to POST
            hc.setRequestMethod(HttpConnection.POST);

            // Send the string entered by user byte by byte
            dos = hc.openDataOutputStream();
            byte[] request_body = requestaudio;

            for (int i = 0; i < request_body.length; i++)
            {
                dos.writeByte(request_body[i]);
                      System.out.println("Packaging the bytes: " + request_body.length); //+ i);

                }


            dos.flush();
            dos.close();
}