// the date to associate with the embedded, rewritten URLs:
String datespec = result.getCaptureTimestamp();
SWFUrlRewriter rw = new SWFUrlRewriter(uriConverter, url, datespec);
// OK, try to read the input movie:
Movie movie = getRobustMovie(RobustMovieDecoder.DECODE_RULE_NULLS);
try {
movie.decodeFromStream(payloadResource);
} catch (DataFormatException e1) {
throw new BadContentException(e1.getLocalizedMessage());
}
Movie outMovie = new Movie(movie);
List<MovieTag> inTags = movie.getObjects();
ArrayList<MovieTag> outTags = new ArrayList<MovieTag>();
for (MovieTag tag : inTags) {
outTags.add(rewriteTag(rw, tag));
}
outMovie.setObjects(outTags);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
outMovie.encodeToStream(baos);
} catch (DataFormatException e) {
throw new BadContentException(e.getLocalizedMessage());
}
// put the new corrected length: