p: graphicImage shows the same image always

0

I have a WS (Rest) that returns an object of type SERVIDOR and depends on an Id that happens to it.

@GET
@Path("emps")
@Produces("application/xml")
public List <SERVIDOR> sendFoto(@QueryParam("a") String a)

and from another application, I get that object, but when I want to show the photo of type byte[] , always shows the same photo, I have verified that the object does change when I send another ID.

Method getRestServidor() :

      GenericType<List<SERVIDOR>> generic = new GenericType<List<SERVIDOR>>() {};
      System.out.println("Output from Server .... \n");
      this.setEmployee(response.getEntity(generic));
      for(SERVIDOR c:this.getEmployee()){
          this.setIs(new ByteArrayInputStream((byte[]) c.getNUEVA_FOTO()));
          this.setMyImage(new DefaultStreamedContent(this.getIs(), "image/png"));
      }

JSF page:

 /*code*/
<p:commandButton value="Enviar" actionListener="#{paramReportController.checkBiometrico}" styleClass="ui-priority-primary"  update=":f1:growl2 :f1:pn1 :f1:png1 :f1:pn2"/>
        <div class="grid-example col s12 m6">
           <p:panel id="pn2">
              <p:panelGrid columns="2">
                <p:graphicImage value="#{paramReportController.myImage}"    alt="sin imagen" id="pic1" style="width:200px;width:200px">
                </p:graphicImage>
             </p:panelGrid>
          </p:panel>
/*code*/

I must also mention that to get to the getRestServidor() method, first go through a method called checkBiometrico() and it calls the getRestServidor() .

I hope you can help me! Thanks

    
asked by Maicoly Guerrero 27.03.2017 в 06:06
source

1 answer

0

If someone encounters the same problem, the solution is not to use caching in the graphical component.

<p:graphicImage .... cache="false"/>
    
answered by 28.03.2017 / 23:24
source