Descarga pdf desde aplicacion java

Alguien sabe como en una applicacion java a traves de un link hacer la descarga de un archivo pdf, es decir en el flujo d emi aplicacion realizo busquedas que luego me dan un link que contiene la url de un documento , como hacer q al darle click descargue el archivo y q no lo abra en la web.

obrigado .

Hi,

Bom este forúm é em português, mas como eu não entendo muito espanhol, let’s try in English too. :joia:

I’m not sure, if I undestant your doubt. Do you want to show the download window before open your pdf file, and prompt to the user if he wants open or save the file?

this solution looks link:

String tempdir = "write here your directory"; String attachName = "write here the file name' File fAttachStream = new File( tempdir + attachName ); response.setContentType( "APPLICATION/OCTET-STREAM" ); response.setHeader( "Content-Disposition", "attachment;filename=" + attachName ); response.setContentLength( ( int )fAttachStream.length() );

Best regardless,

:okok:

[quote=“marcossousa”]Hi,

Bom este forúm é em português, mas como eu não entendo muito espanhol, let’s try in English too. :joia:

I’m not sure, if I undestant your doubt. Do you want to show the download window before open your pdf file, and prompt to the user if he wants open or save the file?

this solution looks link:

String tempdir = "write here your directory"; String attachName = "write here the file name' File fAttachStream = new File( tempdir + attachName ); response.setContentType( "APPLICATION/OCTET-STREAM" ); response.setHeader( "Content-Disposition", "attachment;filename=" + attachName ); response.setContentLength( ( int )fAttachStream.length() );

Best regardless,

:okok:[/quote]

do you have one example complete??,

the link in my aplicaction is the url of document in pdf, push click here and download the file and save or open .
please , i don`t know.

the url the document is different , are various document in varias pages in the web. alguem meu ajuda

hummm… the pdf file will be inside of your application?

:okok:

bom pelo que entendi tu precisa de uma aplicação java
que na verdade é um gerenciador de download
onde tu informa um Link e a sua aplicação realiza o gerenciamento
do download e validação do link informado…

você irá ter que utilizar o pacote:
java.net.* - link

exemplos de como trabalhar: link

:wink:

[]'s

no, the files to download are in various pages web, only have the lionk and push click here and download the file.

Do you want to create a download manager ?