title: Handling outside requests in vaadin
body: <p>I have an applet which records sound and then upload it on the server. Sound recording portion is done, but I am stuck on upload portion. My applet is integrated with vaadin application. I have successfully made request responce cycle with my applet and vaadin server side. But I am unable to send any data over its output stream. 
  My code is :</p>
  
  <pre><code>            connection = ( HttpURLConnection ) new URL( "http://localhost:8080/CheckResponse/" ).openConnection();
              connection.setRequestMethod( "POST" );  
              connection.setDoOutput( true );  
              connection.setDoInput(true);
              connection.addRequestProperty("applet", "sound recording applet");
              //CREATE A WRITER FOR OUTPUT  
              //outWriter = new PrintWriter( connection.getOutputStream() );  
              OutputStreamWriter outWriterS = new   OutputStreamWriter(connection.getOutputStream());
              buff.append( "param1=" );   
              buff.append( URLEncoder.encode( "Param 1 Value", "UTF-8" ) );  
              buff.append( "&amp;" );  
              buff.append( "param2=" );   
              buff.append( URLEncoder.encode( "Param 2 Value", "UTF-8" ) );  
  
              outWriterS.write(buff.toString());
              outWriterS.flush();
              outWriterS.close();
  
              //RESPONSE STREAM  
              serverResponse = new BufferedReader( new InputStreamReader( connection.getInputStream() ) );  
  
              //READ THE RESPOSNE  
              String line2;  
              while ( (line2 = serverResponse.readLine() ) != null )   
              {  
              System.out.println( line2 );  
              }  
  </code></pre>
  
  <p>On the server side code :</p>
  
  <pre><code>  public void onRequestStart(HttpServletRequest request,
          HttpServletResponse response) {
      // TODO Auto-generated method stub
      try {
          if(request.getHeader("applet")!=null){
              System.out.println("Request started by applet");
          if(request.getHeader("applet").equalsIgnoreCase("sound recording applet")){
              System.out.println("Reading the streams");
          InputStreamReader reader = new InputStreamReader(request.getInputStream());
  
          BufferedReader buff = new BufferedReader(reader);
          System.out.println("Buffer"+buff);
          System.out.println("Buffer has :"+buff.readLine());
          }
          }
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      //System.out.println("Request started");
  
  }
  </code></pre>
  
  <p>the bufferReader.readLine() is returning null. What could be the reason?
  Thanks</p>