ContextBindings.unbindClassLoader(context, context.getNamingToken(), getClass().getClassLoader());
ContextBindings.bindClassLoader(context, context.getNamingToken(), getClass().getClassLoader());
/** * Change context binding. * * @param context the context * @param bind the bind * @throws NamingException the naming exception */ private void changeContextBinding(Context context, boolean bind) throws NamingException { Object token = getNamingToken(context); ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (bind) { ContextBindings.bindClassLoader(context, token, loader); } else { ContextBindings.unbindClassLoader(context, token, loader); } }
/** * Crete a new Context's instance. */ @SuppressWarnings("unchecked") @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws NamingException { if ((ContextBindings.isThreadBound()) || (ContextBindings.isClassLoaderBound())) { return new SelectorContext((Hashtable<String,Object>)environment); } return null; }
/** * Returns the security token required to bind to a naming context. * * @param context the catalina context * * @return the security token for use with <code>ContextBindings</code> */ @Override protected Object getNamingToken(Context context) { // null token worked before 8.0.6 Object token = null; if (!ContextAccessController.checkSecurityToken(context, token)) { // namingToken added to Context and Server interfaces in 8.0.6 // Used by NamingContextListener when setting up JNDI context token = context.getNamingToken(); if (!ContextAccessController.checkSecurityToken(context, token)) { logger.error("Couldn't get a valid security token. ClassLoader binding will fail."); } } return token; }
/** * Binds an object and a naming context. * * @param obj Object to bind with naming context * @param context Associated naming context instance */ public static void bindContext(Object obj, Context context) { bindContext(obj, context, null); }
/** * Retrieves the next element in the enumeration. */ @Override public Binding next() throws NamingException { return nextElementInternal(); }
/** * Retrieves the next element in the enumeration. */ @Override public NameClassPair next() throws NamingException { return nextElement(); }
/** * @return <code>true</code> if writing is allowed on this context. */ protected boolean isWritable() { return ContextAccessController.isWritable(name); }
/** * Crete a new Context's instance. */ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws NamingException { if ((ContextBindings.isThreadBound()) || (ContextBindings.isClassLoaderBound())) { return new SelectorContext(environment); } else { return null; } }
/** * Returns the security token required to bind to a naming context. * * @param context the catalina context * * @return the security token for use with <code>ContextBindings</code> */ @Override protected Object getNamingToken(Context context) { // Used by NamingContextListener when setting up JNDI context Object token = context.getNamingToken(); if (!ContextAccessController.checkSecurityToken(context, token)) { logger.error("Couldn't get a valid security token. ClassLoader binding will fail."); } return token; }
/** * Binds a context name. * * @param name Name of the context * @param context Associated naming context instance */ public static void bindContext(Object name, Context context) { bindContext(name, context, null); }
/** * Retrieves the next element in the enumeration. */ @Override public Binding next() throws NamingException { return nextElementInternal(); }
/** * Retrieves the next element in the enumeration. */ public Object next() throws NamingException { return nextElement(); }
/** * Returns true if writing is allowed on this context. */ protected boolean isWritable() { return ContextAccessController.isWritable(name); }
/** * Crete a new Context's instance. */ @SuppressWarnings("unchecked") @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws NamingException { if ((ContextBindings.isThreadBound()) || (ContextBindings.isClassLoaderBound())) { return new SelectorContext((Hashtable<String,Object>)environment); } return null; }
/** * Returns the security token required to bind to a naming context. * * @param context the catalina context * * @return the security token for use with <code>ContextBindings</code> */ @Override protected Object getNamingToken(Context context) { // Used by NamingContextListener when setting up JNDI context Object token = context.getNamingToken(); if (!ContextAccessController.checkSecurityToken(context, token)) { logger.error("Couldn't get a valid security token. ClassLoader binding will fail."); } return token; }
/** * Crete a new Context's instance. */ @SuppressWarnings("unchecked") @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws NamingException { if ((ContextBindings.isThreadBound()) || (ContextBindings.isClassLoaderBound())) { return new SelectorContext((Hashtable<String,Object>)environment); } return null; }
/** * Crete a new Context's instance. */ @SuppressWarnings("unchecked") @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws NamingException { if ((ContextBindings.isThreadBound()) || (ContextBindings.isClassLoaderBound())) { return new SelectorContext((Hashtable<String,Object>)environment); } return null; }
/** * Crete a new Context's instance. */ @SuppressWarnings("unchecked") @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws NamingException { if ((ContextBindings.isThreadBound()) || (ContextBindings.isClassLoaderBound())) { return new SelectorContext((Hashtable<String,Object>)environment); } return null; }