def __load_module(self):
		modname = self.__module
		self.__module = None
		MODULE.info('Importing module %r' % (modname,))
		try:
			self.__import(modname)
		except ImportError as exc:
			MODULE.error('Failed to import module %s: %s\n%s' % (modname, exc, format_exc()))
			self.reload_server()  # TODO: should we check module existance in umc-server
			raise

		self.handler = self.__module.Instance()
	def render(self, request):
		request.setHeader('Content-Type', 'application/json')

		handler = request.site.handler
		method = request.getHeader('X-UMC-Method')
		umcptype, command = self.get_command(request.path)
		umcprequest = request.get_umcp_request(umcptype, command)

		MODULE.info('Executing %s' % command)
		try:
			func = getattr(handler, method)
		except AttributeError:
			MODULE.info('Method %s of command %s does not exists' % (method, command))
			request.setResponseCode(500)
			return ''

		func(umcprequest)
		return NOT_DONE_YET
	def render(self, request):
		session = request.getSession()
		acls = ACLs(session)
		moduleManager = request.site.moduleManager

		command = '/'.join(request.prepath[1:])

		module_name = acls.get_module_providing(moduleManager, command)
		if not module_name:
			MODULE.warn('No module provides %s' % (command))
			request.setResponseCode(BAD_REQUEST_FORBIDDEN)
			return

		MODULE.info('Checking ACLs for %s (%s)' % (command, module_name))
		if not acls.is_command_allowed(request, command):
			MODULE.warn('Command %s is not allowed' % (command))
			request.setResponseCode(BAD_REQUEST_FORBIDDEN)
			return

		methodname = acls.get_method_name(moduleManager, module_name, command)
		if not methodname:
			MODULE.warn('Command %s does not exists' % (command))
			request.setResponseCode(BAD_REQUEST_NOT_FOUND)
			return

		headers = self.get_request_header(request, methodname)
		body = self.get_request_body(request)

		CORE.info('Passing new request to module %s' % (module_name,))
		process = self.get_process(session, module_name)

		urequest = process.request(request.method, request.uri, headers, body)
		urequest.addCallback(self.respond, request)
		urequest.addErrback(self.failed_request, request)

		return NOT_DONE_YET