View Single Post
Old 03-07-2005, 03:56 PM   #4 (permalink)
wishknew
Wisnu Widiarta
 
wishknew's Avatar
 
Join Date: Feb 2005
Location: Indonesia
Posts: 14
wishknew is on a distinguished road
Send a message via Yahoo to wishknew
Quote:
What does the output usually look like for a GET?
Actually, I just open its connection (default to index.html), get the InputStream, and read from it. I've got full HTML code from the server.

Code:
private void printResponseContent(HttpsURLConnection connection) {
        StringBuffer buffer;
        InputStream input;
        BufferedReader dataInput;
        String line;
        String responseContent = "";
        try {
            buffer = new StringBuffer();
            input = connection.getInputStream();
            dataInput = new BufferedReader(new InputStreamReader(input));
            while ((line = dataInput.readLine()) != null) {
                buffer.append(line);
                buffer.append('\n');
            }
            input.close();
            responseContent = (String) buffer.toString().trim();
        } catch (Exception e) {
            System.err.println(e);
        }
        System.out.println(responseContent);
    }
I have copy the information from http://www.dcs.shef.ac.uk/~fabio/COM...web%20MINI.pdf
and http://www.javaworld.com/javaworld/j...323-traps.html as basic of my code.

I will be glad if one of you can give me a simple httpSServer class which print any request and a httpClient (which connect to httpsUrlConnection) and doing a simple POST.

Thank you,


WishKnew
wishknew is offline   Reply With Quote