• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Opening file from remote machine using authentication

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys

I have to Open a pdf file from a computer on another domain using login id, Password different from my windows authentication?

How can I do that?

Thanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you want to do this programmatically? What kind of access would your code have to the remote machine - CIFS? If so, check out the jCIFS library that's part of Samba - it can be used to connect to password-protected SMB servers.
 
James Winfrey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf. I have to do it programatically. Apart from using third party library, can i do this directly using java Api's.

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That depends on how, exactly, your code would have access that machine. Is it SMB?
 
Saloon Keeper
Posts: 28720
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To open a file from a remote machine, you need 2 things:

1. Client software. This is software that must reside on the client machine that understands how to locate the remote machine (via network or other channels), to request the file, and to access the file data.

2. Server software. This is software that must reside on the remote machine that understands how to handle requests coming in from the client to access, return, and where allowable, to update files on the remote machine.

Additionally, the server software must be configured to provide the client-accessible points by which the client may access the files in question.

Windows contains a builtin client for the Windows Networking File System, formally known as CIFS (formerly SMB). You use Windows Shares on the server to present the client-accessible parts of the server's file system. The client part is transparently built into the Windows file I/O calls and takes over when a file is opened on a drive defined as remote (via the NET USE command) or via a UNC network filename (\\hostname\sharename).

Unix/Linux machines have installable server and client software, as they have more options. For CIFS, the gold standard is Samba. For traditional Unix filesharing, it's NFS. There are many others, but these two are the most common these days. There is an NFS client for Windows, but it's a commercial third-party product.

Of course, not all files actually need to be "opened". Sometimes it's sufficient to get or put a copy of a file. For cases like this, we have web servers (using web brpwsers as the clients), FTP clients and servers, and other facilities such as rsync. The difference between "opening" a file and copying it is that an open file may be accessed internally via direct filesystem calls. So, for example, if you wanted to change line 253 of a million-line text file, it's less overhead to open the file, skip down to line 253, replace it and close the file than it is to download the file, do the same thing locally, then upload the modified file.
 
Rancher
Posts: 4804
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While @Tim is technically correct, I have to jump in and say that as the owner of the client machine, I have no interest in letting your website open files on my machine. Its terrible security. Even if you are very good and very careful, its easy for malware to get in and then your site or another site may be reading any file on my machine.

This is a much bigger problem for Windows client machine, which typically have next to no security, and where users often run with Administrator privs.

It is far safer, and IMHO better, to have the user explicitly upload the file that they want you to have. A normal multi-part HTML upload is easy to process in Java servlets or beans.
 
Tim Holloway
Saloon Keeper
Posts: 28720
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, looking back at the question, I haven't the faintest idea why I thought this was about basic remote file access, other than that the word "Open" was used. If you just want to open a PDF in a PDF viewr program, it's sufficient to transmit the PDF file to the client, such as downloading a copy from a webapp. Usually that results in a temporary copy of the file being produced and then opened locally.

However it was unclear how the PDF was supposed to be visible over the network other than apparently not via the normal Windows security authorization. That needs more explanation.

Then again, there's a lot of confusion. I'm not sure what Pat means either, since you don't open a file on a client. By definition, the minute you do, the machine holding the file is acting in the role of a server. And I didn't catch any hint in the original question that the PDF was supposed to be coming from another client machine to either a second client or to a webserver machine, so the whole discussion has my head spinning at this point.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic