使用Apache的httpmime包并使用Multipart的格式从Android程序
向服务器端程序传递Multipart数据体格式的请求数据,(传递的是图片信息)
建立一个服务器的Servlet,方法代码如下:
<span style="font-size:18px;">@WebServlet("/ImageShowerMultipart")
public class ImageShowerMultipart extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("utf-8");
String type = request.getParameter("type");
if ((type == null) || (type.equalsIgnoreCase(""))) {
type = "1";
}
String id = request.getParameter("id");
if ((id == null) || (id.equalsIgnoreCase(&#