Results 1 to 3 of 3
- 06-04-2011, 05:56 AM #1
Member
- Join Date
- Jun 2011
- Posts
- 7
- Rep Power
- 0
Why does .jsp page show only code when the website is hit.
So I am currently running tomcat 6.0 on port 8080. All of the out of the box application websites are in java code and are functioning as expected. We are looking at doing a CAC authentication piece and I have finished the settings in tomcat for setting the keystore and doing the public trust. But I am trying to run a .jsp with just this code in it to validate I can pull the x509 certificate and when I hit the site all it does is show code. I am completly new to JAVA but a fast learner and looking to understand why this code I found would not do anything but show as text when hitting the link. Windows Server 64 bit running tomcat in 32 bit mode. I have a login.jsp for the application that is running and working. But the custom jsp I place in the folder with the login and it just shows the code. Below is the code any help would be greatly appreciated.
import java.io.IOException;
import java.io.PrintWriter;
import java.security.cert.X509Certificate;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class X509Snoop extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,
IOException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
X509Certificate[] certs = (X509Certificate[]) req
.getAttribute("javax.servlet.request.X509Certifica te");
if (certs != null) {
for (int i = 0; i < certs.length; i++) {
out.println("Client Certificate [" + i + "] = " + certs[i].toString());
}
} else {
if ("https".equals(req.getScheme())) {
out.println("This was an HTTPS request, " + "but no client certificate is available");
} else {
out.println("This was not an HTTPS request, " + "so no client certificate is available");
}
}
}
}
- 06-04-2011, 09:58 AM #2
Hi Recently I had the same task. It took many hours. Look at this Tomcat web application with SSL client certificates « Virgo's Naive Stories. It is wonderful article about configurations tomcat for CA.
if you have question you will be able to ask here.
Regard.Skype: petrarsentev
http://TrackStudio.com
- 06-08-2011, 04:19 PM #3
Member
- Join Date
- Jun 2011
- Posts
- 7
- Rep Power
- 0
Similar Threads
-
Download then show page from jsp
By aflores in forum New To JavaReplies: 4Last Post: 09-10-2010, 09:26 AM -
Trying to login to a website then grab another page
By DaveTheAve in forum New To JavaReplies: 6Last Post: 04-14-2010, 09:44 PM -
How to add or code for 'Question and Answer' on product page of website
By 82rathi.angara in forum Advanced JavaReplies: 1Last Post: 08-29-2008, 01:54 PM -
show a value in javascipt in the jsp page
By hussainzim in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 05-20-2008, 09:38 AM -
netbeans 6.0 not show commpunent or show blank page
By fahimaamir in forum NetBeansReplies: 1Last Post: 01-26-2008, 06:20 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks