Class GlueJsonController
java.lang.Object
com.poscoict.glueframework.web.control.spring.GlueAbstractController
com.poscoict.glueframework.web.control.spring.GlueJsonController
- All Implemented Interfaces:
Controller
Json Controller for SpringMVC.
Bean Property
- viewPage : (필수) default는 'jsonView'
ModelAndView 우선순위
1. GlueService 실행중 GlueContext에 "forwardname" 이름으로 담기는 값.
2. controller bean에 정의된 viewPage property 값
3. jsonView
JSON Data
1. "result-keys" : GlueResultKeyList activity
2. is_success : GlueContext의 Exception 유무
3. exception_class
4. exception_code
5. exception_message
6. exception_localized_message
예제
사용 예# 1
<bean id="controller" class="com.poscoict.glueframework.web.control.spring.GlueJsonController" />
사용 예# 1
<bean id="controller" class="com.poscoict.glueframework.web.control.spring.GlueJsonController">
<property name="viewPage" value="jsonView" />
</bean>
참고 : web.xml
<web-app . . .>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.json</url-pattern>
</servlet-mapping>
. . .
</web-app>
참고 : dispatcher-json-servlet.xml
<beans ..>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
<bean name="/json.json" class="com.poscoict.glueframework.web.control.spring.GlueJsonController" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
<bean id="jsonView" name="jsonView" class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"/>
</beans>
참고 : dispatcher-json-servlet.xml
<beans ..>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
/*.json=controller
</value>
</property>
</bean>
<bean id="controller" class="com.poscoict.glueframework.web.control.spring.GlueJsonController" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
<bean name="jsonView" class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"/>
</beans>
-
Field Summary
Fields inherited from class com.poscoict.glueframework.web.control.spring.GlueAbstractController
logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Methods inherited from class com.poscoict.glueframework.web.control.spring.GlueAbstractController
afterDoAction, getViewPage, handleRequest, preDoAction, processUploadFile, setCookie, setErrorPage, setHeader, setRequestAttr, setRequestParam, setSessionAttr, setViewPage
-
Constructor Details
-
GlueJsonController
public GlueJsonController()
-
-
Method Details
-
preDoAction
- Specified by:
preDoAction
in classGlueAbstractController
-
afterDoAction
- Specified by:
afterDoAction
in classGlueAbstractController
-
setModelAndView
- Specified by:
setModelAndView
in classGlueAbstractController
-