Hello,
I wish to email the contents of a page from inside of my Jetspeed
portlet. The page requires authentication, so I'm passing the current
session's JSESSIONID as a cookie so my program can be authenticated. For
some reason this is not working:
URL url = new
URL("http://localhost/housing-portal/portal/media-type/html/role/user/pa
ge/default.psml/js_peid/P-fc7f0d2122-10002");
HttpURLConnection conn = (HttpURLConnection)
url.openConnection();
conn.setRequestProperty ("Cookie", "JSESSIONID="+
rundata.getSession().getId() + "; path=/housing-portal;");
conn.setDoOutput(true);
conn.setUseCaches (false);
conn.setRequestProperty ("Content-Type", "text/html");
conn.connect();
String inputLine, httpOutput = "";
DataInputStream in =(new DataInputStream(url
.openStream()));
while ((inputLine = in.readLine()) != null) {
httpOutput += inputLine;
}
The code requests the page, but returns a login screen instead of the
page I want. I believe it is somehow ignoring the cookie, but can't put
my finger on why. Any ideas?
Jason Shindler
Network Services
University of Florida, Department of Housing and Residence Education