Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

305
Visualizações
How to use javascript (in Angular) to get bytes encoded by java.util.Base64?

Since the functions related to DispatcherServlet are implemented by another department of my company, I can only complete the specific business classes of the back-end and the front-end, so I cannot directly return byte[] to the front-end.

So I use

                    Base64.getUrlEncoder().encodeToString(bytes);
                    response.put("data", data);

to return a RESTful json response to my front-end.

But in Java encodeToString, BASE64 util converts the bytes to BASE64 bytes and then returns a String based on ISO_8859_1...

First, How can I convert the string to the ISO_8859_1 byte[]?

Second, How can I decode the byte[] encoded by BASE64?

in frontEnd,

        this.http.pdf(data).subscribe(
          resp => {
            const data = WhatShouldTheMethodBe(respo['data']); //What should the method be?
            let blob = new Blob([data], { type: 'application/pdf' });
            let url = window.URL.createObjectURL(blob);
            let pwa = window.open(url);
            if (!pwa || pwa.closed || typeof pwa.closed == 'undefined') {
              alert('Please disable your Pop-up blocker and try again.');
            }
          }
        );

Thanks a lot.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda