rest - Why does my code in android annotations fail without anything in the logs -


i'm new android annotations maybe i'm missing i'm trying copy rest client seen https://github.com/excilys/androidannotations/wiki/rest%20api here

where have interceptor defined follows

@ebean(scope = scope.singleton) public class restinterceptor implements clienthttprequestinterceptor{  final string tag = "rest";  @bean authstore authstore;  @override public clienthttpresponse intercept(httprequest request, byte[] data, clienthttprequestexecution execution)         throws ioexception{      //need set api key here nothing happens code quits //        log.d("rest",authstore.getsessionkey());       httpheaders headers = request.getheaders();       headers.set("api_key",authstore.getapikey());       clienthttpresponse resp = execution.execute(request, data);       httpstatus code = resp.getstatuscode();       log.d(tag,resp.getbody().tostring());       if(code.value() == 200){         log.d(tag,"success code 200");        }      else{          log.d(tag,"fail code" + code.tostring());      }      return resp; } 

}

but code quits when try add header. auth store class looks this

@ebean(scope = scope.singleton)  public class authstore {  public string apikey,sessionkey;  public string getapikey() {     return apikey; }  public void setapikey(string apikey) {     this.apikey = apikey; }  public string getsessionkey() {     return sessionkey; }  public void setsessionkey(string sessionkey) {     this.sessionkey = sessionkey; } 

}

rest interface

@rest(rooturl = "https://pathtoapi/rest/public/", converters = {     gsonhttpmessageconverter.class }, interceptors = {restinterceptor.class }) public interface apiclient {  @get("force_login") apisession forcelogin();  // if need add configuration spring resttemplate. resttemplate getresttemplate();  void setresttemplate(resttemplate resttemplate); 

}


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -