java - What is the difference between getDefaultInstance() and getInstance() in Session class? -
what difference between session.getdefaultinstance(props, authenticator)
, getinstance(props, authenticator)
? in general, when choose 1 on other?
i read java doc on getdefaultinstance(props, authenticator), still couldn't able make out difference distinctly/clearly.
hope experts can me in understanding better.
update: actual reason triggered ask question is: we've used session.getdefaultinstance()
method in places within our web-based application. sometimes, throws java.lang.securityexception: access default session denied
, on quick googling, suggested use session.getinstance()
method instead. hence, when 1 choose 1 on other?
if read documentation, see that
getdefaultinstance default session object. if default has not yet been setup, new session object created , installed default.
therefore, if 1 not exist, call getinstance()
getinstance new session object.
so, new session object created, regardless of whether 1 exists.
Comments
Post a Comment