refactoring
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package org.example.demo.uebung1.aufgabe16;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.Context;
|
||||
import java.util.Properties;
|
||||
|
||||
public class Client {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Properties props = new Properties();
|
||||
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
|
||||
"org.wildfly.naming.client.WildFlyInitialContextFactory");
|
||||
props.setProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080");
|
||||
|
||||
InitialContext ctx = new InitialContext(props);
|
||||
String jndiName = "ejb:/ejb-uebung-1.0-SNAPSHOT/Encryptor!org.example.demo.uebung1.aufgabe16.EncryptorRemote";
|
||||
EncryptorRemote encryptor = (EncryptorRemote) ctx.lookup(jndiName);
|
||||
|
||||
String original = "Hallo Welt";
|
||||
String encrypted = encryptor.encrypt(original);
|
||||
System.out.println("Original: " + original);
|
||||
System.out.println("Verschlüsselt: " + encrypted);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.example.demo.uebung1.aufgabe17;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.Context;
|
||||
import java.util.Properties;
|
||||
|
||||
public class Client {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Properties props = new Properties();
|
||||
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
|
||||
"org.wildfly.naming.client.WildFlyInitialContextFactory");
|
||||
props.setProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080");
|
||||
|
||||
InitialContext ctx = new InitialContext(props);
|
||||
String jndiName = "ejb:/ejb-uebung-1.0-SNAPSHOT/Counter!org.example.demo.uebung1.aufgabe17.CounterRemote?stateful";
|
||||
CounterRemote counter = (CounterRemote) ctx.lookup(jndiName);
|
||||
|
||||
System.out.println(counter.getAndIncrement());
|
||||
System.out.println(counter.getAndIncrement());
|
||||
System.out.println(counter.getAndIncrement());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user