1
私はアンドロイドのjavaサーブレットから返された単純なURL文字列を取得しようとしています。私は、URLを取得することができますが、それに先行するヌルがあります。ここでAndroid Httpサーブレットから文字列データを取得
は、私は、サーブレットを呼び出すために使用アンドロイドからのコードです:ここでは
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://localhost:8888/mcheck_gen_url_fu");
HttpResponse response = client.execute(request);
//Here i try to read the response
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
while ((line = rd.readLine()) != null) {
output += line + System.getProperty("line.separator");
}
//I am able to get the response but there is a null pre-pended
は、サーブレットのコードです:
nullhttp:ここ
public class mcheck_gen_url_fu extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
String output = blobstoreService.createUploadUrl("/mcheck_file_upload");
resp.setContentType("text/plain");
resp.getWriter().print(output);
}
}
は、URLは次のようになります://anyusers-MacBook-Air.local:8888/_ah/upload/ag5tY2hlY2stcGF5bWVudHIbCxIVX19CbG9iVXBsb2FkU2Vzc2lvbl9fGBwM
これは正しい方法ですか?私はGsonを試しましたが、それはまたnullで窒息します。
ありがとうございます。ところで
感謝です! –