private boolean checkRequest(HttpServletRequest request, ServiceContext <T, R> context, Gson gson, RSAPrivateKey priKey) {
		String messageEncrypted = request.getParameter(SharedConstants.DATA_KEY);
		if (messageEncrypted == null) {
			System.err.println("Cannot find the param " + SharedConstants.DATA_KEY);
			context.getResponseObject().setCode(FreeDoitResponse.CODE_INVALID_REQUEST);
			return false;
		}

		Long currentUserId = getCurrentUserId(request);
		Long currentClientId = getCurrentClientId(request);
		if (currentUserId == null || currentClientId == null || priKey == null) {
			context.getResponseObject().setCode(FreeDoitResponse.CODE_lOGIN_REQUIRED);
			return false;
		}

		context.setCurrentUserId(currentUserId);
		context.setCurrentClientId(currentClientId);
		
		// Decrypt the key by RSA first
		// This key is used to decrypt the message by AES
		String encryptedKey = request.getParameter(SharedConstants.KEY);
		if (encryptedKey == null) {
			System.err.println("Cannot find the param " + SharedConstants.KEY);
			context.getResponseObject().setCode(FreeDoitResponse.CODE_INVALID_REQUEST);
			return false;
		}
		
		String decryptedKey = FreeDoitDataUtils.decryptByRSA(priKey, encryptedKey);
		if (decryptedKey == null) {
			System.err.println("Cannot parse the incoming key");
			context.getResponseObject().setCode(FreeDoitResponse.CODE_INVALID_DATA);
			return false;
		}
		
		context.setKey(decryptedKey);
		
		// Decrypt message
		String message = FreeDoitDataUtils.decryptByAES(messageEncrypted, decryptedKey);
		if (message == null) {
			System.err.println("Cannot parse the incoming message");
			context.getResponseObject().setCode(FreeDoitResponse.CODE_INVALID_DATA);
			return false;
		}
		System.out.println("Message: " + message);

		T requestObject = null;
		try {
			requestObject = gson.fromJson(message, getRequestType());
		} catch (Exception e) {
			e.printStackTrace();
		}
			
		if (requestObject == null) {
			System.err.println("Cannot parse the incoming message");
			context.getResponseObject().setCode(FreeDoitResponse.CODE_INVALID_REQUEST);
			return false;
		} else {
			context.setRequestObject(requestObject);
			return true;
		}
		
	}