Служите PDF в Spring Portlet MVC Architecture - Liferay 6.0.6

Я искал способ отправки файла PDF (прямого отображения) в браузер через Liferay Portal. Нашел много решений, наиболее популярным из которых является написание сервлета, который выполняет свою работу. Я читал о службе ресурсов портлетов в спецификации JSR 286. Может кто-нибудь рассказать об этом для Spring 3.0 Portlet MVC?

<servlet>
    <display-name>DownloadServlet</display-name>
    <servlet-name>DownloadServlet</servlet-name>
    <servlet-class>com.liferay.portal.pdf.DownloadServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>DownloadServlet</servlet-name>
    <url-pattern>/DownloadServlet/*</url-pattern>
</servlet-mapping>

И сервлет состоит из:

private void downloadServlet(HttpServletRequest req,
            HttpServletResponse resp) throws ServletException, IOException {

        logger.debug(" downloadServlet ::  ");
        BufferedInputStream bis = null;
        BufferedOutputStream bos = null;
        ServletOutputStream op = null;
        try {
            //Something
            pdfContentVO=//getpdf VO here

            String filename = "PDFFILE_"+pdfNumber+".pdf";

            op = resp.getOutputStream();
            resp.setContentType("application/pdf");     
            resp.setHeader("Content-Disposition", "attachment; filename="
                    + filename);
            resp.setContentLength(pdfContentVO.getPdfData().length); 
            System.out.println("pdfcontent"+pdfContentVO.getPdfData());
            op.write(pdfContentVO.getPdfData());
            op.flush();
            op.close();


         } catch(final IOException e) {
            System.out.println ( "IOException." );
            throw e;
        } finally {
            if (bis != null)
            {

                bis.close();
            }
            if (bos != null)
            {
                bos.flush();
                bos.close();
            }
        }

    }

Ответы на вопрос(1)

Ваш ответ на вопрос