01: /**
02: * $Id: SmbHandler.java,v 1.7 2005/11/30 11:26:35 ss150821 Exp $
03: * Copyright 2002 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.netfile.servlet.java1;
14:
15: import java.net.URL;
16: import com.sun.portal.log.common.PortalLogger;
17: import java.net.URLStreamHandler;
18: import java.net.URLConnection;
19:
20: import jcifs.smb.SmbFile;
21: import jcifs.smb.NtlmPasswordAuthentication;
22:
23: /*
24: * SmbHandler :
25: * Provided to support protocol of type "smb" that is used
26: * by jCIFS.
27: * This class is mainly used to create the SmbFile object.
28: *
29: */
30:
31: public class SmbHandler extends URLStreamHandler {
32:
33: public SmbHandler(String username, String password, String domain) {
34: this .username = username;
35: this .password = password;
36: this .domain = domain;
37: }
38:
39: protected URLConnection openConnection(URL url)
40: throws java.io.IOException {
41: return new SmbFile(url, new NtlmPasswordAuthentication(
42: this .domain, this .username, this .password));
43: }
44:
45: String username, password, domain;
46: }
|