Recently did an upgrade to DWR version 3.0.2. However, got an error 500 when trying to download a file.
After investigations, it turns out that the ~ character in the download URL link is a bad url for the single sign on.
Would like to check if the ID generated by DWR can be changed to be without the ~ character. Or is there a way to amend the download URL link?
I hacked up the below code to better illustrate what I mean. Note that this is just a sketch that I haven’t tested but the major parts should be ok.
public class MyDownloadManager extends InMemoryDownloadManager {
@Override
public void setIdGenerator(IdGenerator globalIdGenerator) {
// Install IdGenerator changes only for downloads by wrapping the global instance
super.setIdGenerator(new MyIdGeneratorWrapper(globalIdGenerator));
}
}
public class MyIdGeneratorWrapper implements IdGenerator {
private IdGenerator realIdGenerator;
public MyIdGeneratorWrapper(IdGenerator realIdGenerator) {
this.realIdGenerator = realIdGenerator;
}
@Override
public String generate() {
return realIdGenerator.generate().replaceAll("~", "_");
}
}