Application이 아닌 Global적으로 적용하고 싶을 때 사용하면 좋다~!
사용방법은 아주 간단하다.
최상위 루트에 Global 객체를 만들고
public class Global extends GlobalSettings {
@Override
public void onStart (final Application app) {
System.out.println("onStart");
}//end onStart Method
@Override
public void onStop (final Application app) {
System.out.println("onStop");
}//end onStop Method
@Override
public Promise<SimpleResult> onError (final RequestHeader request, final Throwable t) {
return Promise.<SimpleResult>pure(internalServerError(views.html.error.render("Error", t.toString())));
}//end onError Method
@Override
public Promise<SimpleResult> onHandlerNotFound (final RequestHeader request) {
return Promise.<SimpleResult>pure(notFound(views.html.error.render("onHandlerNotFound", request.toString())));
}//end onHandlerNotFound Method
@Override
public Promise<SimpleResult> onBadRequest (final RequestHeader request, final String error) {
return Promise.<SimpleResult>pure(badRequest(views.html.error.render("onBadRequest", error)));
}//end onBadRequest Method
}//end Global Class
위와 같이 사용면 된다.~!
자세한 사항은 여기서..
'Development > Web & Server' 카테고리의 다른 글
[Play Framework] No EntityManager bound to this thread. Try wrapping this call in JPA.withTransaction, or ensure that the HTTP context is setup on this thread. (0) | 2013.12.05 |
---|---|
[Play Framework] Test 하기~! (0) | 2013.12.05 |
[Node.js] Json-RPC 라이브러리 (0) | 2013.12.03 |
[Play Framework] MongoJack 연동하기~! (0) | 2013.12.03 |
[Play Framework] JPA라이브러리가 보이지 않을때!!! (0) | 2013.12.02 |