Can you check that the httpRequest.getHeader("origin") value is correctly retrieved and is not encoded. Log the origin value to confirm its format.
System.out.println("Origin Header: " + origin); // For debugging
If it's encoded can you decode and add
final String origin = java.net.URLDecoder.decode(httpRequest.getHeader("origin"), "UTF-8");