public class FrontController extends HttpServlet {

  protected void processRequest(HttpServletRequest request,
                                HttpServletResponse response) 
                                throws ServletException, java.io.IOException {
    ...
    // identyfikacja typu dania
    String requestType = getRequestType(request);
 
    // utworzenie wyspecjalizowanej instancji RequestContext w zalenoci od
    // typu dania
    RequestContextFactory requestContextFactory =
      RequestContextFactory.getInstance();
 
    RequestContext requestContext = 
      requestContextFactory.getRequestContext(requestType, request);
    ...
  }
}
