|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjet.server.api.http.BaseHttpUtil
jet.server.api.http.HttpUtil
public class HttpUtil
Class HttpUtil provides some static methods to create the
HTTPRptServer, send message to client and change password etc.
| Field Summary |
|---|
| Fields inherited from class jet.server.api.http.BaseHttpUtil |
|---|
CONTENT_LOCATION, PROP_OUTPUT_ENCODING |
| Method Summary | |
|---|---|
static boolean |
checkAdminLogin(HttpServletRequest req,
HttpServletResponse res)
Check if the user is a admin user. |
static boolean |
checkLogin(HttpServletRequest req,
HttpServletResponse res)
Do login if the HttpServletRequest has the login infomation. |
static boolean |
checkPermission(HttpServletRequest req)
Test if the user has the permission of the action for the resource in the server. |
static void |
copyFilesByPrefix(java.lang.String srcDir,
java.lang.String srcPrefix,
java.lang.String destDir,
java.lang.String destPrefix)
Copy files from a directory to another directory, source files are begin with prefix specify by srcPrefix and "_" or "." follows prefix, and destination files are begin with prefix specify by destPrefix and "_" or "." follows prefix; |
static java.lang.String |
filterXSS(java.lang.String oldVal)
|
static boolean |
getAdHoc()
get if AdHoc feature is enabled. |
static java.lang.String |
getAdhocJspPath()
Get adhoc jsp path |
static java.lang.String |
getAdhocServletPath()
Get adhoc servlet path |
static java.lang.String |
getAuthScheme()
Get the scheme of authentication initialed by initEnv(..). |
static long |
getAutoRecoverTaskInterval()
|
static int |
getAutoRecoverTaskMaxTimes()
|
static boolean |
getAutoRecoverTaskRedoAll()
|
static java.lang.String |
getBase(HttpServletRequest req,
boolean convertEscapeForServletPath)
Get the path of HttpServletRequest, including the servlet path. |
static java.lang.String |
getBaseNoPath(HttpServletRequest req,
boolean convertEscapeForServletPath)
Get the servlet path. |
static java.lang.String |
getDefaultDoc()
Get the home page of JReport Enterprise Server initialed by initEnv(..). |
static java.lang.String |
getHostAddress(java.lang.String hostName)
|
static HttpRptServer |
getHttpRptServer()
Get the HttpRptServer object created by initEnv(...). |
static java.lang.String |
getHttpURL()
Gets the current Http prefix. |
static java.lang.String |
getJRServletPath()
Get jreport servlet path |
static java.lang.String |
getJspUri(HttpServletRequest request,
java.lang.String jspPath)
|
static java.lang.String |
getJSPWebAppName(java.lang.String propname)
get jsp webapp name from (bin\server.properties) |
static java.util.List |
getLanguageList()
get the supported language list. |
static java.lang.String |
getLogInfoAfterService(ServletRequest _req,
ServletResponse _res)
Get the debug info related to a ServletResponse object for the access.log. |
static java.lang.String |
getLogInfoBeforeService(ServletRequest _req,
ServletResponse _res)
Get the debug info related to a ServletRequest object for the access.log. |
static java.lang.String |
getOndemandJspUri(HttpServletRequest request)
|
static int |
getOndemandTaskInitPriority()
|
static java.lang.String |
getProductLicense()
get license of server product |
static java.lang.String |
getProductSystemInfo()
get system information of server product |
static java.lang.String |
getProductSystemProp()
get system properties of server product |
static java.lang.String |
getProductVersionInfo()
get version information of server product |
static java.lang.String |
getQueryBase(HttpServletRequest req,
boolean convertEscapeForServletPath)
Get the path of HttpServletRequest, including the servlet path for making HTTP query string. |
static java.lang.String |
getQueryBaseNoPath(HttpServletRequest req,
boolean convertEscapeForServletPath)
Get the servlet path for making HTTP query string. |
static java.lang.String |
getRealmDir()
Get directory for realm files on server. |
static RemoteFileService |
getRemoteFileService()
get the RemoteFileService |
static long |
getReportWaitTimeouts()
Get the timeouts of waiting report in millisecond. |
static int |
getScheduleTaskInitPriority()
|
static java.lang.String |
getServletPath(HttpServletRequest req)
Get the servlet path. |
static java.util.Properties |
getUploadFileProperties(HttpServletRequest req,
java.lang.String tempDir)
uploading and unzipping zipped files and get relevant properties of the files. |
static java.util.Properties |
getUploadFileProperties(HttpServletRequest req,
java.lang.String tempDir,
boolean isZip)
uploads and gets relevant properties of the files. |
static java.lang.String |
getUser(HttpServletRequest req)
Get the user ID related to a HttpServletRequest object. |
static java.lang.String |
getValidMonitoringURL()
Get the currently valid and active monitoring web url entry. |
static java.lang.String |
getValidMonitoringURL(java.lang.String host,
java.lang.String port)
|
static java.lang.String |
getWebAppUrl(HttpServletRequest req,
java.lang.String appName)
Get the url of given web app name, base on provided HttpServletRequest object. |
static void |
initEnv(java.util.Properties props)
Create and initialize the HttpRptServer object with the initial parameters. |
static boolean |
isEnableDynamicResource()
Tell whether resource from real path is enabled |
static boolean |
isEnableMonitorLink()
|
static boolean |
isEnableTaskDuration()
Tell whether enable task duration |
static boolean |
isPipeline()
if support pipeline for try-view reports |
static boolean |
isPublishTempToVersion()
Tell whether publish temp result to version system is enabled |
static boolean |
isPublishTempToVersion(java.lang.String filename)
|
static boolean |
isRemoteServer()
check whether a remote server |
static boolean |
isSecure()
Check if server needs checking security. |
static boolean |
isShowNameWithPostfix()
get a fag from (bin\server.properties) to show name with or without extension names |
static boolean |
isShowVersionParamContents()
if show contents of parameter files in version table |
static boolean |
isStandaloneServer()
check whether server is at integrated environment |
static boolean |
isValidMonitoringURL(java.lang.String sURL)
|
static boolean |
isValidMonitoringURL(java.lang.String sURL,
java.lang.String host,
java.lang.String port)
|
static void |
logout(HttpServletRequest req)
|
static void |
processPartialRequest(HttpServletRequest req,
HttpServletResponse res,
java.io.File file,
java.util.Hashtable ht)
|
static void |
restartServer()
Restart the HttpRptServer. |
static void |
sendFile(HttpServletRequest req,
HttpServletResponse res,
java.io.File file)
Send a file to the client. |
static void |
sendRemoteFile(HttpServletRequest req,
HttpServletResponse res,
java.lang.String filename)
send a file to a remote end. |
static void |
shutdownServer()
Shutdown the HttpRptServer. |
static void |
updateServletPaths(ServletContext context,
HttpServletRequest request)
Update servlet paths in server.properties automatically, these servlet paths are used to indicate exactly servlet path for every servlet in JReport Server, e.g. |
static java.util.Properties |
uploadSkinFile(HttpServletRequest req,
java.lang.String tempDir)
uploading single unzipped file and specify the file name. |
static boolean |
useRelativeWebAppUrl()
Indicates use relative path or absolute path when get a web app url. |
| Methods inherited from class jet.server.api.http.BaseHttpUtil |
|---|
changePassword, decodeEsc, dirIncludeCatalog, dirIncludeReport, encodeEsc, encodeEsc, getParameters, getResultType, getTempResultKey, hasPageSecurity, isClientAPI, isJRClient, makeQuery, outputHtmlTableHeader, parseQuery, redirect, sendMessage, sendMessage |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void initEnv(java.util.Properties props)
props - properties of the server. The property "reporthome" must be
set. Other properties are optional. The properties are:
public static boolean isRemoteServer()
public static RemoteFileService getRemoteFileService()
RemoteFileService
public static HttpRptServer getHttpRptServer()
public static java.lang.String getAuthScheme()
initEnv(Properties props).public static java.lang.String getDefaultDoc()
initEnv(Properties props).
public static java.lang.String getBase(HttpServletRequest req,
boolean convertEscapeForServletPath)
For example:
req - the HttpServletRequest.convertEscapeForServletPath - indicates if to convert convert escape chars for the servlet
path.
public static java.lang.String getBaseNoPath(HttpServletRequest req,
boolean convertEscapeForServletPath)
For example:
req - the HttpServletRequest.convertEscapeForServletPath - indicates if to convert convert escape chars for the servlet
path.
public static java.lang.String getQueryBase(HttpServletRequest req,
boolean convertEscapeForServletPath)
For examples:
req - the HttpServletRequest.convertEscapeForServletPath - indicates if to convert convert escape chars for the servlet
path.
public static java.lang.String getQueryBaseNoPath(HttpServletRequest req,
boolean convertEscapeForServletPath)
For examples:
req - the HttpServletRequest.convertEscapeForServletPath - indicates if to convert convert escape chars for the servlet
path.
public static java.lang.String getUser(HttpServletRequest req)
req - the HttpServletRequest. return the user ID related to a
HttpServletRequest object.public static boolean isSecure()
public static void restartServer()
throws java.lang.Throwable
java.lang.Throwable - if a Throwable occurs.
public static void shutdownServer()
throws java.lang.Throwable
java.lang.Throwable - if a Throwable occurs.public static java.lang.String getHttpURL()
public static boolean checkLogin(HttpServletRequest req,
HttpServletResponse res)
throws TooManyUsersException,
java.io.IOException,
TooManyTimesException,
java.lang.RuntimeException,
NoRemoteServerException
req - the HttpServletRequest.res - the HttpServletResponse.
TooManyUsersException - if a TooManyUsersException occurs.
TooManyTimesException - if a TooManyTimesException occurs.
java.io.IOException - if a IOException occurs.
java.lang.RuntimeException
NoRemoteServerException
public static boolean checkAdminLogin(HttpServletRequest req,
HttpServletResponse res)
throws TooManyUsersException,
java.io.IOException,
TooManyTimesException,
java.lang.RuntimeException,
NoRemoteServerException
req - the HttpServletRequest.res - the HttpServletResponse.
TooManyUsersException - if a TooManyUsersException occurs.
TooManyTimesException - if a TooManyTimesException occurs.
java.io.IOException - if a IOException occurs.
java.lang.RuntimeException
NoRemoteServerExceptionpublic static void logout(HttpServletRequest req)
public static boolean checkPermission(HttpServletRequest req)
throws NoPrivilegeException
req - the HttpServletRequest.
NoPrivilegeException
public static void sendFile(HttpServletRequest req,
HttpServletResponse res,
java.io.File file)
throws java.io.IOException
req - the HttpServletRequest.res - the HttpServletResponse.file - the file.
java.io.IOException - if a IOException occurs.
public static void sendRemoteFile(HttpServletRequest req,
HttpServletResponse res,
java.lang.String filename)
throws java.io.IOException
req - the HttpServletRequest.res - the HttpServletResponse.file - the file.
java.io.IOException - if a IOException occurs.public static java.lang.String getServletPath(HttpServletRequest req)
req - the HttpServletRequest.
public static long getReportWaitTimeouts()
public static boolean isPublishTempToVersion()
public static boolean isPublishTempToVersion(java.lang.String filename)
public static boolean isEnableDynamicResource()
public static boolean isEnableTaskDuration()
public static void copyFilesByPrefix(java.lang.String srcDir,
java.lang.String srcPrefix,
java.lang.String destDir,
java.lang.String destPrefix)
throws java.lang.Exception
srcDir - source directorysrcPrefix - source file's prefixdestDir - destination file's directorydestPrefix - destination file's prefix
java.lang.Exception
public static void processPartialRequest(HttpServletRequest req,
HttpServletResponse res,
java.io.File file,
java.util.Hashtable ht)
throws java.lang.Exception
java.lang.Exceptionpublic static boolean isShowNameWithPostfix()
public static java.lang.String getJSPWebAppName(java.lang.String propname)
propname - the property name that record this webapp eg. propname
"jsp.webapp.sendfile" sendfile's webapp name
"\servlet\sendfile"public static boolean useRelativeWebAppUrl()
getWebAppUrl()
public static java.lang.String getWebAppUrl(HttpServletRequest req,
java.lang.String appName)
HttpServletRequest object. Return value is various,
depends on return value HttpUtil.useRelativeWebAppUrl(),
if it is true, return a url relate with provided req,
otherwise return absolute path of appName. for example:
appName is "/dhtml", the servlet path of req
is "/jinfonet/runReport.jsp", if
WebPageOptions.useRelativeWebAppUrl() return true,
this method return "../dhtml". otherwise return "/dhtml".
req - the HttpServletRequest objectappName - a web app name, for example: "/dhtml"
appName base on
provided request.useRelativeWebAppUrl()public static java.util.List getLanguageList()
public static boolean isPipeline()
public static boolean isShowVersionParamContents()
public static java.lang.String getProductVersionInfo()
public static java.lang.String getProductLicense()
public static java.lang.String getProductSystemInfo()
public static java.lang.String getAdhocServletPath()
public static java.lang.String getAdhocJspPath()
public static java.lang.String getJRServletPath()
public static boolean isEnableMonitorLink()
public static java.lang.String getProductSystemProp()
public static boolean getAdHoc()
public static java.lang.String getLogInfoBeforeService(ServletRequest _req,
ServletResponse _res)
req - the ServletRequest._res - the ServletResponse. return the debug info related to a
ServletRequest object for the access.log.
public static java.lang.String getLogInfoAfterService(ServletRequest _req,
ServletResponse _res)
req - the ServletRequest._res - the ServletResponse. return the debug info related to a
ServletResponse object for the access.log.
public static java.util.Properties uploadSkinFile(HttpServletRequest req,
java.lang.String tempDir)
throws java.io.IOException
req - the HttpServletRequest.tempDir - the temp directory for uploading.
java.io.IOException
public static java.util.Properties getUploadFileProperties(HttpServletRequest req,
java.lang.String tempDir)
throws java.io.IOException
req - the HttpServletRequest.tempDir - the temp directory for uploading and unzipping files return
relevant properties of the files
java.io.IOException
public static java.util.Properties getUploadFileProperties(HttpServletRequest req,
java.lang.String tempDir,
boolean isZip)
throws java.io.IOException
req - the HttpServletRequest.tempDir - the temp directory for uploading filesisZip - if the uploaded file is compressed. return relevant properties
of the files
java.io.IOExceptionpublic static boolean isStandaloneServer()
public static void updateServletPaths(ServletContext context,
HttpServletRequest request)
context root + servlet mapped path,
context root is gotten from parameter context,
servlet mapped path must be a constant string which
JReport Server has defined for each servlet. In server.properties, values
of below properties will be updated| Property Name | Servlet Mapped Path |
jsp.webapp.sendfile |
sendfile |
web.jreport_servlet_path |
jrserver |
web.dhtml_jsp_path |
dhtmljsp |
web.dhtml_servlet_entry_path |
jrdhtml |
web.dhtml_servlet_path |
dhtml |
web.help_servlet_path |
help |
context - the ServletContext which the current servlet
belongs torequest - the HttpServletRequest received in current
servlet.public static java.lang.String getRealmDir()
public static boolean isValidMonitoringURL(java.lang.String sURL,
java.lang.String host,
java.lang.String port)
public static boolean isValidMonitoringURL(java.lang.String sURL)
public static java.lang.String getValidMonitoringURL()
public static java.lang.String getValidMonitoringURL(java.lang.String host,
java.lang.String port)
public static java.lang.String getHostAddress(java.lang.String hostName)
public static int getAutoRecoverTaskMaxTimes()
public static long getAutoRecoverTaskInterval()
public static boolean getAutoRecoverTaskRedoAll()
public static java.lang.String getJspUri(HttpServletRequest request,
java.lang.String jspPath)
public static java.lang.String getOndemandJspUri(HttpServletRequest request)
public static java.lang.String filterXSS(java.lang.String oldVal)
public static int getOndemandTaskInitPriority()
public static int getScheduleTaskInitPriority()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||