set session using connection request
<p>i'm looking for way for setting session or cookie in external site using connection request.</p>

<p>I have site A which sends request to site B:</p>

<blockquote>
  <p></p>
</blockquote>

<pre><code>          url = new URL(urlSCS + "test");
          connection = (HttpURLConnection)url.openConnection();
          connection.setRequestMethod("POST");
          connection.setRequestProperty("Content-Type", 
               "application/x-www-form-urlencoded");

          connection.setRequestProperty("Content-Length", "" + 
                   Integer.toString(urlParameters.getBytes().length));
          connection.setRequestProperty("Content-Language", "en-EN");  

          connection.setUseCaches (false);
          connection.setDoInput(true);
          connection.setDoOutput(true);

          //Send request
          DataOutputStream wr = new DataOutputStream (
                      connection.getOutputStream ());
          wr.writeBytes (urlParameters);
          wr.flush ();
          wr.close ();

          //Get Response    
          InputStream is = connection.getInputStream();
          BufferedReader rd = new BufferedReader(new InputStreamReader(is));
          String line;
          StringBuffer response = new StringBuffer(); 
          while((line = rd.readLine()) != null) {
            response.append(line);
            response.append('\r');
          }
          rd.close();

          responseSCS = response.toString();
          return responseSCS;

        } catch (Exception e) {

          e.printStackTrace();
          return null;

        } finally {

          if(connection != null) {
            connection.disconnect(); 
          }
        }
</code></pre>

<p>And on site B i want to create session or Cookie. Is it possible?</p>

<p>I understand that to set cookie or session the page should be displayed, beccouse cookie and session are written in browswer. But maybe there is some way ?</p>
