자바 웹페이지 로그인 질문점 드려요....
새론
URL url = new URL(http://infra.yuhan.ac.kr:7777/yhclogin/login.jsp?site2pstoretoken=v1.4~6749A7B9~FB6F0B18A763BEA1CE57174120DC7CBE399D617D2F11BAF6EB2A37548F3F2742A6159F5BD45CB8CEE90DDCBBCFAB58B7FD93761368B15E8C9EEB40849507BF760C0FA3FB00D4A27846235971BFC98BD76A576474E67E9E2BB0DB7FE9FC4EC264616BBEE57280D2CB4441C66DC752774446C33F81D4CC85D963722E295F171DE07C0A7897F1A43DD495C1779BE94D045A9A6ED1BF92D674AE6B72623C5460F68426862F746B64F731C0F3C6761B8865495122977069B1B832&p_submit_url=/pls/orasso/orasso.wwsso_app_admin.ls_login&p_error_msg=&ssousername=);
URLConnection conn = url.openConnection();
HttpURLConnection hurlc = (HttpURLConnection) conn;
hurlc.setRequestProperty(Content-Type, text/plain;charset=UTF-8);
hurlc.setRequestMethod(POST);
hurlc.setDoOutput(true);
hurlc.setDoInput(true);
hurlc.setUseCaches(false);
hurlc.setDefaultUseCaches(false);
encoded = site2pstoretoken =+URLEncoder.encode(v1.4~6749A7B9~B45E77E3F53066F6E325A68B45557ADF03AA115E0B341F50F8ADD8115D74A3E9E7F6168378BAB9DCE7073C2856667C49D088E92DB577CD0726A66C16E89987BE125B1C06873B4F4E8D99BBEDBD740F6FC2DAEF7C975EE0D3C4E1D0FF43EF213C72F269302DE0BE8331B1F844E4857777C1B0F1A1C854ED717478FE70F2A568EDDC2F5B71282D92728A686F22B419E2BAB26A211D434080D1113BC534133E5E5CCE60BE81D9213EC2D9E633F87DA2C1B634A7F184A548AF85E1EE626A30335893)+&;
encoded = loginID =+URLEncoder.encode(아이디)+&;
encoded = loginPassword =+URLEncoder.encode(비밀번호)+\n;
out = new DataOutputStream(conn.getOutputStream());
out.writeBytes(encoded);
out.flush();
}catch(Exception e){
e.printStackTrace();
}finally{
try{
out.close();
}catch(Exception e){}
}
URL url2 = new URL(http://infra.yuhan.ac.kr/yhcportlet/IntroPortlet.portlet);
URLConnection connection2 = url2.openConnection();
BufferedReader in;
try
{
in=new BufferedReader(new InputStreamReader(connection2.getInputStream()));
}
catch(FileNotFoundException exception)
{
InputStream err = ((HttpURLConnection)connection2).getErrorStream();
if(err==null)throw exception;
in = new BufferedReader(new InputStreamReader(err));
}
StringBuffer response = new StringBuffer();
String line;
while((line = in.readLine())!=null)
response.append(line + \n);
System.out.println(response);
in.close();
HttpURLConnection 을 이용해서 아이디와 비밀번호를 서버로 넘겨준다고 생각했는데
로그인 후 페이지를 읽어와 보면... 로그인이 안되있네요...
문제가 무엇을까요...;;
-
딥보라
로그인은 보통 세션으로 처리 하지 않나요?