assertEquals(HTTPStatus.OK, containerResponse.getStatus());
// get lock-token from response body
// some manipulation to serialize response entity
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
LockResultResponseEntity entity = (LockResultResponseEntity)containerResponse.getEntity();
entity.write(outputStream);
String lockToken = outputStream.toString();
lockToken = lockToken.substring(lockToken.indexOf(">opaquelocktoken:"));
lockToken = lockToken.substring(lockToken.indexOf(":") + 1, lockToken.indexOf("<"));
//prepare to send lock refresh request
headers = new MultivaluedMapImpl();
headers.add(ExtHttpHeaders.CONTENTTYPE, MediaType.TEXT_PLAIN);
headers.add(ExtHttpHeaders.LOCKTOKEN, lockToken);
containerResponse = service(WebDAVMethods.LOCK, getPathWS() + path, "", headers, null);
assertEquals(HTTPStatus.OK, containerResponse.getStatus());
// some manipulation to serialize response entity
outputStream = new ByteArrayOutputStream();
entity = (LockResultResponseEntity)containerResponse.getEntity();
entity.write(outputStream);
System.out.println("\n=Lock method response body (refresh lock)=");
System.out.println("==========================================");
System.out.println(outputStream.toString());
System.out.println("==========================================\n");