2013-07-22 1 views
1

그래서 난 그냥 갈 수 파이썬의 문서에서 볼 수 있습니다Java에서 Google Cloud Endpoint를 사용하여 맞춤 예외를 발생시키는 방법은 무엇입니까?

raise endpoints.NotFoundException(message) 

(https://developers.google.com/appengine/docs/python/endpoints/exceptions를)

을 그래서 자바에서 나는 시도 :

resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Event has no attendee!"); 

내가 자바 I에서이 작업을 수행 할 때 얻으십시오 :

{ 
"error": { 
    "errors": [ 
    { 
    "domain": "global", 
    "reason": "badRequest", 
    "message": "com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not construct instance of javax.servlet.http.HttpServletResponse, problem: abstract types can only be instantiated with additional type information\n at [Source: N/A; line: -1, column: -1]" 
    } 
    ], 
    "code": 400, 
    "message": "com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not construct instance of javax.servlet.http.HttpServletResponse, problem: abstract types can only be instantiated with additional type information\n at [Source: N/A; line: -1, column: -1]" 
} 
} 

어떻게하면 제대로 할 수 있습니까? 감사!

+0

나는 그것을 시도했을 수있다 : BadRequestException new BadRequestException ("Company is null!"); 그리고이 예외에 던져 않았다 자바 스크립트에서 구문 분석 할 수있는 사용자 지정 메시지를 반환하는 것 같다. – Shaun

답변

0

위의 내 의견을 참조하십시오. 이는 내가 필요한 것에 적합했습니다.

관련 문제