넥사크로 컨트롤러 구현

This commit is contained in:
hiphop5782
2020-12-04 11:39:07 +09:00
parent 8a5250c5d2
commit c6c6aad56c
4 changed files with 35 additions and 54 deletions

View File

@@ -13,4 +13,11 @@
4. [nexacro-context.xml](./src/main/webapp/WEB-INF/spring/nexacro-context.xml) 설정
- applicationContextProvider 설정
5. [nexacro-servlet-context.xml](./src/main/webapp/WEB-INF/spring/appServlet/nexacro-servlet-context.xml) 설정
-
- NexacroInterceptor : nexacro platform으로부터 데이터를 수신받아 PlatformData로 변환하는 작업을 수행
- NexacroFileView : nexacro platform으로 파일 전달 수행
- NexacroView : nexacro platform으로 데이터 전달 수행
- NexacroMethodArgumentResolver : PlatformData를 Java Bean으로 변환하는 작업을 수행
- NexacroHandlerMethodReturnValueHandler : 응답 데이터를 PlatformData로 변환하는 작업을 수행
- NexacroMappingExceptionResolver : nexacro platform 통신 규약에 맞는 오류 처리를 수행
6.

View File

@@ -1,39 +0,0 @@
package com.hacademy.nexacrospring;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* Handles requests for the application home page.
*/
@Controller
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
/**
* Simply selects the home view to render by returning its name.
*/
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate );
return "home";
}
}

View File

@@ -0,0 +1,27 @@
package com.hacademy.nexacrospring.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.nexacro.uiadapter17.spring.core.data.NexacroResult;
/**
* Nexacro Request를 처리하기 위한 컨트롤러
* - 매핑 구현 시 NexacroResult를 반환하도록 구현
*/
@Controller
@RequestMapping("/nexacro")
public class NexacroController {
/**
* 테스트 메소드
* @return NexacroResult 객체
*/
@GetMapping("/")
public NexacroResult welcome() {
NexacroResult result = new NexacroResult();
result.addVariable("message", "Welcome!");
return result;
}
}

View File

@@ -1,14 +0,0 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>
Hello world!
</h1>
<P> The time on the server is ${serverTime}. </P>
</body>
</html>