You are interpreting the WikiPedia entry incorrectly. In the servlet, you can set any response header you want. The only limitation is that clients must understand the headline. Wikipedia lists the official HTTP headers available under RFC 2616 and 4229 (see Link provided by you). Own custom headers are legal and often used.
In general, you only need to set the Access-Control-Allow-Origin header when it comes to cross-domain script requests, for example. The JSP obtained from domain1.com performs a client-side request (JavaScript, AJAX) on a servlet hosted on domain2.com. Depending on your use case, you must decide whether you need a heading or not. The official specification is available here . You must read this carefully ... believe me!
source share