我知道我做错了;我不知道如何正确地做到这一点。这是 Apache servlet 的一小段代码。
@覆盖
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/Cookie");// May be wrong
Cookie c = new Cookie("cookie", "CookieS i LOVE");
c.setMaxAge(60*60);response.addCookie(c);
      }
For Android app i have this code to get the cookie sent from the that servlet.
Now i want to store that cookie on my android device. and then retrieve it for
another activities.
{....}
    public void onClick(View v) {
    HttpClient client = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://********:8080/***/servlet");
    Cookie c = (Cookie) CookiePolicy.ACCEPT_ALL;
    try {
    HttpResponse execute = client.execute(httpget);
    } catch (ClientProtocolException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }   
    List<Cookie> cookies =  ((AbstractHttpClient)client).getCookieStore()
    .getCookies();          
    String mycookie = cookies.toString();
    Toast.makeText(Cookies.this, mycookie, Toast.LENGTH_SHORT).show();
    }
    }
    }           
    Thank You for your help.