01: /**
02: * $Id: SmbHandler.java,v 1.6 2005/11/30 11:26:40 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.java2;
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: import java.io.IOException;
20:
21: import jcifs.smb.SmbFile;
22: import jcifs.smb.NtlmPasswordAuthentication;
23:
24: /*
25: * SmbHandler :
26: * Provided to support protocol of type "smb" that is used
27: * by jCIFS.
28: * This class is mainly used to create the SmbFile object.
29: *
30: */
31:
32: public class SmbHandler extends URLStreamHandler {
33:
34: public SmbHandler(String username, String password, String domain) {
35: this .username = username;
36: this .password = password;
37: this .domain = domain;
38: }
39:
40: protected URLConnection openConnection(URL url)
41: throws java.io.IOException {
42: return new SmbFile(url, new NtlmPasswordAuthentication(
43: this .domain, this .username, this .password));
44: }
45:
46: String username, password, domain;
47: }
|