Posts

Showing posts with the label web application

Creating Self-Signed Certificates Open SSL Part 2 : Making Apache HTTP Server SSL enabled.

Image
  In previous post I have explained how to generate self-signed certificates using openSSL. This post We will see how to use this certificate for a secured web application. Now lets use these certificates to make a web application secure. For this I have downloaded Apache HTTP Server including OpenSSL and installed from here. 1. First step is to make Apache HTTP Server SSL enabled. Following the simple steps given below to get SSL enabled Edit <APACHE_INSTALL_HOME>/config/httpd.conf and uncomment following line LoadModule ssl_module modules/mod_ssl.so Include conf/extra/httpd-ssl.conf Edit <APACHE_INSTALL_HOME>/config/extra/httpd-ssl.conf and update following attributes SSLCertificateKeyFile <Location of Server.key file, generated as per previous post> SSLCertificateFile <Location of Server.crt file, generated as per previous post>   2. Restart the Server <APACHE_INSTAL_HOME>/bin/httpd.exe –k restart 3. Install/import certifica...

Downloading a file from web application

Image
      This post explains developing a web application which allows requestor to download a file. Here web app will have a servlet which streams requested file to requestor. follow the step to develop it using NetBean 6.8 1. Create a web application [ refer previous posts ] 2.Create a Servlet and add the code given below in doGet method      String filePath =null;      int length =0;        //accept file name as parameter         String fileName = request.getParameter("FILE_NAME");         InputStream is = getServletContext().getClassLoader().getResourceAsStream("/"+fileName);         if(is == null){             PrintWriter writer = response.getWriter();   ...