Java Reference
In-Depth Information
public
public ShoppingApplication () {}
public
public Set < Class <?>> getClasses () {
return
return Collections . emptySet ();
}
@Context
ServletContext servletContext
public
public Set < Object > getSingletons () {
int
int pageSize = 0 ;
try
try {
InitialContext ctx = new
new InitialContext ();
Integer size =
( Integer ) ctx . getInitParameter ( "max-customers-size" );
pageSize = size . getValue ();
} catch
catch ( Exception ex ) {
... handle example ...
}
CustomerResource custService = new
new CustomerResource ();
custService . setDefaultPageSize ( pageSize );
HashSet < Object > set = new
new HashSet ();
set . add ( custService );
return
return set ;
}
}
EJB Integration
EJBs are Java EE components that help you write business logic more easily. They support
integration with security, transactions, and persistence. Further explanation of EJB is beyond
the scope of this topic. I suggest reading the topic that I co-wrote with Andrew Rubinger, En-
terprise JavaBeans 3.1 (O'Reilly), if you want more information. Java EE requires that EJB
containers support integration with JAX-RS. You are allowed to use JAX-RS annotations on
local interfaces or no-interface beans of stateless session or singleton beans. No other integ-
ration with other bean types is supported.
If you are using the full-scanning deployment mechanism I mentioned before, you can just
implement your services and put the classes of your EJBs directly within the WAR, and
JAX-RS will find them automatically. Otherwise, you have to return the bean class of each
Search WWH ::




Custom Search