반응형

헤더값에 대한 정보를 알 수가 없어서...

FORM액션으로 그냥 쏘고 소켓 서버로 받아보았다.


========= post.jsp ===========
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>

<form action = "http://127.0.0.1:9000" method="post">

<input type="text" name ="id" value="srzero">
<input type="submit" value="submit">

</form>
</body>
</html>
===============================




======= Server.java =============
import java.net.*;
import java.io.*;

public class Server {
   public static void main(String[] args){
      try{


         ServerSocket server = new ServerSocket(9000);
         System.out.println("Client Wait..");


         while(true){
            Socket sock = server.accept();
            EchoThread echothread = new EchoThread(sock);
            echothread.start();
         }
      }
      catch(Exception e){
         System.out.println(e);
      }
   }
}

class EchoThread extends Thread{
   // 연결된 소켓을 받을 소켓멤버변수.
   private Socket sock;

   // 생성자.
   public EchoThread(Socket sock)
   {
      this.sock = sock;
   }

   public void run()
   {
      try
      {

      byte [] data = new byte[2000];
      
         InetAddress addr = sock.getInetAddress();
        
         System.out.println(addr.getHostAddress() + "Connected..");
        
         InputStream input = sock.getInputStream();       
        
         input.read(data);
        
         System.out.println("수신데이터 : \n" + new String(data));
        
       
         OutputStream output = sock.getOutputStream();
        
         //output.write(msg.getBytes());
        
         //System.out.println("송신 데이터 : " + msg);

      }
      catch(Exception ex)
      {
         System.out.println(ex);
      }
   }
}
==================================================================



===== 결과값 -========================================
Client Wait..
127.0.0.1Connected..
수신데이터 :
POST / HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer:
http://127.0.0.1:8080/post.jsp
Accept-Language: ko
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: 127.0.0.1:9000
Content-Length: 9
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=AEA647A934D946049669DF94A7337F0B

id=srzero



해당 값에 대해 ... 조사해보자~~ ^^

반응형

'Program > JSP' 카테고리의 다른 글

2차 도메인 Cookie 공유  (0) 2014.02.03
[ JSTL 문법 정리 ]  (0) 2011.01.07
JSPF 를 이용한 INCLUDE 설명  (5) 2010.05.03
JSP에서 Servlet 이외의 URL 접급 차단법  (0) 2010.03.05
[펌] MINE TYPE 정보  (0) 2010.02.18

+ Recent posts