Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User crashov3r's Avatar
    Join Date
    Oct 2008
    Posts
    20
    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 jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    Hi,

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

    Pit

  3. #3
    Registered User crashov3r's Avatar
    Join Date
    Oct 2008
    Posts
    20
    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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved