*/
private void initialize(HttpServletRequest request, RequestContext context) {
String sTmp;
int nTmp = 0;
StringAttributeMap params = context.getCatalogConfiguration().getParameters();
Enumeration<String> paramNames = request.getParameterNames();
if (paramNames != null) {
while (paramNames.hasMoreElements()) {
String paramName = Val.chkStr(paramNames.nextElement());
if (paramName.equalsIgnoreCase("start")) {
this.hadStart = true;
} else if (paramName.equalsIgnoreCase("max")) {
this.hadMax = true;
} else if (paramName.equalsIgnoreCase("f")) {
sTmp = Val.chkStr(this.request.getParameter(paramName));
if (sTmp.toLowerCase().startsWith("sitemap.")) {
this.subFormat = Val.chkStr(sTmp.substring(8));
}
}
}
}
String baseContextPath = RequestContext.resolveBaseContextPath(request);
this.baseUrl = baseContextPath;
sTmp = Val.chkStr(params.getValue("sitemap.baseUrl"));
if (sTmp.length() > 0) {
this.baseUrl = sTmp;
} else {
this.baseUrl += "/sitemap";
}
if (this.baseUrl.endsWith("&")) {
this.baseUrl = this.baseUrl.substring(0,this.baseUrl.length() - 1);
}
if (this.baseUrl.endsWith("?")) {
this.baseUrl = this.baseUrl.substring(0,this.baseUrl.length() - 1);
}
if ((this.subFormat != null) && (this.subFormat.length() > 0)) {
sTmp = Val.chkStr(params.getValue("sitemap.documentUrlPattern."+this.subFormat));
if (sTmp.length() == 0) {
sTmp = Val.chkStr(params.getValue("sitemap.documentUrlPattern"));
}
} else {
sTmp = Val.chkStr(params.getValue("sitemap.documentUrlPattern"));
}
if (sTmp.length() > 0) this.documentUrlPattern = sTmp;
if (!this.documentUrlPattern.startsWith("http")) {
if (!this.documentUrlPattern.startsWith("/")) {
this.documentUrlPattern = "/"+this.documentUrlPattern;
}
this.documentUrlPattern = baseContextPath+this.documentUrlPattern;
}
nTmp = Val.chkInt(params.getValue("sitemap.urlsPerIndexFile"),0);
if ((nTmp > 0) && (nTmp < 1000)) this.urlsPerIndexFile = nTmp;
nTmp = Val.chkInt(params.getValue("sitemap.urlsPerSitemapFile"),0);
if ((nTmp > 0) && (nTmp <= 50000)) this.urlsPerSitemapFile = nTmp;
if (!this.hadStart && !this.hadMax) {
this.query.getFilter().setMaxRecords(this.urlsPerSitemapFile);
}
sTmp = Val.chkStr(params.getValue("sitemap.namespaceUri"));
if (sTmp.length() > 0) this.namespaceUri = sTmp;
sTmp = Val.chkStr(params.getValue("sitemap.changefreq"));
if (sTmp.length() > 0) this.changefreq = sTmp;
sTmp = Val.chkStr(params.getValue("sitemap.priority"));
if (sTmp.length() > 0) this.priority = sTmp;
// error check
String errPfx = "gpt.xml: gptConfig/catalog/parameter/";
if (this.documentUrlPattern.indexOf("{0}") == -1) {