J2EE Servlet 명세에서 인코딩된(content type : application/x-www-form-urlencoded) HTTP PUT 메소드는 지원하지 않기 때문에 폼에 값을 담은 후 PUT으로 서버에 전송할 경우 Command Object 바인딩이 자동으로 되지 않는다.


해결책은 아래와 같다. 


자료 찾느라 열라 고생함 ㅠㅠ 

(아직 spring 기반의 RESTful 서비스가 많지 않아서 그런가? 아님 너무 당연해서 나만 몰랐던 건가?)


출처 : http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html

16.3.3.11 Working with "application/x-www-form-urlencoded" data

The previous sections covered use of @ModelAttribute to support form submission requests from browser clients. The same annotation is recommended for use with requests from non-browser clients as well. However there is one notable difference when it comes to working with HTTP PUT requests. Browsers can submit form data via HTTP GET or HTTP POST. Non-browser clients can also submit forms viaHTTP PUT. This presents a challenge because the Servlet specification requires the ServletRequest.getParameter*() family of methods to support form field access only for HTTP POST, not for HTTP PUT.

To support HTTP PUT requests, the spring-web module provides the filter HttpPutFormContentFilter, which can be configured in web.xml:

<filter>
  <filter-name>httpPutFormFilter</filter-name>
  <filter-class>org.springframework.web.filter.HttpPutFormContentFilter</filter-class>
</filter>

<filter-mapping>
  <filter-name>httpPutFormFilter</filter-name>
  <servlet-name>dispatcherServlet</servlet-name>
</filter-mapping>

<servlet>
  <servlet-name>dispatcherServlet</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>

The above filter intercepts HTTP PUT requests with content type application/x-www-form-urlencoded, reads the form data from the body of the request, and wraps the ServletRequest in order to make the form data available through the ServletRequest.getParameter*() family of methods.


참고 : http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/filter/HttpPutFormContentFilter.html




간단하게 서버 부하를 점검할 수 있는 무료 툴


http://openwebload.sourceforge.net


윈도용은 설치는 따로 필요없고 사용법도 간단함

node.js 설치는 http://finkle.tistory.com/91 글을 참조하세요.


$ cd

$ npm install ejs

$ npm install jade

$ npm install -g express

$ npm list installed


'자바스크립트 > node.js' 카테고리의 다른 글

cygwin에 node.js & npm 설치  (0) 2012.04.25

1. node.js 설치에 필요한 cygwin 패키지 (미설치 상태라면 설치해준다.)

Dev 패키지

  • gcc g++ C++ compiler
  • gcc mingw-g++
  • gcc4-4++ G++ subpackage
  • git
  • make
  • openssl
  • pkg-config
  • zlib-devel
  • Python – install


Web 패키지

  • wget
  • curl



2. node.js 설치

$ git clone http://github.com/ry/node.git

$ cd node

$ git fetch --all

$ git tag

$ git checkout v0.4.9 

(화면에 표시된 목록에서 최신 버전을 선택해준다. 관례상 짝수는 안정화, 홀수는 개발버전을 의미한다.)


$ cd node

$ ./configure

$ make

$ make install

$ node -v


make를 실행할 때 error가 발생할 경우에는 버전을 달리해서 체크아웃 받은 후 다시 위 절차를 수행하면 된다.


3. 추가적인 작업

node.js가 사용하는 DNS 설정파일(/etc/resolv.conf)에 구글 공용 DNS 값을 넣어준다.

nameserver 8.8.8.8

nameserver 8.8.4.4


4. npm 설치

$ cd

$ curl http://npmjs.org/install.sh | sudo sh


끝.


※ 위 과정이 불편하다면 그냥 http://nodejs.org에서 윈도우용 인스톨러를 내려받아 설치하면 된다.


'자바스크립트 > node.js' 카테고리의 다른 글

npm을 이용한 ejs, jade, express 설치  (0) 2012.04.25

IE9에서 내용이 많은 Big 테이블을 Ajax로 불러들일대 Cell이 한 칸씩 밀리는 버그가 있다.

<td> 사이에 공백이나 개행문자가 있으면 발생한다.

아래와 같이 해결한다. (jQuery를 사용할 경우의 코드임)

if ( $.browser.msie ) {
    var expr = new RegExp('>[ \t\r\n\v\f]*<', 'g');
    $('#테이블_감싼_DIV').html( ($('#테이블_감싼_DIV').html() + "").replace(expr, '><')  );
}

※ new RegExp('>[ \t\r\n\v\f]*<', 'g'); 이 정규식은 HTML 코드 >와 < 사이에 있는 공백, 탭, 개행문자 등을 모두 제거하라는 의미다.

여러모로 IE는 우리 개발자를 사랑하신다. ㅠㅠ

출처 : http://stackoverflow.com/questions/7267014/ie9-table-has-random-rows-which-are-offset-at-random-columns


+ Recent posts