@RequestMapping(value="/events/make", method=RequestMethod.GET)
@ResponseBody
public Object makeFile(Model model) throws Exception{
File inFile = new File("/home/www/test", "in.txt");
//==========================//
// 텍스트 파일 읽기
//==========================//
System.out.println("***************************************************************");
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(inFile));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally {
if(br != null) try {br.close(); } catch (IOException e) {}
}
System.out.println("***************************************************************");
model.addAttribute("file", inFile.getAbsoluteFile());
return model;
}
'개발 > Linux_Server' 카테고리의 다른 글
Ubuntu에 설치된 패키지를 확인하기 (0) | 2018.09.10 |
---|---|
tail로 로그 볼 때, (0) | 2018.02.18 |
ubuntu 환경변수 설정하기 (0) | 2018.02.18 |
메모리 체크 (0) | 2018.02.18 |
ubuntu + postgresql (0) | 2018.02.18 |