wood burning stoves 2.0*
The moose likes Servlets and the fly likes list of providers servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "list of providers servlet" Watch "list of providers servlet" New topic
Author

list of providers servlet

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
This is in reference to Javamail:
I am trying to get a list of providers using the following code.The result is length=0.Does that mean there is no provider installed and if not how to install a provider?(I have tried the 'put' method of Properties but looks like it doesnt work.)
How do I change the provider registry?
The code has been tested on weblogic 5.1.0 server.
**************************************************************
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;
import java.net.InetAddress;
import javax.mail.*;
import javax.mail.internet.*;
public class ListProviderServlet extends GenericServlet
{
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
try
{
PrintWriter out = response.getWriter();
Properties properties = System.getProperties();
Session session = Session.getInstance(properties, null);
Provider[] providers = session.getProviders();
out.println("length= " + providers.length);
}
catch (IOException e)
{
}
}
}
*****************************************************************
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: list of providers servlet
 
Similar Threads
Javamail beginners doubt.
Java Mail problem
smtp
I have a trouble to read a content of MIME message
about the exception from the mail servlet