Gson gson = new Gson();
if (request.getParameter("documento") != null) {
HttpSession session = request.getSession(true);
LoginResponse login = (LoginResponse) session.getAttribute(Global.LOGIN);
if (login != null) {
//Busca o parametro enviado pelo form
DocumentoCreateExternoRequest documento = gson.fromJson(request.getParameter("documento"), DocumentoCreateExternoRequest.class);
//L� o arquivo enviado
String fileDir = getFilePath(request, documento.getArquivoNome());
byte[] fileBytes = Files.readAllBytes(Paths.get(fileDir));
documento.setBytes(Base64Coder.encode(fileBytes));
String apiName = CAMINHO_API_DOCUMENTO + "CreateExterno";
HttpPost httpPost = new HttpPost(Global.ApiPortalBaseURL + apiName);
httpPost.setHeader(Global.ACS_AUTH_CONTEXT_UID, login.getUidContextos(0));
httpPost.setHeader(Global.ACS_AUTH_TOKEN, login.getToken());
httpPost.setHeader(Global.ACS_AUTH_USER_UID, login.getUserInfo().getUid());
StringEntity entity = new StringEntity(gson.toJson(documento), StandardCharsets.UTF_8);
entity.setContentType("application/json");
httpPost.setEntity(entity);