Access to network folder by passing credentials in the url

0

Hi, I have a Java system, where I have a class that searches for a particular ID number in the shared folder of IDs. To avoid the work of creating a network drive, what I do is access it as file: // ur / shared folder , I do it in the following way:

String NomFichero = "file://190.0.0.100/Cedulas/" + tbDocumento.getValueAt(tbDocumento.getSelectedRow(), 1);
if(java.awt.Desktop.isDesktopSupported()) {
    try {
        Desktop dk = Desktop.getDesktop();
        dk.browse(new URI(NomFichero+".pdf"));
    }
    catch(Exception e1) {
        try {
            Desktop dk = Desktop.getDesktop();
            dk.browse(new URI(NomFichero+".jpg"));
        }
        catch(Exception e2) {    
            JOptionPane.showMessageDialog(null,"ERROR: "+ e2.getMessage());
        }            
    }                                   
} 

What he does is, he goes through the entire folder looking for one that has the same name and when he finds it he opens the image.

Well, it works without problem, so that I have access to that compratida folder, manually I must enter in each pc, accede to this folder and enter the credentials, marking that they are registered for that pc. That step I want to avoid, passing the credentials via url (just that I want to know if possible) in this line: "file: //190.0.0.100/Cedulas/" , or see another way to spend the credentials.

    
asked by Carlos 18.03.2017 в 13:44
source

0 answers