Forum Feature requests

Cookie support

PeteE
I'm integrating princexml into Deki Wiki. I'd like to be able to authenticate using a cookie with a hashed authtoken. We're currently using html2ps | ps2pdf to do pdf conversion and html2ps has a -k option which accepts a Netscape-formatted cookie file. I'd love to see a feature like this in prince!

Thanks,
pete
mikeday
Sounds like a good idea! We'll take a look at this for the next maintenance release.
PeteE
Awesome thanks mikeday!
mikeday
In the new Prince 6.0 rev 6 release we have added a --cookiejar command-line option, which points to a file containing authentication cookies.
bostond
Hi Mike,

There doesn't appear to be a way to specify cookies via the Java API. Any recommendations (or, an updated API) would be appreciated.

Damien
mikeday
At the moment it is only possible to specify a "cookie jar" file that contains cookies, using the --cookiejar command-line option. We haven't added this to the Java API yet, but it would be easy to do. However, are you thinking of something that allows you to set cookies dynamically, eg. setCookie(String name, String value)?
bostond
Hi Mike,

Thanks for your reply. Yes, I was thinking about something that allows dynamic cookie setting, though I'd recommend a method that accepted more than a name/value pair, as cookies also allow specification of domain, path, isSecure, etc. I'd suggest:

public void setCookie( javax.servlet.http.Cookie cookie );

and a way to set all, with an array or collection:

public void setCookies(javax.servlet.http.Cookie[] cookies);
mikeday
That API makes sense, although it is more work to implement. I'll add it to the roadmap :)
mikeday
Prince 10 is now available, and includes a new --cookie command-line argument which can be used to specify individual cookies without needing to create a cookie jar file.