Q:

Setting ByteArrayInputStream in post method using Jersey 2.25.1

I have been trying to write the following code using jersey 2.25.1 but I am not sure what to pass in the entity. Can someone help me figure this out because there is no entity and in jersey 2.25.1 the post method takes Entity into account which entity and the media type. 
Existing code using jersey 1.13
WebResource resourceGetToken = client.createResource( ESignatureSpringUtil.getMessage( KeyConstants.ALSB_DOCUSIGN_ADDRESS )
                            + ESignatureSpringUtil.getMessage( KeyConstants.REST_GET_TOKEN_ADDRESS) );

                    ClientResponse tokenResponse = resourceGetToken
                        .header( KeyConstants.REST_URI_APPENDERS, tokenSb )
                        .header( DocusignRESTContants.CONTENT_TYPE, DocusignRESTContants.APPLICATION_XML )
                        .header( DocusignRESTContants.X_DOCUSIGN_AUTHENTICATION, getDocusignAuthHeader( cu ) )
                        .accept( MediaType.APPLICATION_XML )
                        .post( ClientResponse.class, new ByteArrayInputStream( tokenStream.toString().getBytes() ) );

                    if ( tokenResponse.getStatus() == 200 ) {
                        RetrieveTokenResponse tokenResp = (RetrieveTokenResponse) tokenResponse.getEntity(RetrieveTokenResponse.class);

Jersey 2.25.1
WebTarget resourceGetToken = client.createResource( ESignatureSpringUtil.getMessage( KeyConstants.ALSB_DOCUSIGN_ADDRESS )
                            + ESignatureSpringUtil.getMessage( KeyConstants.REST_GET_TOKEN_ADDRESS) );

                    Invocation.Builder invcocationBuilder = resourceGetToken.request()
                            .header( KeyConstants.REST_URI_APPENDERS, tokenSb )
                            .header( DocusignRESTContants.CONTENT_TYPE, DocusignRESTContants.APPLICATION_XML )
                            .header( DocusignRESTContants.X_DOCUSIGN_AUTHENTICATION, getDocusignAuthHeader( cu ) )
                            .accept( MediaType.APPLICATION_XML );

                    Response tokenResponse = invcocationBuilder.post( Entity.entity(entity, mediaType));

I need to get the byte stream and the overloaded post methods do not allow me to do it. 
Thanks

A:

This is how I am doing it. 
Response response = builder.put( Entity.entity( new ByteArrayInputStream( jsonObj.toString().getBytes() ), MediaType.APPLICATION_XML ), Response.class );

