Hai perfettamente ragione ecco il codice indentato (sperando che si veda cosi
) qualche idea?
codice:
@WebMethod(operationName = "download")
public FileOutputStream download(@WebParam(name = "dir") String dir,@WebParam(name = "nome") String nome)
throws IOException {
File file = new File("C:\\Log\\" + dir + "\\" + nome);
FileInputStream fileIn = new FileInputStream(file);
FileOutputStream outputStream = new FileOutputStream(file);
byte[] outputByte = new byte[4096];
//copy binary contect to output stream
while(fileIn.read(outputByte, 0, 4096) != -1)
{
outputStream.write(outputByte, 0, 4096);
}
//fileIn.close();
//outputStream.flush();
//outputStream.close();
return outputStream;
}
Errore:
codice:
type: Exception report
message:
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception:
javax.servlet.ServletException: javax.servlet.ServletException
root cause:
javax.servlet.ServletException
root cause:
javax.xml.ws.WebServiceException: Unable to create JAXBContext
root cause:
java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.io.FileOutputStream does not have a no-arg default constructor.
this problem is related to the following location:
at java.io.FileOutputStream
at public java.io.FileOutputStream exp.ws.jaxws.DownloadResponse._return
at exp.ws.jaxws.DownloadResponse
root cause:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.io.FileOutputStream does not have a no-arg default constructor.
this problem is related to the following location:
at java.io.FileOutputStream
at public java.io.FileOutputStream exp.ws.jaxws.DownloadResponse._return
at exp.ws.jaxws.DownloadResponse
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.0.1 logs.