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

list of providers servlet

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 javax.mail.*;
import javax.mail.internet.*;
public class ListProviderServlet extends GenericServlet
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
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)
I agree. Here's the link:
subject: list of providers servlet
It's not a secret anymore!