public class MailSessionFactory
extends java.lang.Object
implements javax.naming.spi.ObjectFactory
Factory class that creates a JNDI named JavaMail Session factory, which can be used for managing inbound and outbound electronic mail messages via JavaMail APIs. All messaging environment properties described in the JavaMail Specification may be passed to the Session factory; however the following properties are the most commonly used:
localhost
if not specified.This factory can be configured in a
<Context>
element in your conf/server.xml
configuration file. An example of factory configuration is:
<Resource name="mail/smtp" auth="CONTAINER" type="javax.mail.Session"/> <ResourceParams name="mail/smtp"> <parameter> <name>factory</name> <value>org.apache.naming.factory.MailSessionFactory</value> </parameter> <parameter> <name>mail.smtp.host</name> <value>mail.mycompany.com</value> </parameter> </ResourceParams>
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
factoryType
The Java type for which this factory knows how to create objects.
|
Constructor and Description |
---|
MailSessionFactory() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getObjectInstance(java.lang.Object refObj,
javax.naming.Name name,
javax.naming.Context context,
java.util.Hashtable<?,?> env)
Create and return an object instance based on the specified
characteristics.
|
protected static final java.lang.String factoryType
public java.lang.Object getObjectInstance(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context context, java.util.Hashtable<?,?> env) throws java.lang.Exception
getObjectInstance
in interface javax.naming.spi.ObjectFactory
refObj
- Reference information containing our parameters, or null
if there are no parametersname
- The name of this object, relative to context, or null
if there is no namecontext
- The context to which name is relative, or null if name
is relative to the default initial contextenv
- Environment variables, or null if there are nonejava.lang.Exception
- if an error occurs during object creationCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.