Well, here is the code:
public class URLResourceFactory implements ObjectFactory {
/**
* @see javax.naming.spi.ObjectFactory#getObjectInstance(java.lang.Object,
* javax.naming.Name, javax.naming.Context, java.util.Hashtable)
*/
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception {
Reference ref = (Reference) obj;
RefAddr addr = ref.get("url");
if (addr == null) {
throw new NamingException("Missing parameter with key 'url'");
}
String urlName = (String) addr.getContent();
if(urlName == null)
{
throw new NamingException("Url attrbute not set.");
}
return new URL(urlName);
}
}
Jar this up and stick it into Glassfishes classpath. See the attachment on how to use configure the URLResource.
[Message sent by forum member 'athrawn17' (athrawn17)]
http://forums.java.net/jive/thread.jspa?messageID=263887