aspose file tools*
The moose likes Struts and the fly likes Use Http And Https in Same application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Use Http And Https in Same application" Watch "Use Http And Https in Same application" New topic
Author

Use Http And Https in Same application

MInu
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
Hi all,

I have one web application working in https: , but for dome url (i mean paths) i have to use http only ..How can I configure http and https in same application. Please give some idea to do this...

Thnaks in advance


God Gave Me Nothing I Wanted<br />He Gave Me Everything I Needed<br /> - Swami Vivekananda
saravanaprabu baskaran
Greenhorn

Joined: Jun 13, 2006
Posts: 7
Hi,

You can change the header details of the request before it reaches the action class.

You write one class which extends RequestProcessor, the looks like below one

//First check if the connection is secure.
try{
if (request.getHeader("HTTP")==null || !request.getHeader("HTTP").equals("on")){
response.sendRedirect("HTTP"+request.getRequestURI()+"?"+request.getQueryString());
return false;
}
}
catch(Throwable t){
log("There is a Exception in the request Processor while redirecting the request",t );
return false;
}
//
return true;
}


The RequestProcessor class will be excecuted before calling the action class and change the header from HTTPS to HTTP.

I have not tested the code. But, have a try and also look for other replies.


With Regards,<br />Saravanaprabu Baskaran<br /> <br />SCJP 92 %<br />SCWCD 98 %
MInu
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
thanks Saravanaprabu...

Whether we can do anything through Tomcat Configarations ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use Http And Https in Same application