달력

3

« 2024/3 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

'개발자료'에 해당되는 글 38

  1. 2012.04.29 Spring Framework 3.0 MVC(1)
  2. 2011.11.12 Eclipse에 Vim Plugin 설치하기 1
  3. 2011.09.14 Twitter REST API (1)
  4. 2010.12.25 Virtual Box 4.0 Released 1
2012. 4. 29. 15:12

Spring Framework 3.0 MVC(1) 공부하는 것/Spring Framework2012. 4. 29. 15:12

스프링 프레임크를 사용하기 시작한지는, 만 5년 정도 된것 같다. 아니 정확하게 이야기하면 알기 시작한지 5년이다. 그 동안 몇개의 프로젝트에는 적극적으로 사용해왔고, 사용하려고 했었다.

솔루션을 위한 내부의 기반 프레임워크를 개발하기에도, 그 자체만으로도 스프링은 너무 훌륭하기 때문에, Application의 공통 부분을 위한 기능들만을 최적화하고, 정의하는 것 만으로도 노력대비 좋은 결과들을 낼수 있었다. 다 로드존슨 아저씨가 많은 시간을 들여서 갈고 닦고, 발전시킨 노력의 결과들이다.

시간이 흐를수록 큰 조직에서는 코드와 PC와 씨름하기 보다는 수 많은 회의와 씨름을 하는 일이 많아진다. 더군다나 같이 협업하는 사람들이 많아지면, 본인이 원치 않아도 관리자의 길에서 뛰고 있는 모습을 보게된다. 딱 지금의 나의 모습니다.

공부하지 않고, 적절하게 판단하고 선택하고 방향에 대해서 이야기 할 수 있을까?
많은 고민을 하지만, 역시 시간이 절대적으로 부족하다.

요즘은 코드를 보기가 힘들정도로, 공부할 여유가 별로없다.
하지만, 사둔 책이 아깝다는 이유이든, 공부의 재미를 알았다는 이유이든 개발자로 살아가는 한은
꾸준히 배워야한다.

스프링 3.1은 또 다른 변호들을 이야기 할지는 모르겠다. 이전에 책을 보면서 정리한 내용인데 일단 올려놓는다.

[Spring Framework 3.0 - MVC]

·         스프링은 DespatcherServlet 7개의 Strategy를 기반한 MVC 프레임워크를 제공한다.

·         이중 DespatcherServlet는 가장 기본적이면서도 SpringMVC의 필수적인 기본 Servlet 역할과 스프링의 특징중의 하나인 Light-weight 컨테이너의 역할을 수행한다.

 

1.     @RequestMapping 핸들러 매핑

o    @MVC는 메소드 레벨에서 컨트롤러를 작성할 수 있다.

o    Annotation은 타입(클래스, 인터페이스)레벨뿐 아니라 메소드 레벨에도 적용 가능함.

o    @MVC 핸들러 매핑을 위해서는 DefaultAnnotationHandlerMapping이 필요하다.

o    DefaultAnnotationHandlerMapping은 기본 핸들러 이므로 다른 Handler Mapping bean이 명시적으로 등록이 되지 않았다면, 기본으로 사용이 가능하다.

o    만약, 다른 핸들러 매핑 빈이 등록이 되었다면, DefaultAnnotationHandlerMapping
명시적으로 등록을 해주어야 사용이 가능하다.

2.     Class/Method 결합 Mapping 정보

o    DefaultAnnotationHandlerMapping

·         @RequestMapping 애노테이션을 활용해서 타입레벨과 메소드 레벨 지원하며
타입레벨을 기본으로 삼고, 메소드 레벨의 어노테이션 정보는 타입레벨의 매핑을 세분화 하는데 사용한다.

o    @RequestMapping Annotation

·         Spring[] value(): URL 패턴

1.     String 배열 타입으로 URL 패턴을 지정해서 사용

2.     URL 패턴은 ANT 스타일과 와일드카드를 사용이 가능하다.

·         @RequestMapping("/hellow")

·         @RequestMapping("/admin/**/user")

·         @RequestMapping("/hellow", "/hi")

3.     "{ }"를 사용할때는, "{ }"의 위치에 해당하는 내용을 컨트롤러 Method에서 파라메터로 전달받을 수 있다. "{ }"에 들어가는 변수를 "path variable"이라고 부른다.

