I needed to make a HTTP GET request with some additional header parameters from my JSP and I stumbled upon this solution JSP make http get request and get json response which solved most of my problem. I am able to make the HTTP call from inside the JSP but I am trying to add a couple of authentication fields to the request header for the URL and I am unable to figure out how to.
<%@page import="java.io.*" %>
<%@page import="java.net.*" %>
<%
String recv;
String recvbuff;
URL jsonpage = new URL("http://www.yoursite.com/jsonresponse");
URLConnection urlcon = jsonpage.openConnection();
BufferedReader buffread = new BufferedReader(new InputStreamReader(urlcon.getInputStream()));
while ((recv = buffread.readLine()) != null)
recvbuff += recv;
buffread.close();
System.out.println(recvbuff);
%>