this.pageContext = (PageContext) initData.get("pageContext");
// we expect the init data to contain a weblogRequest object
WeblogRequest weblogRequest = (WeblogRequest) initData.get("parsedRequest");
if(weblogRequest == null) {
throw new WebloggerException("expected weblogRequest from init data");
}
// CalendarModel only works on page requests, so cast weblogRequest
// into a WeblogPageRequest and if it fails then throw exception
if(weblogRequest instanceof WeblogPageRequest) {
this.pageRequest = (WeblogPageRequest) weblogRequest;
} else {
throw new WebloggerException("weblogRequest is not a WeblogPageRequest."+
" CalendarModel only supports page requests.");
}
}