http://springsource.tistory.com/

여기 정리 잘해놨네 본받자

Posted by Engineer135
,

URL url = new URL(urlStr);
     
     HttpURLConnection urlRequest = (HttpURLConnection) url.openConnection();
     urlRequest.setRequestMethod("POST");
     
     // request를 서명합니다.
     testConsumer.sign(urlRequest);  

     urlRequest.connect();
     
     BufferedReader br = new BufferedReader(new InputStreamReader(urlRequest.getInputStream()));
     String tmpStr = "";
     while( (tmpStr = br.readLine()) != null) {
      System.out.println("텍스트만 등록 후 메시지==========="+tmpStr);
     }

I don't see anywhere in the code where you specify that this is a POST request. Then again, you need a java.net.HttpURLConnection to do that.

In fact, I highly recommend using HttpURLConnection instead of URLConnection, with conn.setRequestMethod("POST"); and see if it still gives you problems.

기본은 get 인가보다..... 이거때문에 한참 삽질했네. 트위터 덕분에 많이 배운다.

Posted by Engineer135
,

<input type="text" id="title"/>

일단 내가 focus를 주고 싶은 input box는 요놈.

$('#myModal').on('shown', function () {
   setCaretAtEnd($("#title"));
  })

bootstrap의 modal은 좀 특이(?)해서 저렇게 shown 됐을때 포커스를 먹여야 먹힌다. 그냥 document.ready 상태에서 focus() 하면 소용이 없었음. 그냥 팝업에 쓰려면 바로  setCaretAtEnd($("#title")); 로 실행해도 상관 없음.

 //input text에 focus
 function setCaretAtEnd(elem) {
        var elemLen = elem.val().length;
        if(elemLen == 0){
         elem.focus();
         return;
        }
        // For IE Only
        if (document.selection) {
            // Set focus
            elem.focus();
            // Use IE Ranges
            var oSel = document.selection.createRange();
            // Reset position to 0 & then set at end
            oSel.moveStart('character', -elemLen);
            oSel.moveStart('character', elemLen);
            oSel.moveEnd('character', 0);
            oSel.select();
        }
        else if (document.selection == undefined || elem.selectionStart || elem.selectionStart == '0') {
            // Firefox/Chrome
            elem.focus().val(elem.val());
        } // if
    } // SetCaretAtEnd()

이렇게 하면 ie에서도, 크롬에서도 잘 된다. 파폭은 안 해봐서 모름. 출처는 구글링 후 약간 수정..

Posted by Engineer135
,