일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- phonegap
- oracle
- 선택적조인
- jsr 296
- Android
- iBATIS
- GPS
- Ajax
- PHP
- node.js
- JSON
- swingx
- rowspan
- appspresso
- Spring
- MFC
- jQuery
- Eclipse
- MySQL
- sencha touch
- 가우스
- JDOM
- ibsheet
- dock
- tomcat
- PLSQL
- WebLogic
- Struts
- 전자정부프레임워크
- Google Map
Archives
- Today
- Total
Where The Streets Have No Name
spring mvc에서 interceptor적용 본문
@RequestMapping(value = "/test/Test3Json.do")
public ModelAndView test3json(@RequestParam(value="name", required=false) String name) {
JSONObject obj=new JSONObject();
obj.put("name","홍길동");
obj.put("num",new Integer(100));
obj.put("balance",new Double(1000.21));
obj.put("is_vip",new Boolean(true));
obj.put("nickname",null);
ModelAndView model = new ModelAndView(new JsonView());
model.addObject(obj.toJSONString());
return model;
}
package egovframework.rte.test.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
public class AuthInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
System.out.println("@@@@@@@@@@@@@@@@@@@@@@");
return true;
}
}
dispatcher-servlet.xml
<bean id="authenticInterceptor" class="egovframework.rte.test.web.AuthInterceptor" />
<bean id="selectAnnotaionMapper"
class="egovframework.rte.ptl.mvc.handler.SimpleUrlAnnotationHandlerMapping"
p:order="1">
<property name="interceptors">
<list>
<ref local="authenticInterceptor" />
</list>
</property>
<property name="urls">
<set>
<value>/test/*.do</value>
</set>
</property>
</bean>