글

Exception : PreFlightHandler can not casting

Spring Interceptor에서 PreFlight Request (CORS 인식을 위한 OPTIONS 요청)에 대해서 HandlerMethod로 케스팅 한 경우 발생. 해결 방법은 instanceof로 체크 하면 됨 ---- 관련 자료) PreFlightHandler 클래스  private class PreFlightHandler implements HttpRequestHandler { private final CorsConfiguration config ; public PreFlightHandler(CorsConfiguration config ) { this . config = config ; } @Override public void handleRequest(HttpServletRequest request , HttpServletResponse response ) throws IOException { corsProcessor .processRequest( this . config , request , response ); } } PreFlightHandler를 사용하는 메소드 AbstractHandlerMapping.getCorsHandlerExecutionChain Update the HandlerExecutionChain for CORS-related handling. For pre-flight requests, the default implementation replaces the selected handler with a simple HttpRequestHandler that invokes the configured  setCorsProcessor(org.springframework.web.cors.CorsProcessor) . For actual requests, the default impleme...

puppeteer 이슈 사항

1. 긴 페이지 스크린 샷 짤리는 현상 참고 :  https://bugs.chromium.org/p/chromium/issues/detail?id=770769&desc=2 crop를 이용하여 처리  2. addScriptTag 메소드 puppeteer version 0.11.0에서 파라미터가 api 문서와 다름  문서 대로 작성하면 hang이 걸림, 파라미터로 url 값만 넘겨야 함 참고 : https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageaddscripttagoptions /node_modules/puppeteer/lib/Page.js 224   /** 225    * @param {string} url 226    */ 227   async addScriptTag(url) { 228     return this.mainFrame().addScriptTag(url); 229   } 230  3. mac에서는 screenshot 속도가 느림 (참고 :  https://bugs.chromium.org/p/chromium/issues/detail?id=741689&can=1&q=is%3Astarred%20&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified ) centos [tomcat@local-centos src]$ node fullpage-snapshoot.js { width: 860, height: 26432 } snapshot: 1914.957ms macos (os x el capita...

headless chrome with puppeteer

headless software 그래픽 유저 인터페이스 없이 동작하는 소프트웨어 참고 :  https://en.wikipedia.org/wiki/Headless_software headless chrome 그래픽 유저 인터페이스 없이 동장하는 크롬 브라우저 환경 구성 mac 페러럴즈 centos 7 minimal 버전 설치 (wget 설치)  sudo yum install wget (net-tools 설치)  sudo yum install net-tools nodejs 설치 epel(extra package for enterprise linux) 저장소 추가 (체크) yum repolist (추가) sudo yum install epel-release (체크) yum repolist nodejs (current 6.11.3-1)설치 (설치) sudo yum install nodejs node upgrade  puppeteer는 node 6.4 버전 이후 지원이며, async/await를 사용하려면 7.6 이상 버전이 설치 되어야 한다. (버전 확인) node -v (npm 캐쉬 제거) sudo npm cache clean -f (n 모듈 설치) sudo npm install -g n (node upgrade) sudo n latest n 모듈로 설치 시 /usr/bin/node 버전은 6, /usr/local/bin/node 8버전이 설치됨 (별로임) puppeteer 설치 yarn 설치  (yarn repo 추가) sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo (yarn 설치) sudo yum install yarn puppeteer 설치 mkdir ~/test cd test yarn ad...

linux에서 httpd init 제거

1. chkconfig httpd off 2. service httpd stop 3. chkconfig --list | grep "httpd" 가 모두 off 인지 확인

jenkins git local 옵션 오류

이미지
git plugin 설치 이후 ~~의 구성요소 중 GIT 설정시 아래와 같은 오류가 발생한다. Failed to connect to repository : Command "git config --local credential.username 유저명" returned status code 129: stdout:  stderr: error: unknown option `local' usage: git config [options] 위 오류를 처리 하기위해서는 git update( 1.7.12) 가 필요하다. 관련 URL :  http://stackoverflow.com/questions/23104110/unknown-option-git-config-local-reported-by-jenkins git update 방법 관련 URL :  http://tecadmin.net/how-to-upgrade-git-version-1-7-10-on-centos-6/

produces 와 consume

- 이슈 사항  : euc-kr를 사용하는 웹 페이지에서 (XP-IE7)에서 api의 응답이 깨지는 현상 - 처리 방법  : http 헤더 조사   - Accept-Charset : 응답 시 해당 charset으로 설정 요청   - Context-Type 내 charset : 요청에 대한 charset  : server 에서 처리 방법   - @RequsetMapping내에 produces는 accept요청 헤더를 봄   - @RequestMapping내에 consumes는 content-type에 대응 * jsonp인 경우 http header 수정 불가  - 이유 : jsonp인 경우 내부에서 <script ~~ >로 처리 되기 때문 =_= 결국 파라미터 방식으로 처리

Spring with Jsonp

이슈 상황 1. spring mvc를 이용하여 이미 controller는 작성된 상태이다. 2. 해당 controller는 @ResponseBody를 이용하여 작성되었다. 3. 모바일 웹(웹 서버와 다른 호스트) 을 이용하여 특정 url의 json을 가져 와야 한다. (JSONP 사용) 4. 특정 url는 확장자가 없다. (=_=;; restful도 아닌데.. 확장자 지정을 안했다.) 개선 방법 controller는 건들지 않는 방법이 좋을 듯 했다. Controller에 대한 exception 처리도 있고. 고쳐야 될 부분이 많다. 처리  1. intercepter로 response를 수정하려 하였지만.. @ResponseBody인 경우 intercepter로 처리 할 수 없다. (실패) 2.  MessageConverter 중  MappingJacksonHttpMessageConverter를 확장.  그러나 본인은  MappingJackson2HttpMessageConverter 사용하였고 이 클래스 에서는 멤버변수의 접근 제어가  MappingJacksonHttpMessageConverter와 달라서 적용이 안된다. (실패) (예제 :  http://aircook.tistory.com/106    MappingJacksonHttpMessageConverter의 확장 통한 jsonp 구현) 3. Servlet Filter를 이용한 처리(성공) (예제 :  http://patrickgrimard.com/2010/07/28/tutorial-implementing-a-servlet-filter-for-jsonp-callback-with-springs-delegatingfilterproxy/ ) 추가 이슈  1. Filter가 적용 안됨 <<문제의 filter 구문>...