·         @RequestMapping("/user/{userid}")

·         RequestMethoe{} method(): HTTP Request Method

1.     Request Method GET, HEAD, POST, PUT, DELET, OPTIONS, TRACE 7개의 HTTP 메소드가 정의되어 있다

2.     HTTP 메소드를 추가하면 요청 메소드에 따라 다른 메소드를 매핑해 줄 수 있다.

·         @RequestMapping(value="/user/add", method=RequestMethod.GET)

3.     정의된 메소드 이외의 사용시 "HTTP 405 - Method Not Allowed"를 받음.

4.     타입레벨에서 URL을 주고 HTTP 요청 메소드를 지정할 경우 URL 생략가능.

·         @RequestMapping(method=RequestMethod.GET)

·         String[] params(): Request Parameter

1.     이것은 요청 Parameter와 그 값을 비교해서 매핑해 주는 것이다.

2.     같은 URL을 사용하지만, Parameter값에 따라 다른 작업을 할 때 사용한다.

·         @RequestMapping(value="/user/edit", params="type=admin")

3.     특정 Parameter 값이 존재하지 않아야 한다는 조건을 둘 경우 사용

·         @RequestMapping(value="/user/edit", params="!type")

·         String[] header(): HTTP 헤더

1.     Header 정보에 따라 매핑이 가능하다.

