public class DHTMLUtil
extends java.lang.Object
Support the running of multiple report sets in one session, and a report set can include one or more reports.
Descriptions of some key terms:
sessionId: the key for the session in the server (generated by the server automatically when you log in), and users can invoke DHTMLUtil.getSessionID(HttpServletRequest request) to get the key.
rptSetId: the key for a report set in DHTML (generated automatically after the report set has been run), and users can invoke DHTMLUtil.getRptSetId(HttpServletRequest request) to get the key.
rptName: the key for a report in DHTML (retrieved from the report set after the report set has been run), and users can invoke DHTMLUtil.getRptName(HttpServletRequest request) to get the key.
Constructor and Description |
---|
DHTMLUtil() |
Modifier and Type | Method and Description |
---|---|
static VersionRecord |
addResource(java.lang.String userId,
java.lang.String folderPath,
byte nodetype,
java.lang.String catalogname,
java.lang.String nodename,
java.lang.String versionPath,
boolean enableLinkCatalogMode,
boolean isLinkCatalogMode,
java.lang.String decs)
Adds a resource in the specified folder.
|
static VersionRecord |
addResultInReport(java.lang.String userId,
java.lang.String rptName,
java.util.Hashtable htRst,
java.lang.String sessionId,
java.lang.String rptSetId)
Adds a result in an existing report.
|
static VersionRecord |
addResultInReport(java.lang.String userId,
java.lang.String rptName,
java.lang.String rstName,
java.lang.String versionPath,
java.lang.String sessionId,
java.lang.String rptSetId,
java.lang.String rptId)
Adds a result in an existing report.
|
static java.util.Hashtable |
buildDisplayNameList(java.util.Hashtable displayName) |
static java.lang.String[][] |
buildDisplayNameListArray(java.lang.String[][] list) |
static java.lang.String |
buildRuntimeID(java.lang.String SessionID,
java.lang.String RptSetId,
java.lang.String RptName)
Builds runtimeID for backwards compatibility.
|
static java.lang.String |
checkPDFDigitalIDFile(DHTMLClientService service,
java.lang.String sessionId,
java.lang.String dRptSetId,
java.lang.String dRptName,
byte[] byteArrayContent,
java.io.InputStream is,
java.lang.String password,
boolean isNoFrame)
Deprecated.
WebActLogic.checkPdfDigitalID since V9.1.
Check PDF digital ID file.
|
static java.lang.String |
clearHtml(java.lang.String str)
Deprecated.
WebActLogic.parseOpenRptParams.
|
static java.lang.String |
convertArrayToJSArray(java.lang.String[] array)
Gets the Script string of the specified array.
|
static java.lang.String |
convertArrayToJSArray(java.lang.String[][] array)
Gets the Script string of the specified two-dimensional array.
|
static int |
convertInchToPt(double size) |
static java.util.List |
convertItemIdToIndex(java.util.List aList,
java.util.List aAvailist) |
static byte[] |
copyOctet(java.io.File file) |
static byte[] |
copyOctet(java.lang.String filePath) |
static char[] |
copyText(java.io.File file) |
static char[] |
copyText(java.lang.String filePath) |
static java.lang.String |
decode(java.lang.String str)
Decodes an ecmascript format string.
|
static java.lang.String |
escape(java.lang.String str)
Translates a string using the ecmascript format.
|
static java.lang.String |
escapeQuotation(java.lang.String src) |
static boolean |
forTestSession(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
GenerateMessages(PropertyMessageResourcesFactory msgFactory) |
static java.lang.String |
get_filter_StringValue_fromeUI(java.lang.String str,
boolean isUserInput) |
static java.lang.String |
getActionOpName(int op) |
static java.lang.Throwable[] |
getAllDHTMLExceptions(javax.servlet.http.HttpServletRequest request)
Gets all exceptions.
|
static java.lang.Throwable[] |
getAllDHTMLExceptions(java.lang.String pid,
java.lang.String rptsetid) |
static java.util.ArrayList |
getAllDirectory(java.lang.String userName,
java.lang.String rootpath)
Deprecated.
DHTMLUtil.IdentifyDirArrayList.
|
static java.util.ArrayList |
getAllReports(java.lang.String userName,
java.lang.String rootpath)
Gets all reports (including sub folders, sub sub folders, ...) in the
specified resource node.
|
static java.util.Vector |
getAllReportsOnlyInRootPath(java.lang.String userName,
java.lang.String rootpath) |
static long |
getBackgroundTimeOut(javax.servlet.http.HttpServletRequest request) |
static int |
getBrowserType(javax.servlet.http.HttpServletRequest request)
Gets the browser type.
|
static int |
GetBrowserType(java.lang.String userAgent) |
static java.lang.String |
getCatalogName(java.lang.String userName,
java.lang.String resourcePath)
Gets the real path of the catalog.
|
static java.lang.String |
getContentFromUrl(java.lang.String url) |
static JSONObject |
getDateSymbols(javax.servlet.http.HttpServletRequest request)
Get date symbols for client date format.
|
static java.lang.String |
getDefaultCompStyle(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getDefaultToolbarItems(DHTMLConfig dhtmlConfig,
java.lang.String SessionID,
java.lang.String RptSetId)
Gets the default toolbar items for the specified report set, which can be
used into JavaScript.
|
static boolean |
getDirWritePermission(java.lang.String userName,
java.lang.String rootpath)
Gets whether the user has the permission of saving reports to the
specified folder.
|
static java.lang.String |
getErrorMsg(int checkCode,
java.lang.String language)
Gets the error message according to the specified check code.
|
static HttpRptServer |
getHttpRptServer(javax.servlet.http.HttpServletRequest request) |
static int |
getMapFunctionValue(java.lang.String name) |
static JException |
getOriginalJException(JException jrex)
Gets the cause of this exception
|
static double |
getPageHeight(int pageType,
int orientation)
Gets the page height.
|
static double |
getPageWidth(int pageType,
int orientation)
Gets the page width.
|
static java.util.Hashtable |
getParameters(javax.servlet.http.HttpServletRequest request)
Deprecated.
WebActLogic.parseRequest(HttpServletRequest request);
Gets the parameters for running a report according to the
request.
|
static java.lang.String |
GetPID(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getPreferenceValue(javax.servlet.http.HttpServletRequest request,
java.lang.String preferenceKey) |
static java.lang.String |
getReportRealPath(java.lang.String userId,
java.lang.String fileName)
Deprecated.
ResourceKit.getReportRealPath.
|
static ExResourceManager |
getResourceManager()
Gets the server resource manager.
|
static java.lang.String |
getRptName(javax.servlet.http.HttpServletRequest request)
Gets the report name from the request.
|
static java.lang.String |
getRptSetId(javax.servlet.http.HttpServletRequest request)
Gets the report set id from the request.
|
static boolean |
getSaveToPubDirPermission(java.lang.String userName,
java.lang.String rootpath)
Deprecated.
DHTMLUtil.getDirWritePermission.
Gets whether the user has the permission of saving reports to
the specified folder.
|
static java.lang.String |
getSessionID(javax.servlet.http.HttpServletRequest request)
Gets the session id from the request.
|
static java.lang.String |
getStyleFilePath(java.lang.String styleName) |
static java.lang.String[][] |
getStyleList() |
static TocPageMgr |
getTocPageMgr(Communicator comm) |
static java.lang.String |
getURLForCatalogReferedFile(java.lang.String sessionID,
ExResourceManager manager,
java.lang.String uid,
java.lang.String catalogName,
java.lang.String catalogReferName,
int versionNumber)
Deprecated.
|
static java.lang.String |
getUserName(javax.servlet.http.HttpServletRequest request)
Gets the current session user name.
|
static UserSession |
getUserSession(javax.servlet.http.HttpServletRequest request)
Gets a UserSession instance from the request.
|
static java.lang.String |
getVersionFile(java.lang.String userId,
java.lang.String fileName) |
static java.lang.String |
getWebAppUrl(javax.servlet.http.HttpServletRequest request,
java.lang.String webAppName)
Gets web application URL.
|
static java.lang.String |
getWebContextPath(java.lang.String dhtmlCtxPath)
Gets the DHTML context path (not including "/").
|
static java.lang.String |
getWebPath(java.lang.String oriPath) |
static java.util.ArrayList[] |
IdentifyDirArrayList(java.lang.String userName,
java.lang.String rootpath)
Gets the sorted folders of the specified resource.
|
static int |
indexOf(int[] list,
int target) |
static int |
indexOf(java.lang.String[] list,
java.lang.String target) |
static boolean |
isChrome(javax.servlet.http.HttpServletRequest request)
Gets whether the browser is chrome.
|
static boolean |
isResourceNode(java.lang.String userName,
java.lang.String path)
Whether the specified path is resource node.
|
static boolean |
isRMIEnv(javax.servlet.http.HttpServlet servlet)
Gets whether the environment is RMI.
|
static java.lang.String |
msg(int key)
Gets the error message according to the specified id.
It is for NLS support, the id and the message can be seen in %serverhome%/resources/server/languages/en/properties/dhtml.properties. |
static java.lang.String |
msg(int key,
java.lang.Object arg)
Gets the error message according to the specified id.
It is for NLS support, the id and the message can be seen in %serverhome%/resources/server/languages/en/properties/dhtml.properties. |
static java.util.Vector |
parseWord(java.lang.String sentence,
char separator,
char escape)
Deprecated.
jet.util.expression.ExpressionUtil.parseStringValue. From V9.
Parses the specified sentence to words.
An example of the method:
An example of the method:
|
static java.lang.String |
removePathInfo(java.lang.String name) |
static java.lang.String |
replaceAllString(java.lang.String src,
java.lang.String patten,
java.lang.String replacement)
Replaces every subsequence of the input sequence that matches the pattern
with the given replacement string.
|
static java.util.Map |
runReport(javax.servlet.http.HttpServletRequest request,
java.util.Map runParams)
Runs a report set.
|
static java.lang.String |
scriptBegin(boolean isNoFrame_ConnectPage)
Gets the script start string.
|
static java.lang.String |
scriptEnd(boolean isNoFrame_ConnectPage)
Gets the script end string.
|
static void |
SendRedirect(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String fileName) |
static void |
sendToErrorpage(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Throwable t,
boolean needOpen,
boolean needClear)
Deprecated.
WebActionLogic.sendToErrorpage.
|
static void |
setCurrentLanguage(javax.servlet.http.HttpServletRequest request) |
static void |
setForTestLoadRunner(java.lang.String sessionId) |
static void |
setRptSetIdForTest(java.lang.String sessionId,
java.lang.String rptSetId) |
static java.lang.String[][] |
sortArray(java.lang.String[][] array,
int sortType)
Sorts a two-dimensional string array according to the specified sort
order.
|
static java.lang.String[] |
sortArray(java.lang.String[] array,
int sortType)
Sorts a string array according to the specified sort order.
|
static java.lang.String |
toHtmlString(java.lang.String src)
Gets the HTML string of the specified string.
Such as '\"' to """, '<' to "<". |
static java.lang.String |
toHtmlString(java.lang.String src,
boolean noSingleQuotes)
Gets the HTML string of the specified string.
Such as '\"' to """, '<' to "<". |
static java.lang.String |
toJSON(java.util.Hashtable ht)
Gets the Script string of the specified parameters.
|
static java.lang.String |
toJSON(java.lang.String[] array)
Gets the Script string of the specified parameters.
|
static java.lang.String |
toScriptString(java.lang.String oriStr)
Gets the Script string of the specified string.
Such as '\'' to "\\\\'", "'" to "\\\\'". |
static java.lang.String |
toString(int[] arr) |
static java.lang.String |
toString(int[][] arr) |
static java.lang.String |
unescape(java.lang.String str) |
static java.lang.StringBuffer |
writeCommonCSS(java.lang.String strDivID,
boolean notag) |
static java.lang.String |
writeToolBarBtnHTML(java.lang.String[] item,
java.lang.String strEvent)
Gets the HTML string of the button in the toolbar.
|
static boolean |
zip(java.lang.String zipfilename,
java.util.List<java.io.File> filesList) |
public static JSONObject getDateSymbols(javax.servlet.http.HttpServletRequest request)
request
- public static java.lang.String buildRuntimeID(java.lang.String SessionID, java.lang.String RptSetId, java.lang.String RptName)
sessionId
- the user session id.rptSetId
- the report set id.rptName
- the report name.public static java.lang.String getErrorMsg(int checkCode, java.lang.String language)
checkCode
- the key of the information code generated after the report set
has been run.language
- the language.public static java.lang.String getReportRealPath(java.lang.String userId, java.lang.String fileName)
userId
- the user name.fileName
- the relative path and name of the report set.public static java.lang.String getRptSetId(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest.public static java.lang.String getRptName(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest.public static java.lang.String GetPID(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getSessionID(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest.public static UserSession getUserSession(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest.jet.server.api.UserSession.
public static java.util.Map runReport(javax.servlet.http.HttpServletRequest request, java.util.Map runParams) throws JDException
request
- HttpServletRequest.runParams
- the additional information for running the report set.JDException
jet.web.dhtml.WebActLogic.runReport.
public static java.util.Hashtable getParameters(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest.public static boolean forTestSession(javax.servlet.http.HttpServletRequest request)
public static void setRptSetIdForTest(java.lang.String sessionId, java.lang.String rptSetId)
sessionId
- the user session id.rptSetId
- the report set id.public static void setForTestLoadRunner(java.lang.String sessionId)
sessionId
- the user session id.public static boolean isChrome(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest.public static int GetBrowserType(java.lang.String userAgent)
public static int getBrowserType(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest.public static boolean isRMIEnv(javax.servlet.http.HttpServlet servlet)
servlet
- HttpServlet.public static java.lang.String[] sortArray(java.lang.String[] array, int sortType)
array
- a string array.sortType
- the sort order type which is defined in DHTMLConstant:public static java.lang.String[][] sortArray(java.lang.String[][] array, int sortType)
array
- a two-dimensional string array.sortType
- the sort order type which is defined in DHTMLConstant:public static java.lang.String getWebAppUrl(javax.servlet.http.HttpServletRequest request, java.lang.String webAppName)
request
- HttpServletRequest.webAppName
- the web application name.jet.server.api.http.HttpUtil.getWebAppUrl.
public static java.lang.String scriptBegin(boolean isNoFrame_ConnectPage)
An example of the method:
isNoFrame_ConnectPage
- whether the current page is the connecting page.public static java.lang.String scriptEnd(boolean isNoFrame_ConnectPage)
An example of the method:
isNoFrame_ConnectPage
- whether the current page is the connecting page.public static java.lang.String clearHtml(java.lang.String str)
request
- HttpServletRequest.runParams
- the report parameters.JDException
- public static Hashtable parseOpenRptParams(HttpServletRequest
request, Map runParams) throws JDException { Hashtable params
= new Hashtable(); try { String RptSetId = null; String
reportName = null; String catalogFile = null;
String hasStyle = null; String styleGroup = null; String
recordNumstr = "-1"; hasStyle =
request.getParameter(APIConst.TAG_HAS_STYLE); styleGroup =
request.getParameter(APIConst.TAG_STYLE_GROUP);
// recordNumstr = request.getParameter(APIConst.);
DHTMLClientService service = DHTMLServiceFactory
.getDHTMLClientService(request); // if(JDLog.isAd())
JDLog.print("hasStyle=[" + hasStyle + "]"); //
if(JDLog.isAd()) JDLog.print("styleGroup=[" + styleGroup +
"]"); if (hasStyle != null &&
hasStyle.equalsIgnoreCase("true")) {
params.put(EngineConstant.STYLE_GROUP, styleGroup); } //
else{ // params.put(EngineConstant.STYLE_GROUP, "None"); // }
if (runParams != null) { RptSetId = (String)
runParams.get(DHTMLConstant.RPTSET_ID); reportName = (String)
runParams.get(APIConst.TAG_REPORT); catalogFile = (String)
runParams .get(DHTMLConstant.CATALOG_NAME); if (catalogFile
== null) { catalogFile = (String)
runParams.get(APIConst.TAG_CATALOG); } } if (RptSetId ==
null) { RptSetId =
request.getParameter(DHTMLConstant.RPTSET_ID); } if (RptSetId
== null) { RptSetId = (String) request
.getAttribute(DHTMLConstant.RPTSET_ID); } if (reportName ==
null) { reportName =
request.getParameter(APIConst.TAG_REPORT); } if (catalogFile
== null) { catalogFile =
request.getParameter(APIConst.TAG_CATALOG); } String
translate = request.getQueryString(); if (translate != null
&& reportName == null && catalogFile == null &&
translate.indexOf(".cat") > 0 && translate.indexOf(".cls") >
0) { int catindex = translate.indexOf(".cat"); int clsindex =
translate.indexOf(".cls"); if (catindex > 0 && catindex <
clsindex) { catalogFile = translate.substring(0, catindex +
4); int tmpindex = catalogFile.lastIndexOf('/'); if (tmpindex
> 0 && tmpindex < catindex) { reportName =
catalogFile.substring(0, tmpindex + 1); reportName +=
translate.substring(catindex + 5, clsindex + 4); } } else if
(clsindex > 0 && catindex > clsindex) { reportName =
translate.substring(0, clsindex + 4); int tmpindex =
reportName.lastIndexOf('/'); if (tmpindex > 0 && tmpindex <
clsindex) { catalogFile = reportName.substring(0, tmpindex +
1); catalogFile += translate.substring(clsindex + 5, catindex
+ 4); } } } if (reportName == null || catalogFile == null) {
translate = request.getPathInfo(); if (translate != null &&
translate.indexOf(".cls") != -1 && translate.indexOf(".cat")
!= -1) { String folderName = ""; String catName = ""; String
rptName = "";
String paramString = translate; int point =
paramString.length() - 1; char temp; while ((temp =
paramString.charAt(point)) != '/') { point--; rptName =
String.valueOf(temp) + rptName; } point--; while ((temp =
paramString.charAt(point)) != '/') { point--; catName =
String.valueOf(temp) + catName; } folderName =
paramString.substring(0, point); catalogFile = folderName +
"/" + catName; reportName = folderName + "/" + rptName; } }
// Comment: if the report is rsd, reportName is null, JReport
shouldn't // throw Exception // if(reportName == null){ //
throw new JDException(910080); // } // else if(catalogFile ==
null) // { // if(reportName.indexOf(".clx") == -1) // { //
throw new JDException(910080); // } // }
UserSession us = DHTMLUtil.getUserSession(request); String
rptPath = request.getParameter(APIConst.TAG_PATH);
String sessionId = us.getID(); String userName =
us.getUserID();
// String catVersion = //
request.getParameter(APIConst.TAG_CAT_VERSION); // String
rptVersion = //
request.getParameter(APIConst.TAG_RPT_VERSION);
String rptSheet =
request.getParameter(DHTMLConstant.RPTSHEET); String runSheet
= request.getParameter(APIConst.TAG_REPORT_SHEET + "$" +
rptSheet);
String useDefaultDBUser = request
.getParameter("default_use_default_ds_user"); String dbuser =
request.getParameter("default_user"); String dbpsw =
request.getParameter("default_pswd");
String encodeing = request
.getParameter(APIConst.TAG_REPORT_ENCODING); String
enableConvertEncode = request
.getParameter(APIConst.TAG_HAS_CONVERT_ENC); String
fromEncode = request
.getParameter(APIConst.TAG_FROM_ENCODING); String toEncode =
request.getParameter(APIConst.TAG_TO_ENCODING);
if (encodeing != null) params.put(EngineConstant.ENCODING,
encodeing); if (enableConvertEncode != null &&
enableConvertEncode.equalsIgnoreCase("true")) { if
(fromEncode != null) params
.put(EngineConstant.CONVERT_FROM_ENCODING, fromEncode); if
(toEncode != null)
params.put(EngineConstant.CONVERT_TO_ENCODING, toEncode); }
if (useDefaultDBUser != null &&
useDefaultDBUser.equalsIgnoreCase("false")) { Hashtable
dsUser = new Hashtable(); dsUser.put("default", new String[]
{ dbuser, dbpsw }); params.put(EngineConstant.USER_PASSWORD,
dsUser); }
int recordNum =
service.getDHTMLConfig().getRecordNumber(sessionId,
RptSetId); recordNumstr = String.valueOf(recordNum);
params.put(EngineConstant.LIMITED_RECORDS, recordNumstr);
String fromDesigner = request
.getParameter(DHTMLConstant.FROM_DESIGNER); if (fromDesigner
!= null) params.put(DHTMLConstant.FROM_DESIGNER,
fromDesigner);
if (runSheet != null && runSheet.equalsIgnoreCase("true"))
params.put(APIConst.TAG_REPORT_SHEET, rptSheet);
if (runParams != null && runParams.size() > 0) { Set keys =
runParams.keySet(); Iterator ikeys = keys.iterator(); while
(ikeys.hasNext()) { Object key = ikeys.next();
params.put(key, runParams.get(key)); }
// parse report parameters Properties p = new Properties();
String rptParams = (String) runParams
.get(DHTMLConstant.RUNRPTPARAMS); if (rptParams != null) {
rptParams = rptParams.trim(); rptParams += "&"; int
startindex = 0; int index = rptParams.indexOf("&",
startindex); String tmp, key, value; while (index != -1) {
tmp = rptParams.substring(startindex, index); startindex =
index + 1; index = rptParams.indexOf("&", startindex); if
(tmp != null && tmp.indexOf('=') != -1) { key =
tmp.substring(0, tmp.indexOf('=')); value =
tmp.substring(tmp.indexOf('=') + 1); p.setProperty(key,
value); } } } params.put(DHTMLConstant.PARAM_PROPERTIES, p);
} else { // is used by dhtml.jsp
// parse the report parameters Properties p = new
Properties(); for (Enumeration e =
request.getParameterNames(); e .hasMoreElements();) { String
temp = (String) e.nextElement(); if
(temp.startsWith(APIConst.TAG_PARAM_PREFIX)) {
p.setProperty(temp.substring(APIConst.TAG_PARAM_PREFIX
.length()), request.getParameter(temp)); } }
params.put(DHTMLConstant.PARAM_PROPERTIES, p); // comment by
// lyy for // compiler // error }
HttpRptServer httpRptServer = DHTMLHttpUtil
.getHttpRptServer(request); ExResourceManager rmgr =
(ExResourceManager) DHTMLHttpUtil
.getHttpRptServer(request).getResourceManager();
// is RSD File String rst_version =
request.getParameter(APIConst.TAG_RST_VERSION); if
(rst_version != null) { ResultVersionRecord rstVer; int
verNumber = Integer.parseInt(rst_version); ResultFiles files;
// if(reportName != null){ // rstVer =
rmgr.getResultVersion(userName, reportName, // verNumber); //
}else{ // rstVer = rmgr.getResultDocVersion(userName,
rptPath, // verNumber); // } // zhoubenkun: modify it based
on hou yongkang's Bug23092 and // Bug23405 String versionId =
request .getParameter(APIConst.TAG_VERSION_ID); if (versionId
!= null) { rstVer = rmgr.getResultVersionByNodeID(versionId);
} else if (reportName != null) { rstVer =
rmgr.getResultVersion(userName, reportName, verNumber);
DHTMLUtil.BuildInVersion = true; } else { reportName =
request.getParameter(APIConst.TAG_RESULT); rstVer =
rmgr.getResultDocVersion(userName, reportName, verNumber);
DHTMLUtil.ReportNameIfCannotGet = reportName;
DHTMLUtil.BuildInVersion = false; } if (rstVer == null) throw
new JDException(910077); Hashtable verHt =
rstVer.getAllReportResultFiles(); files = (ResultFiles)
verHt.get(APIConst.TAG_RSD_RESULT); if (files == null) {
files = (ResultFiles) verHt.get("jrs.report_result"); }
String RSDFileName = rmgr.getHistDir() +
files.getRsdFileName();
params.put(EngineConstant.RSD_FILE_NAME, RSDFileName); } else
{ // RSD enhancement String jrs_resource_path = request
.getParameter(DHTMLConstant.JRS_RESOURCE_PATH); String
jrs_file = request.getParameter(DHTMLConstant.JRS_FILE); if
(jrs_resource_path != null && jrs_file != null) { String
realPath = null; if (!jrs_resource_path.startsWith("/")) {
throw new Exception("resouce path " + jrs_resource_path +
" must begin with '/'."); } realPath =
rmgr.getRealPath(userName, jrs_resource_path); if (realPath
== null || realPath.trim().length() == 0) { String inDir =
jrs_resource_path; String fDir = ServerEnv.getResourceRoot();
if (fDir.endsWith(File.separator)) { fDir = fDir.substring(0,
fDir.length() - 1); } fDir = fDir + inDir.replace('/',
File.separator.charAt(0)); if
(!fDir.endsWith(File.separator)) { fDir += File.separator; }
File rstFold = new File(fDir); if (!rstFold.exists()) { throw
new Exception("path " + jrs_resource_path +
" does not exist."); } } else { if
(!realPath.endsWith(File.separator)) { realPath +=
File.separator; } } //
System.err.println("RSD file::"+realPath + jrs_file);
params.put(EngineConstant.RSD_FILE_NAME, realPath +
jrs_file); } else { PathInfo pathinfo = null; String catPath
= null; if (catalogFile != null) { String vernumstr = request
.getParameter(APIConst.TAG_CAT_VERSION); // String
pathinfostr = ""; int vernum = -1; if (vernumstr == null ||
vernumstr.trim().equals("") || APIUtil.parseInt(vernumstr,
-1) == -1) { pathinfo = rmgr.getPathInfo(userName,
catalogFile); catPath = pathinfo.getPath(); } else { vernum =
Integer.parseInt(vernumstr); catPath =
rmgr.getPathInfo(userName, catalogFile) .getPath();//
.getPathInfo(userName, // catalogFile);
} // bug 26618 // if(catPath != null){ //
params.put(EngineConstant.CAT_NAME, catPath); // } //
params.put(DHTMLConstant.CATALOG_NAME, catalogFile); //
//majx if (reportName != null &&
!reportName.trim().toLowerCase().endsWith( ".clx") && catPath
!= null) { params.put(DHTMLConstant.CATALOG_NAME,
catalogFile); // majx // params.put(EngineConstant.CAT_NAME,
catPath); // TODO feature 44915
if (RptSetId == null) { RptSetId =
service.createReportSetId(); }
ResourceKit.putOpenRptDependentInfo(catPath, vernum,
userName, false, RptSetId, params); } }
String reportPath = null; if (reportName != null) { pathinfo
= rmgr.getPathInfo(userName, reportName); if (pathinfo !=
null) { reportPath = pathinfo.getRealPath(); // ZhangShiwei's
request for handling old path if
(service.isOldReport(reportPath)) reportPath =
service.convertingOldReport( catPath, reportPath);
params.put(EngineConstant.RPT_SET_NAME, reportPath); } } } }
String serverHost = request.getServerName(); String
serverPort = String.valueOf(request.getServerPort()); String
serverScheme = request.getScheme();
params.put(DHTMLConstant.SERVERHOST, serverHost);
params.put(DHTMLConstant.SERVERPORT, serverPort);
params.put(DHTMLConstant.SERVERSCHEME, serverScheme);
// params.put(EngineConstant.STYLE_GROUP, "");
params.put(EngineConstant.SINGLE_THREAD, ServerEnv
.getEngineSingleThread() + "");
if (reportName != null) {
params.put(DHTMLConstant.REPORT_NAME, reportName); } else {
params.put(DHTMLConstant.REPORT_NAME, rptPath);// JINYUKUN
23111 }
params.put(DHTMLConstant.SESSION_ID, sessionId);
params.put(DHTMLConstant.USER_NAME, userName);
params.put(DHTMLConstant.BROWSER_TYPE,
String.valueOf(DHTMLUtil .getBrowserType(request)));
params.put(DHTMLConstant.ISEXTRA_CHANNEL, String
.valueOf(httpRptServer.getHttpUserSessionManager()
.isExtraChannel(request))); // is used by taglib or
runreportlet if (RptSetId == null) { RptSetId =
service.createReportSetId(); } if
(Boolean.valueOf(request.getParameter("forTestLoadRunner"))
.booleanValue()) { DHTMLUtil.setForTestLoadRunner(sessionId);
DHTMLUtil.setRptSetIdForTest(sessionId, RptSetId); }
params.put(EngineConstant.REPORT_ID, RptSetId);
Locale locale = request.getLocale(); if (locale == null) {
String langStr = request.getHeader("Accept-Language"); if
(langStr != null) { String[] temp =
langStr.split(",")[0].split("-"); if (temp.length == 2) {
locale = new Locale(temp[0], temp[1]); } else { locale = new
Locale(temp[0]); }
} else { locale = Locale.getDefault(); } }
params.put(DHTMLConstant.BROWSER_LOCALE, locale);
Vector vRptSheetNames = new Vector(); // add all parameters
which start with "jrs.", not including //
APIConst.TAG_PARAM_PREFIX Enumeration names =
request.getParameterNames(); while (names.hasMoreElements())
{ String name = (String) names.nextElement(); if (name !=
null && name.startsWith("jrs.") &&
!name.startsWith(APIConst.TAG_PARAM_PREFIX)) {
params.put(name, request.getParameter(name)); } if (name !=
null && name.startsWith(APIConst.TAG_REPORT_SHEET + "$") &&
Boolean.valueOf(request.getParameter(name)) .booleanValue())
{ rptSheet = name.substring(name
.indexOf(APIConst.TAG_REPORT_SHEET + "$") +
(APIConst.TAG_REPORT_SHEET + "$").length()); //
params.put(DHTMLConstant.RPTSHEET, rptSheet);
vRptSheetNames.add(rptSheet); } } if (vRptSheetNames.size() >
0) { params.put(APIConst.TAG_REPORT_SHEET, vRptSheetNames); }
return params; } catch (Exception ex) { //
ex.printStackTrace(System.err); throw new JDException(ex); //
Hashtable returnMap = new Hashtable(); //
returnMap.put(DHTMLConstant.DHTML_EXCEPTION, ex); // return
returnMap; } }Gets the parameters
needed for running a report by request.
public static java.lang.StringBuffer writeCommonCSS(java.lang.String strDivID, boolean notag) throws java.io.IOException
java.io.IOException
public static java.lang.String[][] buildDisplayNameListArray(java.lang.String[][] list)
public static java.util.Hashtable buildDisplayNameList(java.util.Hashtable displayName)
public static double getPageWidth(int pageType, int orientation)
An example of the method:
pageType
- the page type.orientation
- the page orientation:public static double getPageHeight(int pageType, int orientation)
An example of the method:
pageType
- the page type.orientation
- the page orientation:public static java.lang.String checkPDFDigitalIDFile(DHTMLClientService service, java.lang.String sessionId, java.lang.String dRptSetId, java.lang.String dRptName, byte[] byteArrayContent, java.io.InputStream is, java.lang.String password, boolean isNoFrame)
service
- sessionId
- dRptSetId
- dRptName
- byteArrayContent
- is
- password
- isNoFrame
- public static ExResourceManager getResourceManager()
An example of the method:
public static boolean isResourceNode(java.lang.String userName, java.lang.String path)
An example of the method:
userName
- the user name.path
- the resource path.public static VersionRecord addResource(java.lang.String userId, java.lang.String folderPath, byte nodetype, java.lang.String catalogname, java.lang.String nodename, java.lang.String versionPath, boolean enableLinkCatalogMode, boolean isLinkCatalogMode, java.lang.String decs) throws NoPrivilegeException, NodeExistsException, UnknownResource
userId
- the user name.folderPath
- the folder resource path.nodetype
- the node type.catalogname
- the catalog name.nodename
- the node name.versionPath
- the version path.enableLinkCatalogMode
- whether to enable linked catalog.isLinkCatalogMode
- whether it is linked catalog.desc
- the description.UnknownResource
NodeExistsException
NoPrivilegeException
public static VersionRecord addResultInReport(java.lang.String userId, java.lang.String rptName, java.lang.String rstName, java.lang.String versionPath, java.lang.String sessionId, java.lang.String rptSetId, java.lang.String rptId) throws NoPrivilegeException, UnknownResource
userId
- the user name.rptName
- the logical path of the report.rstName
- the result node name.resultPath
- the real path of result file.sessionId
- the user session id.rptSetId
- the report set id.rptId
- the report id.NoPrivilegeException
UnknownResource
public static VersionRecord addResultInReport(java.lang.String userId, java.lang.String rptName, java.util.Hashtable htRst, java.lang.String sessionId, java.lang.String rptSetId) throws UnknownResource, NoPrivilegeException
userId
- the user name.rptName
- the logical path of the report.htRst
- the necessary parameters.sessionId
- the user session id.rptSetId
- the report set id.UnknownResource
NoPrivilegeException
public static java.util.ArrayList getAllDirectory(java.lang.String userName, java.lang.String rootpath) throws JDException
userName
- the user name.rootpath
- the resource path root.JDException
public static java.util.ArrayList[] IdentifyDirArrayList(java.lang.String userName, java.lang.String rootpath) throws JDException
An example of the method:
userName
- the user name.rootpath
- the resource path.JDException
public static boolean getSaveToPubDirPermission(java.lang.String userName, java.lang.String rootpath) throws JDException
userName
- the user name.rootpath
- the resource path.JDException
public static boolean getDirWritePermission(java.lang.String userName, java.lang.String rootpath) throws JDException
An example of the method:
userName
- the user name.rootpath
- the resource path.JDException
public static java.util.ArrayList getAllReports(java.lang.String userName, java.lang.String rootpath) throws JDException
An example of the method:
userName
- the user name.rootpath
- the resource path.JDException
public static java.util.Vector getAllReportsOnlyInRootPath(java.lang.String userName, java.lang.String rootpath) throws JDException
userName
- the user name.rootpath
- the resource path.JDException
public static java.lang.String getVersionFile(java.lang.String userId, java.lang.String fileName)
userId
- the user name.fileName
- the report version file name passed topublic static java.lang.String removePathInfo(java.lang.String name)
public static java.lang.String getURLForCatalogReferedFile(java.lang.String sessionID, ExResourceManager manager, java.lang.String uid, java.lang.String catalogName, java.lang.String catalogReferName, int versionNumber) throws JDException
sessionID
- manager
- uid
- catalogName
- catalogReferName
- versionNumber
- JDException
public static java.lang.String escapeQuotation(java.lang.String src)
public static java.lang.String toHtmlString(java.lang.String src)
src
- the original string.public static java.lang.String toHtmlString(java.lang.String src, boolean noSingleQuotes)
An example of the method:
src
- the original string.noSingleQuotes
- whether to convert the single quote.
If false, '\'' will be "'", otherwise, no change.public static java.lang.String toScriptString(java.lang.String oriStr)
An example of the method:
oriStr
- the original string.public static java.util.Vector parseWord(java.lang.String sentence, char separator, char escape) throws java.text.ParseException
An example of the method:
An example of the method:
sentence
- the specified sentence.separator
- the separator char.escape
- the escape char.java.text.ParseException
public static java.util.List convertItemIdToIndex(java.util.List aList, java.util.List aAvailist)
public static boolean zip(java.lang.String zipfilename, java.util.List<java.io.File> filesList)
public static java.lang.String writeToolBarBtnHTML(java.lang.String[] item, java.lang.String strEvent)
An example of the method:
item
- the button item information:strEvent
- the button event string, such as "onclick=clickAct();".public static java.lang.String getUserName(javax.servlet.http.HttpServletRequest request)
An example of the method:
request
- HttpServletRequest.public static java.lang.String msg(int key, java.lang.Object arg)
key
- the error id.arg
- the value you replace the error message necessary parameter
such as \\"{0}\\", 1000114=Page report \\"{0}\\" already
exists. Create a new version of this page report?public static java.lang.String msg(int key)
An example of the method:
key
- the error id.public static java.lang.String GenerateMessages(PropertyMessageResourcesFactory msgFactory)
public static java.lang.String unescape(java.lang.String str)
An example of the method:
- %serverhome%/public_html/dhtmljsp/searchdialog.jsp.
public static java.lang.String escape(java.lang.String str)
An example of the method:
str
- String to be translated.public static java.lang.String get_filter_StringValue_fromeUI(java.lang.String str, boolean isUserInput) throws java.io.UnsupportedEncodingException
str
- isUserInput
- whether the current value is input by user -- not used.java.io.UnsupportedEncodingException
DHTMLUtil.unescape.
public static java.lang.String decode(java.lang.String str)
An example of the method:
str
- the String to decode.public static java.lang.String getContentFromUrl(java.lang.String url)
public static JException getOriginalJException(JException jrex)
An example of the method:
jrex
- the exception.public static char[] copyText(java.lang.String filePath) throws java.io.IOException
java.io.IOException
public static char[] copyText(java.io.File file) throws java.io.IOException
java.io.IOException
public static byte[] copyOctet(java.lang.String filePath) throws java.io.IOException
java.io.IOException
public static byte[] copyOctet(java.io.File file) throws java.io.IOException
java.io.IOException
public static void sendToErrorpage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Throwable t, boolean needOpen, boolean needClear)
request
- response
- t
- needOpen
- needClear
- public static java.lang.Throwable[] getAllDHTMLExceptions(javax.servlet.http.HttpServletRequest request)
An example of the method:
request
- HttpServletRequest.public static java.lang.Throwable[] getAllDHTMLExceptions(java.lang.String pid, java.lang.String rptsetid)
public static int getMapFunctionValue(java.lang.String name)
public static java.lang.String replaceAllString(java.lang.String src, java.lang.String patten, java.lang.String replacement)
src
- the input sequence.patten
- the expression to be compiled.replacement
- the replacement string.public static java.lang.String getCatalogName(java.lang.String userName, java.lang.String resourcePath)
userName
- the user name.resourcePath
- the relative path of the catalog resources.public static java.lang.String getWebPath(java.lang.String oriPath)
public static java.lang.String getWebContextPath(java.lang.String dhtmlCtxPath)
dhtmlCtxPath
- the original DHTML context path.public static java.lang.String toString(int[] arr)
public static java.lang.String toString(int[][] arr)
public static void setCurrentLanguage(javax.servlet.http.HttpServletRequest request)
public static java.lang.String convertArrayToJSArray(java.lang.String[] array)
An example of the method:
array
- the specified string array.public static java.lang.String convertArrayToJSArray(java.lang.String[][] array)
An example of the method:
array
- the specified two-dimensional string array.public static java.lang.String getActionOpName(int op)
op
- the specified int.public static long getBackgroundTimeOut(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest.public static int convertInchToPt(double size)
size
- public static java.lang.String getPreferenceValue(javax.servlet.http.HttpServletRequest request, java.lang.String preferenceKey)
request
- HttpServletRequest.preferenceKey
- the preference key.public static java.lang.String getStyleFilePath(java.lang.String styleName)
styleName
- the style name.public static java.lang.String getDefaultToolbarItems(DHTMLConfig dhtmlConfig, java.lang.String SessionID, java.lang.String RptSetId)
An example of the method:
dhtmlConfig
- SessionID
- the user session id.RptSetId
- the report set id.DHTMLConfig.
public static java.lang.String getDefaultCompStyle(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest.public static java.lang.String toJSON(java.util.Hashtable ht)
An example of the method:
ht
- the specified parameters.public static java.lang.String toJSON(java.lang.String[] array)
array
- the specified parameters.public static int indexOf(java.lang.String[] list, java.lang.String target)
list
- the specified array.target
- the specified string.-1
.public static int indexOf(int[] list, int target)
list
- the specified array.target
- the specified int.-1
.public static java.lang.String[][] getStyleList()
public static void SendRedirect(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String fileName) throws java.io.IOException
java.io.IOException
public static HttpRptServer getHttpRptServer(javax.servlet.http.HttpServletRequest request)
public static TocPageMgr getTocPageMgr(Communicator comm) throws JRStopEngineException
JRStopEngineException