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


    Context context3 = (Context) context2.lookup("");
    context3.rename("java:comp/env/jdbc/myds", "jdbc/myds");
    context3.unbind("myobject");

    assertTrue("Correct environment", context3.getEnvironment() != context2.getEnvironment());
    context3.addToEnvironment("key2", "value2");
    assertTrue("key2 added", "value2".equals(context3.getEnvironment().get("key2")));
    context3.removeFromEnvironment("key1");
    assertTrue("key1 removed", context3.getEnvironment().get("key1") == null);

    assertTrue("Correct DataSource registered", context1.lookup("jdbc/myds") == ds);
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);

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

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

/* 79 */       Name n = ctx.getNameParser(name).parse(url.substring(url.indexOf(":") + 1));
/* 80 */       if (n.size() >= 3)
/*    */       {
/* 83 */         if ((n.get(0).toString().equals("")) && (n.get(1).toString().equals("")))
/*    */         {
/* 86 */           ctx.addToEnvironment("java.naming.provider.url", n.get(2));
/*    */         }
/*    */       }
/* 89 */       return ctx;
/*    */     }
/*    */
View Full Code Here

/* 67 */       Name n = ctx.getNameParser(name).parse(url.substring(url.indexOf(":") + 1));
/* 68 */       if (n.size() >= 3)
/*    */       {
/* 71 */         if ((n.get(0).toString().equals("")) && (n.get(1).toString().equals("")))
/*    */         {
/* 74 */           ctx.addToEnvironment("java.naming.provider.url", n.get(2));
/*    */         }
/*    */       }
/* 77 */       return ctx;
/*    */     }
/*    */
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.