·         @RequestMapping(value="/view", headers = "content-type="text/*")

 

o    Type level 매핑과 Method level 매핑의 결합

·   타입(클래스오 인터페이스)레벨에 붙는 @RequestMapping은 타입내의 모든 매핑용 메소드의 공통 조건을 지정할대 사용한다.

·   메소드 레벨의 매핑은 클래스 레벨의 매핑을 상속한다.

      1. 컨트롤러가 각각 /user/add, /user/edit, /user/delete URL에 매핑

@RequestMapping("/user")

public class UserController{

@RequestMapping("/add") public String add(){ }

@RequestMapping("/edit") public String edit(){ }

@RequestMapping("/delete") public String delete(){ }

}

2.     타입 레벨의 URL패턴에 * **를 사용하여 매핑 가능

·         /user/*

·         /user/**  

·         타입레벨에서 공통의 매핑을 정의하고, 메소드 별로 세분화 해서 사용

 

o    Method 레벨 단독 매핑

·   공통 매핑 조건이 없을 경우, 조건을 주지 않고 메소드 레벨에 정의해서 사용.

·   이렇게 정의하지 않는다면, 클래스 자체가 매핑이 되지 않는다.

·   만약, @Controller 애노테이션을 붙여서 자동 빈 스캔을 사용할 경우는, 클래스 레벨의 @RequestMapping을 생략할 수 있다.

o    Type 레밸 단독 매핑

·   클래스 레벨의 URL 패턴이 /*로 끝나는 경우, apthem 레벨의 URL 패턴으로 메소드 이름을 사용할 수 있음.

·   아래는 /user/add /user/edit 로 각각 매핑

@RequestMapping("/user/*")

Public class UserController {

@RequestMapping public String add( ) { }

@RequestMapping public String edit( ) { }

}

 

 

 

 

 

:
Posted by 행복상자
2011. 11. 12. 17:09

Eclipse에 Vim Plugin 설치하기 Tip & Tips/Eclipse Tip & Tips2011. 11. 12. 17:09

오늘 갑자기 10년전에 리눅스에서 개발하면서 사용했던 Vi 에디터가 생각이 나서 몇가지 자료와 웹사이트를 두루 돌아 다녔다.

Eclipse용은 특별히 강추하는 글들이 없어서, 하나씩 설치해 봐야할 것 같은데, 하필 처음 설치한 것이 유료 버전이어서, 무시 무시한 팝업창에 놀라곤 한다. 그러나 가벼우서 나쁘지는 않다는 것이 나의 첫인상이다.

아래는 오늘 다녀왔던, 그리고 설치한 vim에 대한 링크아 정보 요약이다.


1.     Vim 설치하기

·         Vim 사이트: http://www.vim.org

·         Vim 다운로드: http://www.vim.org/download.php

o    OS Version 별로 download 가능함

o    필요한 버전을 다운해서 설치 가능함

·         Vim User Manual: http://www.vim.org/docs.php

o    다양한 형태의 매뉴얼과 문서가 있음.

o    Vim 5.7을 위한 pdf 매뉴얼은 아래 링크에서 다운로드 가능하나, 추천하지 않음)

·         : ftp://ftp.vim.org/pub/vim/doc/book/vimbook-OPL.pdf

o    아래 사이트는 한번 볼만함: wiki book

·         http://www.swaroopch.com/notes/Vim_en:Table_of_Contents

o    기타 다른 문서는 시간 나는 대로 참조

·         PC버전 설치

o    Windows 버전과 Console 버전이 있음.

o    내가 설치한 것은 Console 버전과 Visual Studio로 제작된 버전

사용하는 큰 문제 없음

o    설치버전을 받지 않고, 압축파일로 묶인 버전 설치

PC에 흔적을 남기기 싫음.

2.     Eclipse Vim Plugin  설치

·         Viable 1.31.10 : http://viableplugin.com/

o    Eclipse.org에서 검색해서 찾음

·         설치 방법: Eclipse에서 아래와 같이 메뉴에서 추가한다.

o    Help > Install New Software > Add > http://viableplugin.com/update_site

·         설치를 하게 되면, 3가지 기본 모듈이 설치가 됨

o    Viable core plugin

o    Viable CDT feature

o    Viable JDT Feature

·         다큐멘트:

o     http://viableplugin.com/documentation/HomePage

·         Eclipse Vim : http://juan.boxfi.com/vim-color-schemes/#eclipse

o    다운하기: http://juan.boxfi.com/wp-content/uploads/2011/03/eclipse.vim_.gz

 

·         간단 사용

o 생각보다 가볍고 잘 동작한다. 명령이나 이에 대한 실행에 대한 분석은 시간이 필요함.

·         유의 사항

o 유료버전으로 라이선스 파일이 정상 설치하지 않으면, 당신을 죽일지도 모른다는
무시 무시한 메시지 창을 5분마다 띄우니 유의 할 것


 

:
Posted by 행복상자
2011. 9. 14. 18:32

Twitter REST API (1) 공부하는 것/Twitter API & Twitter4j2011. 9. 14. 18:32

아주 오래전, 사실은 몇 년전(3~4년전?)인것 같다. 
Twitter를 처음 사용하면서, Twitter의 Open API와 정책들을 살펴보다가, Twitter4J라는 Twitter API를 자바에서 쉽게 사용할 수 있는 라이브러리를 접했었다.
그 당시 몇개의 Library를 검토하다가, 일본인이 만들었더 Twitter4J가 여러가지로 사용하기도 쉽고 적합하다고 판단했었는데, 최근에 개인적으로 다시 살펴볼 일이 있어서, 다시 코드를 분석하게 되었는데, 내가 이전에 기억하던 코드와 전혀 다른 코드들로 구성되어 있었다.

클라스와 메스드들은 모두 Interface로 정의하고, 이를 구현하도록 Class 들이 Re-factoring 되어져 있었다.
코드들도 깔끔하게 정리되어 있고, 정비되어져 있었고, 예제들도 모두 셈플 소스코드를 포함해서 기능별로 나주어져 있었다. (지난 몇년동안 개발자가 많은 노력과 수고를 했던것을 볼수 있었다. 고맙네...) 

아마도, 추측컨데 Twitter4J가 지원하는 플랫폼들이 다양화되면서, 인터페이스와 구현 클래스로 재 구성을 한것으로 보인다. 프레임워크의 패키지 구성을 보면, Google App Engine와 Android 단말을 지원하기 위해서 자바 Package등으로 나누어져 있다.

이를 분석하기 위해서는 먼저 Twitter의 REST API 정책을 다시 한번 살펴 볼 필요가 있다. 지난 2년동안 여러가지 정책이 바뀌고 새로운 기능들이 추가 되었을 것으로 보인다.
전체를 다 살펴보기는 힘들것이고, 개발자 가이드 먼저 살펴 봐야 겠다.


 

'공부하는 것 > Twitter API & Twitter4j' 카테고리의 다른 글

Twitter REST API (2)  (0) 2011.10.24
:
Posted by 행복상자
2010. 12. 25. 17:25

Virtual Box 4.0 Released Tip & Tips/VirtualBox2010. 12. 25. 17:25

내가 Virtual Box를 블로그를 통해서 소개한지 꽤 오랜 시간이 지났다.
가상화와 관련된 제품들이 많이 나오고, 또 앞으로도 유용하게 사용될 것이라는 점에 대해서는 크게 의심하지 않는 바이다.

내가 이 제품에 대해서 관심을 갖게 된 이유로는 무료로 사용할 수 있으면서도 기능과 버전이 빠르게 올라갈 만큼 사용자가 원하는 기능들을 지속적으로 개발해 나가고 있었기 때문이다. 더군다나 메뉴와 도움말을 한글로 지원하기까지 했다.

이 제품은 원래는 Sun에서 개발하던 제품이었는데, 오라클로 합병하면서 오라클에서 제공하던 오라클 VM 서버 제품군과 중복이 되어서, 추가 개발이 이루어 지지 않을지 걱정했었다. 선과 오라클과의 합병은 개인적으로는 별로 바람직한 방향이 아니고, 단지 비즈니스적으로 주도권을 유지하는 측면으로만 진행될거라 예상했고, 실제로 이러한 우려와 예측은 틀리지 않았다.

이러한 와중에서 며칠전, 지난 12월 22일자로 Virtual Box의 새로운 버전인 4.0 버전이 Release 된것은 굉장히 놀라운 소식이었다.

4.0 버전으로 릴리스 하면서, 추가된 기능과  변경되 몇가지 주요 Feature들은 다음과 같다.

1) File Location 
   - VirtualBox의 Configuration 파일들과 disk 이미지 파일들이 다른 위치(폴더)에서
      관리되었으  나, 4.0에서는 동일한 디렉토리에 저장된다.
   - 기본 Configuration 파일의 확장자가 XML로 관리되었는데, 4.0 에서는 vbox로 변경되었다.
      그러나 내용은 이전과 동일하다.
   - 기본 저장 위치도 이전에는 .VirtualBox 였으나, VirtualBox VMs로 바뀌게 되었다.
      (윈도우즈 계열 OS의 사용자 Profile 디렉토리 아래 저장)
2) User Interface 변경
   - Virtual Machine 설정 화면이 좀더 사용성 있게 바뀌었고 실행되고 있는 또는 저장되어 있는
     이미지에 대한 Preveiw 기능이 들어갔다.
3) 아이콘을 통한 VM 이미지 실행하기
   - 실행을 하기 원하는 OS의 이미지를 바탕화면에서 실행할 수 있도록 아이콘을 생성해 준다.
4) Virtua 이미지 쉽게 삭제하기
   - 이지미 삭제시, 이와 관련된 이미자와 Confituration 파일들을 클릭 한번에 모두 삭제해 준다.
5) 네크워크 Boot와 가상 H/W 칩셋 설정하기
   - 네트워크 Booting을 지원하며, H/W에 대한 칩셋 종류에 대해서 설정 가능하다.
6) 더 많은 Host OS의 메모리의 할 당이 가능하다.
   - 초기의 VirtualBox 버전들에서는 1.5Gbyte 이상의 메모리 할당이 어려웠으나, 4.0에서는
     그 이상의 할당이 가능하다. 만약 32bit OS의 윈도우 7에서 할당한다면, 3Gbyte까지 가능.
7) Open Virtualization Format Archive (OVA) 지원
   - OVA 파일 포맷으로 Import/Export 가 가능하다. VmWare에서 생성한 파일의 사용 가능함.

그리고, 아래는 이번에 Release 된 VirualBox 4.0의 릴리즈 로그이다. 더 많은 변경 사항들은 아래 로그를
확인할 수 있다.

VirtualBox 4.0.0 (released 2010-12-22)

This version is a major update. The following major new features were added:

  • Reorganization of VirtualBox into a base package and Extension Packs; see chapter 1.5, Installing VirtualBox and extension packs, see the manual for more information
  • New settings/disk file layout for VM portability; see chapter 10.1, Where VirtualBox stores its files, see the manual for more information
  • Major rework of the GUI (now called “VirtualBox Manager”):
    • Redesigned user interface with guest window preview (also for screenshots)
    • New “scale” display mode with scaled guest display; see chapter 1.8.5, Resizing the machine’s window, see the manual for more information
    • Support for creating and starting .vbox desktop shortcuts (bug #1889)
    • The VM list is now sortable
    • Machines can now be deleted easily without a trace including snapshots and saved states, and optionally including attached disk images (bug #5511; also, VBoxManage unregistervm --delete can do the same now)
    • Built-in creation of desktop file shortcuts to start VMs on double click (bug #2322)
  • VMM: support more than 1.5/2 GB guest RAM on 32-bit hosts
  • New virtual hardware:
    • Intel ICH9 chipset with three PCI buses, PCI Express and Message Signaled Interrupts (MSI); see chapter 3.4.1, “Motherboard” tab, see the manual for more information
    • Intel HD Audio, for better support of modern guest operating systems (e.g. 64-bit Windows; bug #2785)
  • Improvements to OVF support (see chapter 1.12, Importing and exporting virtual machines, see the manual for more information):
    • Open Virtualization Format Archive (OVA) support
    • Significant performance improvements during export and import
    • Creation of the manifest file on export is optional now
    • Imported disks can have formats other than VMDK
  • Resource control: added support for limiting a VM’s CPU time and IO bandwidth; see chapter 5.8, Limiting bandwidth for disk images, see the manual for more information
  • Storage: support asynchronous I/O for iSCSI, VMDK, VHD and Parallels images
  • Storage: support for resizing VDI and VHD images; see chapter 8.21, VBoxManage modifyhd, see the manual for more information.
  • Guest Additions: support for multiple virtual screens in Linux and Solaris guests using X.Org server 1.3 and later
  • Language bindings: uniform Java bindings for both local (COM/XPCOM) and remote (SOAP) invocation APIs

In addition, the following items were fixed and/or added:

  • VMM: Enable large page support by default on 64-bit hosts (applies to nested paging only)
  • VMM: fixed guru meditation when running Minix (VT-x only; bug #6557)
  • VMM: fixed crash under certain circumstances (Linux hosts only, non VT-x/AMD-V mode only; bugs #4529 and #7819)
  • GUI: add configuration dialog for port forwarding in NAT mode (bug #1657)
  • GUI: show the guest window content on save and restore
  • GUI: certain GUI warnings don’t stop the VM output anymore
  • GUI: fixed black fullscreen minitoolbar on KDE4 hosts (Linux hosts only; bug #5449)
  • BIOS: implemented multi-sector reading to speed up booting of certain guests (e.g. Solaris)
  • Bridged networking: improved throughput by filtering out outgoing packets intended for the host before they reach the physical network (Linux hosts only; bug #7792)
  • 3D support: allow use of CR_SYSTEM_GL_PATH again (bug #6864)
  • 3D support: fixed various clipping/visibility issues (bugs #5659, #5794, #5848, #6018, #6187, #6570)
  • 3D support: guest application stack corruption when using glGetVertexAttrib[ifd]v (bug #7395)
  • 3D support: fixed OpenGL support for libMesa 7.9
  • 3D support: fixed Unity/Compiz crashes on natty
  • 2D Video acceleration: multimonitor support
  • VRDP: fixed rare crash in multimonitor configuration
  • VRDP: support for upstream audio
  • Display: fixed occasional guest resize crash
  • NAT: port forwarding rules can be applied at runtime
  • SATA: allow to attach CD/DVD-ROM drives including passthrough (bug #7058)
  • Floppy: support readonly image files, taking this as the criteria for making the medium readonly (bug #5651)
  • Audio: fixed memory corruption during playback under rare circumstances
  • Audio: the DirectSound backend now allows VMs to be audible when another DirectSound application is active, including another VM (bug #5578)
  • EFI: support for SATA disks and CDROMs
  • BIOS: reduce the stack usage of the VESA BIOS function #4F01 (Quake fix)
  • OVF/OVA: fixed export of VMs with iSCSI disks
  • Storage: Apple DMG image support for the virtual CD/DVD (bug #6760)
  • Linux host USB support: introduced a less invasive way of accessing raw USB devices (bugs #1093, #5345, #7759)
  • Linux hosts: support recent Linux kernels with CONFIG_DEBUG_SET_MODULE_RONX set
  • Guest Additions: Shared Folders now can be marked as being auto-mounted on Windows, Linux and Solaris guests
  • Linux Additions: Shared Folders now support symbolic links (bug #818)
  • Linux Additions: combined 32-bit and 64-bit additions into one file
  • Windows Additions: automatic logon on Windows Vista/Windows 7 is now able to handle renamed user accounts; added various bugfixes

:
Posted by 행복상자