0

I use NanoHTTPD as web server in my Android App, it's OK when I lanuch session.parseBody() for the first time.

But it cause null error when I lanuch the session.parseBody() function for the second time,why?

Is there some bugs in the function session.parseBody()?

@Override
public Response serve(IHTTPSession session) {

    Method method = session.getMethod();
    if (Method.POST.equals(method)) { 

         Map<String, String> files = new HashMap<String, String>();

         session.parseBody(files); //It's OK
         String zipValue1=session.getParms().get("ActionZIPMultiple");
         Utility.LogError("KK1: "+zipValue1);

         session.parseBody(files); //It will cause error!
         String zipValue2=session.getParms().get("ActionZIPMultiple");
         Utility.LogError("KK2: "+zipValue2);
     }

}
HelloCW
  • 843
  • 22
  • 125
  • 310
  • 2
    something gets nulled in that `session` after you call it for 1st time. Maibe it is designed to be used only once. Show the stacktrace. – Vladyslav Matviienko Feb 20 '17 at 06:24
  • relevant https://github.com/NanoHttpd/nanohttpd/blob/e175fd08e041cd741016bb1f1a944d2caec8f3e6/core/src/main/java/org/nanohttpd/protocols/http/HTTPSession.java#L606 – vidstige Feb 20 '17 at 06:29

0 Answers0