0
NanoHTTPD를 사용하여 POST 요청을 처리하기 때문에 다음과 같이 this post을 따르고 있습니다.NanoHTTPD - 응답 클래스에 액세스 할 수 없습니다.
안드로이드 스튜디오에 의해 제안 더 빠른 수정이 없습니다'Response(fi.iki.elonen.NanoHTTPD.Response.lStatus,java.lang.String,java.io.lnputStream, long)’ has protected access in 'fi.iki.elonen.NanoHTTPD.Response'
, 불행하게도, 내가이 문제를 어떻게 해결하는 것입니다 : 나는 안드로이드 스튜디오에서 내 MainActivity
클래스에 넣어 때, 그것은 나에게 오류를 제공?
내 코드 :
public Response serve(IHTTPSession session) {
Map<String, String> files = new HashMap<String, String>();
Method method = session.getMethod();
if (Method.PUT.equals(method) || Method.POST.equals(method)) {
try {
session.parseBody(files);
} catch (IOException ioe) {
return new Response(Response.Status.INTERNAL_ERROR, MIME_PLAINTEXT, "SERVER INTERNAL ERROR: IOException: " + ioe.getMessage());
} catch (ResponseException re) {
return new Response(re.getStatus(), MIME_PLAINTEXT, re.getMessage());
}
}
// get the POST body
String postBody = session.getQueryParameterString();
// or you can access the POST request's parameters
String postParameter = session.getParms().get("parameter");
return new Response(postBody); // Or postParameter.
}
문제를 나타내는 최소한의 코드를 게시하십시오. 귀하의 링크를 파헤 치지 않을 것입니다. – greenapps
@greenapps 변경됨 –
컴파일 타임 오류. 어떤 진술이 그것을 일으키는가? 왜 우리는 우리가 추측하게합니까? – greenapps