×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    20

    How receive bytes (of video) with servlet?

    I am recording a video by camera of cell and convert in bytes, later sending to the servlet, with the method POST:
    Code:
        class UploadToServer extends Thread
        {
            public void run()
            {
                Upload();
            }
    
            public void Upload ()
            {
    
                HttpConnection http = null;
                OutputStream oStrm = null;
                InputStream iStrm = null;
                boolean ret = false;
    
                String url = "127.0.0.1/ServerVideo";
    
                try {
    
                    http = (HttpConnection) Connector.open(url);
                    oStrm = http.openOutputStream();
    
                    http.setRequestMethod(HttpConnection.POST);
                    http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    
                    byte data [] = output.toByteArray();
                    oStrm.write(data,0,data.length);
    
                    iStrm = http.openInputStream();
    
                    //ret = processServerResponse(http, iStrm);
    
                    if (iStrm != null)
                        iStrm.close();
    
                    if (oStrm != null)
                        oStrm.close();
    
                  iStrm = http.openInputStream();      
         
                  //ret = processServerResponse(http, iStrm);
                  if (iStrm != null)
                  iStrm.close();
    
                  if (oStrm != null)
                  oStrm.close();
    
                  
                  if (http != null)
                      http.close();
    
                }
                                catch (IOException e)
                {
                    e.printStackTrace();
                }
                 
            }
            
            
        }
    How receive this bytes in a servlet?

    Thanks for helping and sorry my english

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How receive bytes (of video) with servlet?

    Hi,

    to retrieve full POST body you should use the getInputStream() method of ServletRequest interface.

    Pit

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    20

    Re: How receive bytes (of video) with servlet?

    You can give-me a example?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×