[Starter] EJB Session Bean based Web Server and Servlet client

EJB Session Bean based Web Server and Servlet client in Netbeans 1. Create a Class Library project which will hold your Remote EJB interfaces 2. Create new interface called WsHello

3. Create a new Project of type EJB Module 4. Create a new class in the EJB Module this class will implement your interface…

[JAX-RS] 2 ways to get the Basic auth username and password

There are 2 ways at least to get the Basic auth username and password in a JAX-RS web method 1. Using the @HeaderParam(“Authorization”) annotation [code language=”java”] @GET @Path("/usernamepwd") public String getUsernamePassword(@HeaderParam("Authorization") String header) { if (header==null) { return "header is null"; } String authorization = header.substring("Basic ".length()); byte[] decodedPass = Base64.getDecoder().decode(authorization); System.out.println("Decoded pass: " +…