SSL & Secure Component
SSL & Secure Component
- Subject: SSL & Secure Component
- From: Gino Pacitti <email@hidden>
- Date: Fri, 22 Apr 2016 17:03:56 +0100
Hi List
I have been using an implementation of this SecureComponent (see below) in a few apps but since I have now moved. The new set is:
Centos 6.7 Container
Apache 2.2.15 - SSL enabled etc.
mod_webobjects.so adaptor 5.5 Adaptor from - http://wocommunity.org/documents/tools/mod_WebObjects/Apache2.2/centos/5.5/x86_64/
It now seems to be doing something strange and will not return the secure page.
Firstly port returns 0 and woserverport returns null. And then in my log it shows the request coming back quite a few times resulting in the page complaining about too many redirects and showing blank.
Any ideas?
public class SecureComponent extends WOComponent {
protected boolean sslRequired;
public boolean getSslRequired() {
return sslRequired;
}
public void setSslRequired(boolean newSslRequired) {
sslRequired = newSslRequired;
}
public void appendToResponse(WOResponse res, WOContext con) {
String protocol = null;
boolean switchRequired = false;
super.appendToResponse(res, con);
WORequest req = con.request();
String port = req.headerForKey("SERVER_PORT");
String woserverport = req.headerForKey("x-webobjects-server-port");
if (sslRequired) {
if ( port != null && !port.equals("443") ) {
switchRequired = true;
} else if ( woserverport != null && !woserverport.equals("443")
) {
switchRequired = true;
} else {
// unable to determine if switch is needed.
switchRequired = false;
}
} else {
if ( port != null && port.equals("443") ) {
switchRequired = true;
} else if ( woserverport != null && woserverport.equals("443") )
{
switchRequired = true;
} else {
// unable to determine if switch is needed.
switchRequired = false;
}
}
if (switchRequired) {
if ( sslRequired) {
protocol = "https://" ;
} else {
protocol = "http://" ;
}
String url =
protocol+req.headerForKey("host")+con.componentActionURL();
res.setHeader(url, "location");
res.setHeader("text/html", "content-type");
res.setHeader("0", "content-length");
res.setStatus(302);
}
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden