src/main/java/js/net/HttpRmiServlet.java
@Override
	public void handleRequest(RequestContext context) throws IOException {
		HttpServletRequest httpRequest = context.getRequest();
		HttpServletResponse httpResponse = context.getResponse();

		Matcher matcher = REQUEST_PATH_PATTERN.matcher(context.getRequestPath());
		if (!matcher.find()) {
			sendBadRequest(context);
			return;
		}
		String interfaceName = className(matcher.group(1));
		String methodName = matcher.group(2);

		ManagedMethodSPI managedMethod = null;
		ArgumentsReader argumentsReader = null;
		Object value = null;

		try {
			ManagedClassSPI managedClass = getManagedClass(container, interfaceName, httpRequest.getRequestURI());
			managedMethod = getManagedMethod(managedClass, methodName, httpRequest.getRequestURI());

			final Type[] formalParameters = managedMethod.getParameterTypes();
			argumentsReader = argumentsReaderFactory.getArgumentsReader(httpRequest, formalParameters);
			Object[] arguments = argumentsReader.read(httpRequest, formalParameters);

			Object instance = container.getInstance(managedClass);
			value = managedMethod.invoke(instance, arguments);
		} catch (AuthorizationException e) {
			sendUnauthorized(context);
			return;
		} catch (Throwable t) {
			// all exception, including class not found, no such method and illegal argument are send back to client as they are
			sendError(context, t);
			return;
		} finally {
			if (argumentsReader != null) {
				argumentsReader.clean();
			}
		}

		httpResponse.setCharacterEncoding("UTF-8");
		if (managedMethod.isVoid()) {
			httpResponse.setStatus(HttpServletResponse.SC_NO_CONTENT);
			return;
		}

		ContentType contentType = valueWriterFactory.getContentTypeForValue(value);
		httpResponse.setStatus(HttpServletResponse.SC_OK);
		httpResponse.setContentType(contentType.getValue());

		ValueWriter valueWriter = valueWriterFactory.getValueWriter(contentType);
		valueWriter.write(httpResponse, value);
	}
@Override
	public void handleRequest(RequestContext context) throws IOException {
		HttpServletRequest httpRequest = context.getRequest();
		HttpServletResponse httpResponse = context.getResponse();

		Matcher matcher = REQUEST_PATH_PATTERN.matcher(context.getRequestPath());
		if (!matcher.find()) {
			sendBadRequest(context);
			return;
		}
		String interfaceName = className(matcher.group(1));
		String methodName = matcher.group(2);

		ManagedMethodSPI managedMethod = null;
		ArgumentsReader argumentsReader = null;
		Object value = null;

		try {
			ManagedClassSPI managedClass = getManagedClass(container, interfaceName, httpRequest.getRequestURI());
			managedMethod = getManagedMethod(managedClass, methodName, httpRequest.getRequestURI());

			final Type[] formalParameters = managedMethod.getParameterTypes();
			argumentsReader = argumentsReaderFactory.getArgumentsReader(httpRequest, formalParameters);
			Object[] arguments = argumentsReader.read(httpRequest, formalParameters);

			Object instance = container.getInstance(managedClass);
			value = managedMethod.invoke(instance, arguments);
		} catch (AuthorizationException e) {
			sendUnauthorized(context);
			return;
		} catch (Throwable t) {
			// all exception, including class not found, no such method and illegal argument are send back to client as they are
			sendError(context, t);
			return;
		} finally {
			if (argumentsReader != null) {
				argumentsReader.clean();
			}
		}

		httpResponse.setCharacterEncoding("UTF-8");
		if (managedMethod.isVoid()) {
			httpResponse.setStatus(HttpServletResponse.SC_NO_CONTENT);
			return;
		}

		ContentType contentType = valueWriterFactory.getContentTypeForValue(value);
		httpResponse.setStatus(HttpServletResponse.SC_OK);
		httpResponse.setContentType(contentType.getValue());

		ValueWriter valueWriter = valueWriterFactory.getValueWriter(contentType);
		valueWriter.write(httpResponse, value);
	}
HTTP-RMI request service. This is the implementation of the
{@link AppServlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)} abstract method. It locates
remote managed method addressed by request path, deserialize actual parameters from HTTP request, reflexively invoke the
method and serialize method returned value to HTTP response.
<p>
Actual parameters are transported into HTTP request body and are encoded accordingly <code>Content-Type</code> request
header; for supported parameters encodings please see
{@link ServerEncoders#getArgumentsReader(HttpServletRequest, Type[])} factory method. On its side, returned value is
transported into HTTP response body too and is encoded accordingly its type - see
{@link ServerEncoders#getValueWriter(ContentType)} for supported encodings for returned value.

@param context HTTP request context.
@throws IOException if HTTP request reading fails for any reason.