Archive for the ‘Tutorials’ Category

«12




Setting Up SSL on Tomcat In 3 Easy Steps

Posted on September 12th, 2007 in Java EE, Tutorials | 74 Comments »

Setting up SSL on Tomcat is easy and you don’t have to do much for converting your web application to work with the Https protocol. But however, the problem you would find to set up SSL is the documentation available over the web. The documentation source is available on the Apache site but it starts off good and ends with a lot of confusion. Especially I was confused on the OpenSSL part where it says to use OpenSSL.

It might be good in a production environment to use OpenSSL but if you just want to test out SSL with Tomcat alone then it is more than enough to just have your JDK and Tomcat setups. So I would make you walk through the same steps which I did while getting SSL up and running and building a secured web app within a matter of minutes.

The things which I have used to setup SSL consists of:

  • JDK 1.6
  • Tomcat 6

Even though I have used the latest version I don’t see any problems which you might face in carrying out the same set of steps for JDK 1.5 which I am about to explain. JDK comes shipped with a keytool executable which is required to generate a keystore. The keytool can be found in the earlier version of JDK too. The 3 steps which would make you to get started with setting up SSL are:

  1. Generating the Keystore file
  2. Configuring Tomcat for using the Keystore file
  3. Configuring your web application to work with SSL

Let’s get this party started now. Read the rest of this entry »

JAX-WS + JAXP Tutorial - Building A StockQuote Web Service Client

Posted on August 15th, 2007 in Tutorials, Web Services | 6 Comments »

In this tutorial you will learn how to make a standalone Web Service client using JAX-WS. JAX-WS and JAXP API together, provide an easy way to develop a web service client. This tutorial makes use of an existing online web service instead of creating one from scratch just for making a client. For this tutorial you would need the following:

  • JWSDP 2.0 pack
  • JDK 1.5 or above
  • The required Web Service WSDL
  • Eclipse 3.1 or above

The procedure for creating the client have been broken down into 3 easy steps which are:

  1. Creating the Stubs from WSDL
  2. Building the Web Service Client using JAX-WS
  3. Parsing the Output using JAXP

JAXWS & JAXP

JAX-WS is an API for creating as well as invoking web services. It succeeds the JAX RPC API and makes it easier by reducing the XML configurations, through the use of annotations available in Java 5. However you don’t need annotations for this tutorial.

JAXP is a wrapper API over the legacy XML parsing API’s such as DOM and SAX and leverages their usage through its generic interfaces. JAXP is typically used in a web service which is implemented with a Document Literal style. This is because such web services return an XML document and not a simple String Value. The XML Document then has to be parsed using the JAXP API.

So let us begin with the tutorial Read the rest of this entry »

SCWCD - The 3 Steps to Success!

Posted on July 10th, 2007 in Featured, Java, Java EE, SCWCD, Tutorials | 10 Comments »

After my completion of SCDJWS I had written about the 3 steps to success in SCDJWS which has helped many who were new in the web services domain to help them get prepared and confident about preparing for the big exam! Following the same foot steps I am now presenting in front of you 3 steps to success in SCWCD. I scored a 90+ in the exam and so I take a a pride to provide you the guidance of how to get a 90+

Why are there always 3 Steps to success?

This probably would be the same doubt on the lines of why do we say “Ready…Steady…Go” and also the countdown of a start of a timer in “3..2..1“. Well, the 3 steps are same everywhere, only their definition changes. Similarly I always make it a point to divide my preparation routine into particularly 3 steps to make it sound quicker and much systematic. Finally, its the enthusiasm that counts that you put in each of the steps.

Stop all that blabber… How do I go about preparing for SCWCD?

Okay..okay. SCWCD (exam code - CX 310 081) is aimed particularly for the web developers and it takes into consideration that you must have developed web applications in the past and now want to try out with JSP/ Servlets. So there wont be any questions about how and what are the intricacies dealing with what a web application is, but concentrates on how would you build web applications using the web components that SUN provides.

SCWCD - The preparation

The 3 steps for success in SCWCD are: Read the rest of this entry »

Learn the Servlet API - ServletRequest and HttpServletRequest

Posted on June 22nd, 2007 in Java EE, SCWCD, Tutorials | No Comments »

We will now concentrate on the basic aspect of using a Servlet which is requests and response. But we will currently concentrate only on ServletRequest and HttpServletRequest.

Points to Ponder: 

  • ServletRequest is not in any way responsible for fetching HTTP related properties.
  • ServletRequest and HttpServletRequest both are interfaces and you cannot directly use them.
  • The interface implementations depend on the vendor and not on the developer.

ServletRequest 

Lets look at the methods present in the ServletRequest Interface first and categorize them. There are in total 29 methods. For making the categories first we would have to look as to what are things to carry out when we receive a request. The things we would like to do are: Read the rest of this entry »

Learn the Servlet API - A step by step approach

Posted on June 21st, 2007 in Java EE, SCWCD, Tutorials | No Comments »

The SCWCD(Sun Certified Web Component Developer) exam concentrates on the Servlet API version 2.4.  In order to prepare for the exam its a necessary step to consider to learn the API itself. Learning the API means getting a knowledge about which Interfaces and which Classes exists. Their inheritance relationships and the methods associated with them. This actually helps a person in getting more confident while preparing for the exam since knowledge of the API makes it easy to recognize the errors and exceptions which may occur while using any of the interfaces or classes. It also helps to track the usage of syntaxes when codes are mentioned in the exam and how do they work.

So its in my mind to put forward the API in depth but not make it boring to read (Has anyone ever considered to read the API docs?). So the plan is to learn it in a step by step approach taking into mind the exam related topics!

So here we go. Read the rest of this entry »

Getting started with IoC - A simplified tutorial

Posted on April 26th, 2007 in Java, Tutorials | 2 Comments »

I had mentioned about Inversion of Control (IoC) in my earlier post Inversion of Control - for easy integration. In this post I will show you how you can actually make your integration easy with implementation of a mini application sample based on IoC.

Objective
The main objective of this mini tutorial is to highlight the implementation of an interface based Inversion of Control (IoC) architecture and to state how it could help in the integration and maintenance of the application.

For this mini application I will use the following set of classes

  1. Dependency - This is the interface which is implementation as per my application versions progress and which will be used by the View components in my application. In other words this is my Model component in a MVC architecture
  2. Dependent - This is my View component which uses the Model component to produce the results for displaying. As the name suggests the class is dependent on the Dependency implementation.
  3. Injector - This is most important class in the application and which introduces the aspect of Inversion Of Control into the applications. This class can also be referred as the configurator class.
  4. Finally there can a number of implementations of the Dependency interface according to the needs of the application.

Note: This mini tutorial is based on the concept of Interface based IOC. It also assumes that you import the required classed in your Classes when compiling them.

Lets start with our tutorial. Read the rest of this entry »

The Great Ant Tutorial - a great jump start

Posted on April 16th, 2007 in Java, Java EE, Tutorials, XML | 34 Comments »

Apache Ant is a powerful way to convert your developmental structures to deployment structures. It is declarative and all the command line tasks used for deploying an application are represented by simple XML elements. Without much details, this tutorial would breeze you through the steps on how to build a web application using a single XML build file and nothing else. If you have not yet understood what is the use of Ant, read my article on Development and Deployment Structures - the perfect way to build web applications.

I would use the same analogy of my development structure as mentioned in the above linked article i.e. my development structure consists of the following directories:
Read the rest of this entry »

«12