1: public class S246 extends javax.servlet.http.HttpServlet { 2: protected void doGet(HttpServletRequest request, 3: HttpServletResponse response) throws ServletException { 4: ObjectOutputStream oos = null; 5: ObjectInputStream ois = null; 6: try { 7: // 타겟이 WAS로 작성이 되면 URL Connection을 이용하거나, EJB를 통해서 호출한다. 8: URL url = new URL("http://127.0.0.1:8080/DataServlet"); 9: URLConnection urlConn = url.openConnection(); 10: urlConn.setDoOutput(true); 11: oos = new ObjectOutputStream(urlConn.getOutputStream()); 12: oos.writeObject("data"); 13: ois = new ObjectInputStream(urlConn.getInputStream()); 14: Object obj = ois.readObject(); 15: } catch (ClassNotFoundException e) { 16: System.err.println("Class Not Found"); 17: } catch (IOException e) { 18: System.err.println("URL Connection Error occured"); 19: } finally { 20: …… 21: } 22: } 23: }