2017-12-01 2 views
0

json이 serviceBean에서 GET 호출로 넘길 수없는 것 같습니다.도미노 REST 서비스 - GET 호출에서 매개 변수를 가져올 수 없습니다.

public class GetAccount extends CustomServiceBean { 

     @Override 
     public void renderService(CustomService service, RestServiceEngine engine) throws ServiceException { 

      XspOpenLogUtil.logEvent(null, "getAccount()", Level.INFO, null); 

      Map parameters = engine.getHttpRequest().getParameterMap(); 
      XspOpenLogUtil.logEvent(null, "getAccount() - getHttpRequest().getParameterMap(): " + parameters.toString(), Level.INFO, null); 

      String json_string = IOUtils.toString(engine.getHttpRequest().getInputStream(), "UTF-8"); 
      XspOpenLogUtil.logEvent(null, "getAccount() - jsonReaderString: " + json_string, Level.INFO, null); } 
: 나는의 PathInfo = "getaccount"를 해봤의 PathInfo,의 PathInfo는 = "getaccount/{ID}"의 PathInfo는 = "getaccount {ID}"

serviceBean를 들어

<xe:restService id="restService1" pathInfo="getaccount"> 
    <xe:this.service> 
    <xe:customRestService requestContentType="application/json" serviceBean="web.service.GetAccount" contentType="application/json"/> 
    </xe:this.service> 
    </xe:restService> 

내가 POST로 변경하면 나는 json_string를 얻을 수 있습니다,하지만 난 GET을 수행하고, 즉 일부 JSON을 보낼 수있을 것입니다 : API로 자원과 SoapUI를 사용

{ "ID", "1234"}. xsp/getaccount {id} 및 매개 변수 N ame = id 및 값 = 1234

고마워, Scott.

답변

0

나는 그것을 알아 냈다. engine.getHttpRequest().getRequestURI()을 사용하면 URI가 전달됩니다. 예 : api.nsf/api.xsp/getaccount/Bob.Smith%40mail.com. URLDecode를 실행하여 인코딩을 정리합니다.

다른 사람이이를 해결하는 데 도움이되기를 바랍니다.

Scott.

관련 문제