Link to home
Start Free TrialLog in
Avatar of aimueller
aimueller

asked on

how to write a stream to a servlet without socket!!

how to write a stream to a servlet without socket!!
And how can I get rhe response ( something like response.getWriter() ??)

Thanks

Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

This will read the output from the servlet...  But what do you mean by "write a stream to a servlet"?  servlets accept request objects and parameters, not streams...

    try
    {
        URL url = new URL("http://hostname:80/cgi");
        URLConnection conn = url.openConnection();
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line;
        while ((line = rd.readLine()) != null)
        {
            // Process line...
        }
        rd.close();
    }
    catch (Exception e)
    {
    }
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Bah...only a B grade?

Oh well...good luck with it...

Tim