Package javax.naming

Examples of javax.naming.Context.addToEnvironment()


            PrintWriter out = resp.getWriter();

            try {
                Context ctx1 = new InitialContext();
                Context env1 = (Context) ctx1.lookup("java:comp/env");
                env1.addToEnvironment("TestName", EXPECTED);

                out.print(env1.getEnvironment().get("TestName"));

                try {
                    env1.close();
View Full Code Here


            PrintWriter out = resp.getWriter();

            try {
                Context ctx1 = new InitialContext();
                Context env1 = (Context) ctx1.lookup("java:comp/env");
                env1.addToEnvironment("TestName", EXPECTED);

                out.print(env1.getEnvironment().get("TestName"));

                try {
                    env1.close();
View Full Code Here

            PrintWriter out = resp.getWriter();

            try {
                Context ctx1 = new InitialContext();
                Context env1 = (Context) ctx1.lookup("java:comp/env");
                env1.addToEnvironment("TestName", EXPECTED);

                boolean error = false;
                try {
                    env1.close();
                } catch (NamingException ne) {
View Full Code Here

  public Object addToEnvironment(String propName, Object propVal) throws NamingException
  {
    Context ctx = getDefaultContext();
   
    if (ctx != null) ctx.addToEnvironment(propName, propVal);
   
    return env.put(propName, propVal);
  }

  public void bind(Name name, Object obj) throws NamingException
View Full Code Here

    {
      String packages = System.getProperty(Context.URL_PKG_PREFIXES, null);
     
      if (packages != null)
      {
        toReturn.addToEnvironment(Context.URL_PKG_PREFIXES, packages)
      }
    }
   
    return toReturn;
  }
View Full Code Here

        {
            Random random = new Random ();
            _key = new Integer(random.nextInt());
            Context context = new InitialContext();
            Context compCtx = (Context)context.lookup("java:comp");
            compCtx.addToEnvironment("org.eclipse.jetty.jndi.lock", _key);
        }
        finally
        {
            Thread.currentThread().setContextClassLoader(old_loader);
        }
View Full Code Here

            try
            {
                Context context = new InitialContext();
                Context compCtx = (Context)context.lookup("java:comp");
                compCtx.addToEnvironment("org.eclipse.jetty.jndi.unlock", _key);
            }
            finally
            {
                Thread.currentThread().setContextClassLoader(old_loader);
            }
View Full Code Here

            closeInit.close();

            //check locking the context
            Context ectx = (Context)initCtx.lookup("java:comp");
            ectx.bind("crud", "xxx");
            ectx.addToEnvironment("org.eclipse.jndi.immutable", "TRUE");
            assertEquals ("xxx", initCtx.lookup("java:comp/crud"));
            try
            {
                ectx.bind("crud2", "xxx2");
            }
View Full Code Here

  /**
   * Adds a new environment property to the environment of this context.
   */
   public Object addToEnvironment(String propName, Object propVal) throws NamingException {
     Context ctx = getImpl();
     return ctx.addToEnvironment(propName, propVal);
   }

  /**  
   * Binds a name to an object.       
   */
 
View Full Code Here

            PrintWriter out = resp.getWriter();

            try {
                Context ctx1 = new InitialContext();
                Context env1 = (Context) ctx1.lookup("java:comp/env");
                env1.addToEnvironment("TestName", EXPECTED);

                out.print(env1.getEnvironment().get("TestName"));

                try {
                    env1.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.