/**
?*
?*/
package org;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import javax.servlet.http.HttpServletResponse;
/**
?* @author myth
?*
?*/
public class Test {
?? ?/**
?? ? * @param args
?? ? */
?? ?public static void main(String[] args) {
?? ??? ?InputStream in;
?? ??? ?String s = "";
?? ??? ?String sCurrentLine = null;
?? ??? ?try {
?? ??? ??? ?//URL url = new URL("http://192.168.1.41:8080/lcws/tools/posobserver.jsp");
?? ??? ??? ?URL url = new URL("http://127.0.0.1:8080/Test/test.jsp");
?? ??? ??? ?HttpURLConnection cnn = (HttpURLConnection) url.openConnection();
?? ??? ??? ?cnn.connect();
?? ??? ??? ?in = cnn.getInputStream();
?? ??? ??? ?BufferedReader buffer = new BufferedReader(new InputStreamReader(in));
?? ??? ??? ?while ((sCurrentLine = buffer.readLine()) != null) {
?? ??? ??? ??? ?s += sCurrentLine;
?? ??? ??? ?}
?? ??? ??? ?cnn.disconnect();
?? ??? ?} catch (MalformedURLException e) {
?? ??? ??? ?// TODO Auto-generated catch block
?? ??? ??? ?e.printStackTrace();
?? ??? ?} catch (IOException e) {
?? ??? ??? ?// TODO Auto-generated catch block
?? ??? ??? ?e.printStackTrace();
?? ??? ?}
?? ?}
}
posted on 2007-11-08 08:33
無聲 閱讀(466)
評論(0) 編輯 收藏 所屬分類:
職場生活