JBoss Community

Help with download

created by Juan Manuel Pereyra Echeverz in JBoss Web Development - View the full discussion

I have the following code that returns me the address of a temporary object. I need to open the browser window to select the location and name of the download.
I am working with JSF 2.0 and Rich Faces.
I have not found any component for downloads.

Any idea how to make the download code?

I thank you in advance :)

Code of UploadFileBean for file creation and return of the route:

 

---------------------------------------------------------------------------------------------------------------------

public String download() {

   

        try {

            final FacesContext facesContext = FacesContext.getCurrentInstance();

            String path = guardaBlobEnFicheroTemporal(archivo);

            HttpServletResponse response = getResponse();

            response. sendRedirect(path);

            //writeOutContent(response, file, "prueba.docx");

            //System.out.println("3******************************");

            facesContext.responseComplete();

           

           

        }

        catch (Exception e) {

            // TODO Auto-generated catch block

            e.printStackTrace();

        }

        return null;

    }

-------------------------------------------------------------------------------------------------------------------------

 

Now I need open download window from browsers.
As could do this?

 

Thanks :)

Reply to this message by going to Community

Start a new discussion in JBoss Web Development at Community