5월, 2018의 게시물 표시

Lombok

Lombok is a project annotation. Lombok increase speed of developing. Don't need to create getter and setter even contractor. When create date model, Lombok will add method such as getter and setter. https://projectlombok.org/ http://jnb.ociweb.com/jnb/jnbJan2010.html

File path

File path = new File(".");     System.out.println(path.getAbsolutePath());  //--> 프로젝트 폴더의 주소가 출력됨 String path =  FileTest.class.getResource("") .getPath();  // 현재 클래스의 절대 경로를 가져온다.           File fileInSamePackage = new File(path + "test.properties");  // path 폴더 내의 test.properties 를 가리킨다.

Properties

public Properties getPropValue() { Properties prop = new Properties(); try { // prop.load(new FileInputStream(new ConstantsValue().PROPERTIES_PATH)); String filename = "config.properties"; // prop.load(getClass().getClassLoader().getResourceAsStream(filename));  prop.load(getClass().getResourceAsStream(filename)); } catch (IOException ex) { ex.printStackTrace();     } return prop; } Call Method public static void main(String[] args) { // TODO Auto-generated method stub String path = new PropUtil().getPropValue().getProperty("FILE_PATH");        } config.properties FILE_PATH= download\\bill

Jersey File download

With file Stream     @GET     @Path("/download")     public Response downloadBatchFile()     {         StreamingOutput fileStream =  new StreamingOutput()         {             @Override             public void write(java.io.OutputStream output) throws IOException, WebApplicationException             {                 try                 {                     java.nio.file.Path path = Paths.get("filepath"); //absolute path                     byte[] data = Files.readAllBytes(path);                     output.write(data);               ...

Jersey Framework

https://jersey.github.io/ Jersey Restful Web Services framework is an open source framework for developing RESTful Web Services in Java. It provides support for JAX-RS APIs and serves as a JAX-RS Reference implementation Components: 1. Core Server 2. Core Client 3. JAXB support 4. JSON support 5. Integration module for Spring