【发布时间】:2015-02-12 10:15:12
【问题描述】:
当我尝试在 http 响应中编码对象时遇到问题。我不知道怎么做。我将使用标题?
public class Download extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException{
PersistenceManager pm = PMF.get().getPersistenceManager();
String method = req.getParameter("method");
if(method.equals("view")){
Query query = pm.newQuery(Article.class);
List<Article> articles=null;
try {
articles=(List<Article>) query.execute();
}
finally {
query.closeAll();
}
Article article= art.get(0);
res.setContentType("application/octet-stream");//??
//problem here
}
}
}
【问题讨论】:
标签: java google-app-engine servlets jdo