Hi I am trying to implement pdf file download functionality by this way .
/* test.xhtml*/
<p:commandButton actionListener="#{backingBean.download}" update=":form"/>
/BackingBean.java/
public Class BackkingBean implements serializable{
@ManagedBean
@ViewScoped
public void download(){
String uri = "http://173.24.57.274:8080/ROOT/html/xml/Test new_02.pdf";
URL url = new URL(uri);
File destination = new File("C:/Documents and Settings/microsoft/My Documents/Downloads/sample.pdf");
FileUtils.copyURLToFile(url, destination);
}
}
But when I am clicking on download button I am getting below error.
Caused by: java.io.IOException: Server returned HTTP response code: 505 for URL:
http://173.24.57.274:8080/ROOT/html/xml/Test new_02.pdf
I have gone some stackoverflow posts regarding this error but did'nt find any solution which work for me.
What I am missing? How can overcome from this problem.