log("[Noelios Restlet Engine] - The ServerServlet couldn't instantiate the class. Please check this class has an empty constructor " + targetClassName);
log("[Noelios Restlet Engine] - The ServerServlet couldn't instantiate the class. Please check this class has an empty constructor " + targetClassName, e);
   public Restlet getTarget(HttpServletRequest request)   {   	Restlet result = this.target;   	      if(result == null)      {         synchronized(ServerServlet.class)         {            // Find the attribute name to use to store the target reference            String targetAttributeName = findInitParameter(NAME_TARGET_ATTRIBUTE);            if(targetAttributeName != null)            {               // Look up the attribute for a target               result = (Restlet)getServletContext().getAttribute(targetAttributeName);               if(result == null)               {                  // Try to instantiate a new target                  // First, find the target class name                  String targetClassName = findInitParameter(NAME_TARGET_CLASS);                  if(targetClassName != null)                  {                     try                     {                        // Load the target class using the given class name                        Class targetClass = Class.forName(targetClassName);                        // Create a new instance of the target class                        // and store it for reuse by other ServerServlets.                        result = (Restlet)targetClass.newInstance();                        getServletContext().setAttribute(NAME_TARGET_ATTRIBUTE, result);                                                // Set if a context path needs to be transmitted                     	String initContextPathName = findInitParameter(NAME_TARGET_INIT_CONTEXTPATH);                     	if(initContextPathName != null)                     	{                        	// First, let's locate the closest component                        	Component component = null;                        	if(result instanceof Component)                        	{                        		// The target is probably a RestletContainer or RestletServer                        		component = (Component)result;                        	}                        	else                        	{                        		// The target is probably a standalone Restlet or Chainlet or Maplet                        		// Try to get its parent, even if chances to find one are low                        		component = result.getOwner();                        	}                        	                        	// Provide the context path as an init parameter                        	if(component != null)                        	{                        		String scheme = request.getScheme();                        		String hostName = request.getServerName();                        		int hostPort = request.getServerPort();                        		String servletPath = request.getContextPath() + request.getServletPath();                        		String contextPath = Reference.toUri(scheme, hostName, hostPort, servletPath, null, null);                        		component.getProperties().put(initContextPathName, contextPath);                        		log("[Noelios Restlet Engine] - This context path has been provided to the target's init parameter \"" + initContextPathName + "\": " + contextPath);                        	}                     	}                     }                     catch(ClassNotFoundException e)                     {                        log("[Noelios Restlet Engine] - The ServerServlet couldn't find the class. Please check that your classpath includes " + targetClassName);                     }                     catch(InstantiationException e)                     {                        log("[Noelios Restlet Engine] - The ServerServlet couldn't instantiate the class. Please check this class has an empty constructor " + targetClassName);                     }                     catch(IllegalAccessException e)                     {                        log("[Noelios Restlet Engine] - The ServerServlet couldn't instantiate the class. Please check that you have to proper access rights to " + targetClassName);                     }                  }                  else                  {                     log("[Noelios Restlet Engine] - The ServerServlet couldn't find the class name of the target Restlet. Please set the initialization parameter called " + NAME_TARGET_CLASS);                  }               }            }            else            {               log("[Noelios Restlet Engine] - The ServerServlet couldn't find the attribute name of the target Restlet. Please set the initialization parameter called " + NAME_TARGET_ATTRIBUTE);            }            this.target = result;         }      }            return result;   }