Setting Access-Control-Allow-Origin Header

Setting the Access-Control-Allow-Origin header value allows browsers to get responses from the origin and access it for the request codes sent.
The following is the procedure to set Access-Control-Allow-Origin header:
  1. Open the web.xml file in an editor.
  2. Search for the following tag:
    <filter>
    <filter-name>FilterServlet</filter-name>
    <filter-class>com.iflex.fic.filters.FilterServlet</filter-class>
    </filter>
  3. Add the <init-param> tag values within the filterservlet tag as shown in the following:
    <filter>
    <filter-name>FilterServletAllowFrom</filter-name>
    <filter-class>com.iflex.fic.filters.FilterServlet</filter-class>
    <init-param>
    <param-name>AllowOrigin</param-name>
    <param-value><origin></param-value>
    </init-param>
    </filter>
  4. Replace <origin> in the preceding tag with the URL of your website. This allows the request of code from the origin.