【发布时间】:2017-08-04 11:41:31
【问题描述】:
当我尝试将javax.ws.rs.core.Response转换为javax.servlet.http.HttpServletResponse时,我总是以ClassCastException结尾
我的 Servlet 如下所示:
@GET
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Response myResponse = processRequest(request);
//myResponse -> response
}
servlet 托管在码头上:
context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.addServlet(new ServletHolder(servlet),"/*");
如果可能的话,我想返回 myResponse 的内容(如果重要的话,基本上是一些 json 正文)。
有人可以帮忙吗?
【问题讨论】:
标签: java servlets jetty jax-rs