Hi All,
I try to implement a module for download some reports in pdf format. I got an Internal Server Error
An error occurred while accessing the requested resource.
http://localhost:8080/web/bruno/profile?p_p_id=FileDownload_WAR_Istrac&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_cacheability=cacheLevelPage&p_p_col_id=column-1&p_p_col_count=7&_Fil
on the server , i couldn't understood this error .
Here is my code ,
View page
<div align="right">
<a href="<portlet:resourceURL>
<portlet:param name="fileDownload" value="fileDownload" />
</portlet:resourceURL>">
Download
doc
</a>
</div>
Portlet
public void serveResource(ResourceRequest req, ResourceResponse res)
throws PortletException, IOException {
System.out.println(" start processing of file downloading " );
Logger log = new Logger(EventHandler.getLogger(), FileDownload.class);
log.entry("processing file download for Istrac");
EmployeeDao objManager = new EmployeeDao("cowaa");
HashMap<Integer, EmployeeBean> list = objManager.ListEmployees();
Document document = new Document();
Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 18,
Font.BOLD);
Font redFont = new Font(Font.FontFamily.TIMES_ROMAN, 12,
Font.NORMAL, BaseColor.RED);
Font subFont = new Font(Font.FontFamily.TIMES_ROMAN, 16,
Font.BOLD);
Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12,
Font.BOLD);
try{
res.setContentType("application/pdf");
PdfWriter.getInstance(document,res.getPortletOutputStream());
document.open();
document.add(this.addParagraph(catFont,"Details of Employee"));
Paragraph temp=this.addParagraph(catFont,"");
this.addEmptyLine(temp, 5);
document.add(temp);
PdfPTable table = new PdfPTable(6);
PdfPCell c1 = new PdfPCell(new Phrase("Nmae"));
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
c1 = new PdfPCell(new Phrase("Designation"));
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
c1 = new PdfPCell(new Phrase("Location"));
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
c1 = new PdfPCell(new Phrase("Gender"));
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
c1 = new PdfPCell(new Phrase("Religion"));
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
c1 = new PdfPCell(new Phrase("State"));
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
table.setHeaderRows(1);
Iterator iterator = list.values().iterator();
while(iterator. hasNext()){
EmployeeBean employee= (EmployeeBean)iterator.next();
table.addCell(employee.getName());
table.addCell(employee.getDesignation());
table.addCell(employee.getLocation());
table.addCell(employee.getGender());
table.addCell(employee.getReligion());
table.addCell(employee.getState());
}
document.add(table);
}catch(Exception e){
e.printStackTrace();
log.errorException(e);
}
document.close();
}
I am using Liferay 6 and jsr 268
Any Help regarding that would be appreciated
Ajil