1 23 24 package com.sun.jndi.url.corbaname; 25 26 import javax.naming.spi.ResolveResult ; 27 import javax.naming.*; 28 import java.util.Hashtable ; 29 import java.net.MalformedURLException ; 30 31 import com.sun.jndi.cosnaming.IiopUrl; 32 33 38 39 public class corbanameURLContext 40 extends com.sun.jndi.toolkit.url.GenericURLContext { 41 42 corbanameURLContext(Hashtable env) { 43 super(env); 44 } 45 46 57 protected ResolveResult getRootURLContext(String name, Hashtable env) 58 throws NamingException { 59 return corbanameURLContextFactory.getUsingURLIgnoreRest(name, env); 60 } 61 62 66 protected Name getURLSuffix(String prefix, String url) 67 throws NamingException { 68 url = corbanameURLContextFactory.rewriteUrl(url); 70 try { 71 IiopUrl parsedUrl = new IiopUrl(url); 72 return parsedUrl.getCosName(); 73 } catch (MalformedURLException e) { 74 throw new InvalidNameException(e.getMessage()); 75 } 76 } 77 78 84 protected String getURLPrefix(String url) throws NamingException { 85 int start = url.indexOf('#'); 86 87 if (start < 0) { 88 return url; } 90 91 return url.substring(0, start); 92 } 93 } 94 | Popular Tags |