public void init(Map initData) throws RollerException {
// need a weblog request so that we can know the weblog and locale
WeblogRequest weblogRequest = (WeblogRequest) initData.get("weblogRequest");
if(weblogRequest == null) {
throw new RollerException("Expected 'weblogRequest' init param!");
}
// PreviewURLModel only works on preview requests, so cast weblogRequest
// into a WeblogPreviewRequest and if it fails then throw exception
if(weblogRequest instanceof WeblogPreviewRequest) {
this.previewRequest = (WeblogPreviewRequest) weblogRequest;
} else {
throw new RollerException("weblogRequest is not a WeblogPreviewRequest."+
" PreviewURLModel only supports preview requests.");
}
this.weblog = weblogRequest.getWeblog();
this.locale = weblogRequest.getLocale();
super.init(initData);
}