[jcifs] basic session management question

snowch snowch at coralms.com
Fri May 22 21:46:11 GMT 2009

Hi Forum,

I have a servlet that serves a number of images from a smb server.  The
servlet authenticates with the smb server using the same logon credentials
for all requests.  Currently (code below), each request is slow because each
request is re-performing the logon.  Is it ok to perform the
SmbSession.logon in the servlet init or a static block and keep the
connection open for the life of the application?

Many thanks in advance,


doGet(...) {
UniAddress dc = UniAddress.getByName( "localhost" );
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(
"my.domain", "Administrator", "mypassword" );
SmbSession.logon( dc, auth );

SmbFile file = new SmbFile(imageurl, auth);
SmbFileInputStream in = new SmbFileInputStream(file);
bytes = IOUtils.toByteArray(in);
// return bytes

View this message in context: http://www.nabble.com/basic-session-management-question-tp23678390p23678390.html
Sent from the Samba - jcifs mailing list archive at Nabble.com.

More information about the jcifs mailing list