|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjet.server.api.http.BaseHttpUtil
public class BaseHttpUtil
Class BaseHttpUtil provides some static methods to operate on request/response,
sending message to client and changing password etc.
| Field Summary | |
|---|---|
static java.lang.String |
CONTENT_LOCATION
Property used to specify content location. |
static java.lang.String |
PROP_OUTPUT_ENCODING
Property used to specify output encoding. |
| Method Summary | |
|---|---|
static java.lang.String |
changePassword(Authenticator authenticator,
java.lang.String realm,
java.lang.String submiter,
boolean isJRClient,
java.util.Hashtable ht)
Changes the password of a user. |
static java.lang.String |
decodeEsc(java.lang.String str)
Decodes the URL-encoded string i.e. |
static java.lang.String |
decodeEscapeEx(java.lang.String str)
|
static boolean |
dirIncludeCatalog(HttpRptServer httpRptServer,
java.lang.String user,
java.lang.String path)
Judges if the resource directory includes catalog. |
static boolean |
dirIncludeReport(HttpRptServer httpRptServer,
java.lang.String user,
java.lang.String path)
Checks if the resource directory includes report. |
static java.lang.String |
encodeEsc(java.lang.String str)
Encodes the URL string i.e. |
static java.lang.String |
encodeEsc(java.lang.String str,
boolean encodeSlash)
Encodes the URL string i.e. |
static java.util.Properties |
getParameters(javax.servlet.http.HttpServletRequest req)
Gets the parameter values from the HttpServletRequest object. |
static int |
getResultType(java.lang.String strResultType,
int defaultType)
Gets the int value of result type. |
static java.lang.String |
getTempResultKey(java.lang.String tempResult)
Gets the key of a temp result to register the owner of the temp result. |
static boolean |
hasPageSecurity(java.lang.String resultVersionFile)
Checks if the specified result version file has page level security. |
static boolean |
isClientAPI(javax.servlet.http.HttpServletRequest req,
java.util.Hashtable ht)
Checks if the request comes from a JRClient API. |
static boolean |
isJRClient(javax.servlet.http.HttpServletRequest req,
java.util.Hashtable ht)
Checks if the request comes from a JReport client such as the JRViewerBean, JReport Desktop Viewer and JRClient API. |
static java.lang.String |
makeQuery(java.util.Hashtable ht)
Returns query string by the keys and values in the specified hashtable without a question mark (?). |
static java.lang.String |
makeQueryWithout(java.util.Hashtable ht,
java.util.Map withoutSessionParameters)
Returns query string by the keys and values in the specified hashtable without session parameters. |
static void |
outputHtmlTableHeader(java.io.PrintWriter writer,
java.lang.String title,
java.lang.String[] colNames)
Deprecated. |
static java.util.Properties |
parseQuery(java.lang.String query)
Parses an HTTP query string into a Properties object. |
static void |
redirect(javax.servlet.http.HttpServletResponse res,
java.io.PrintWriter writer,
java.lang.String location,
java.lang.String locationPrompt)
Sends a redirection page to the client. |
static void |
sendMessage(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
int retcode,
java.lang.String msg)
Sends a response including a message to the client. |
static void |
sendMessage(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
int retcode,
java.lang.Throwable thrwb)
Sends a response including information of a Throwable object to the client. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PROP_OUTPUT_ENCODING
public static final java.lang.String CONTENT_LOCATION
| Method Detail |
|---|
public static java.lang.String makeQuery(java.util.Hashtable ht)
ht - keys and values' hashtable.
public static java.util.Properties parseQuery(java.lang.String query)
query - the HTTP query string.
public static java.lang.String makeQueryWithout(java.util.Hashtable ht,
java.util.Map withoutSessionParameters)
ht - keys and values' hashtable.
public static java.util.Properties getParameters(javax.servlet.http.HttpServletRequest req)
req - the HttpRequest object.
public static java.lang.String decodeEsc(java.lang.String str)
str - the URL-encoded string.
public static java.lang.String decodeEscapeEx(java.lang.String str)
public static java.lang.String encodeEsc(java.lang.String str)
str - the URL address string.
public static boolean dirIncludeCatalog(HttpRptServer httpRptServer,
java.lang.String user,
java.lang.String path)
httpRptServer - an HttpRptServer object.user - the user of the server.path - the path of the resource directory.
public static boolean dirIncludeReport(HttpRptServer httpRptServer,
java.lang.String user,
java.lang.String path)
httpRptServer - an HttpRptServer object.user - the specified user.path - the path of resource directory.
public static java.lang.String encodeEsc(java.lang.String str,
boolean encodeSlash)
str - the URL address string.encodeSlash - indicates whether to convert the slash '/' character.
public static void sendMessage(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
int retcode,
java.lang.String msg)
req - the HttpServletRequest.res - the HttpServletResponse.retcode - the HTTP status code.msg - the message in the response.
public static void sendMessage(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
int retcode,
java.lang.Throwable thrwb)
req - the HttpServletRequest.res - the HttpServletResponse.retcode - the HTTP status code.thrwb - the Throwable object.
public static java.lang.String changePassword(Authenticator authenticator,
java.lang.String realm,
java.lang.String submiter,
boolean isJRClient,
java.util.Hashtable ht)
throws java.io.IOException
authenticator - the Authenticator object(can get by using rptServer.getUserSessionManager().getAuthenticator()).realm - the realm.submiter - changes by the user ID.isJRClient - if come from JRClient.ht - properties about passwords info. The properties are:
java.io.IOException - if an IOException occurs.
public static boolean isJRClient(javax.servlet.http.HttpServletRequest req,
java.util.Hashtable ht)
req - the HttpServletRequest.ht - the HTTP query fields.
public static boolean isClientAPI(javax.servlet.http.HttpServletRequest req,
java.util.Hashtable ht)
req - the HttpServletRequest.ht - the HTTP query fields.
public static java.lang.String getTempResultKey(java.lang.String tempResult)
tempResult - the temp result.
public static void redirect(javax.servlet.http.HttpServletResponse res,
java.io.PrintWriter writer,
java.lang.String location,
java.lang.String locationPrompt)
throws java.io.IOException
res - the HttpServletResponse.writer - the PrintWriter.location - the location that is redirected to.locationPrompt - the location prompt in the page.
java.io.IOException - if an IOException occurs.
public static void outputHtmlTableHeader(java.io.PrintWriter writer,
java.lang.String title,
java.lang.String[] colNames)
throws java.io.IOException
writer - the PrintWriter.title - the title of the HTML table.colNames - the column names of the HTML table.
java.io.IOException - if an IOException occurs.
public static int getResultType(java.lang.String strResultType,
int defaultType)
strResultType - the type of the result.defaultType - the default type.
public static boolean hasPageSecurity(java.lang.String resultVersionFile)
resultVersionFile - the result version file that needs to check.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||