December 2017
Intermediate to advanced
372 pages
8h 46m
English
If the client code accessing a secured EJB is part of a web application whose user has already authenticated, then the user's credentials will be used to determine whether the user should be allowed to access the method they are trying to execute.
When using GlassFish as our application server, standalone clients must be executed through the appclient utility. The following code illustrates a typical client for the secured session bean:
package net.ensode.javaeebook;
import javax.ejb.EJB;
public class Client
{
@EJB private static CustomerDao customerDao; public static void main(String[] args) { Long newCustomerId; Customer customer = new Customer(); customer.setFirstName("Mark"); customer.setLastName("Butcher"); customer.setEmail("butcher@phony.org"); ...Read now
Unlock full access