|
|||||||||
| 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,
send message to client and change password etc.
| Field Summary | |
|---|---|
static java.lang.String |
CONTENT_LOCATION
|
static java.lang.String |
PROP_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)
Change the password of a user. |
static java.lang.String |
decodeEsc(java.lang.String str)
Decode the URL-encoded string(i.e. |
static boolean |
dirIncludeCatalog(HttpRptServer httpRptServer,
java.lang.String user,
java.lang.String path)
judge if the resource dir includ catalog. |
static boolean |
dirIncludeReport(HttpRptServer httpRptServer,
java.lang.String user,
java.lang.String path)
judge if the resource dir includ report. |
static java.lang.String |
encodeEsc(java.lang.String str)
Encode the URL string(i.e. |
static java.lang.String |
encodeEsc(java.lang.String str,
boolean encodeSlash)
Encode the URL string(i.e. |
static java.util.Properties |
getParameters(HttpServletRequest req)
Gets the parameter values from the HttpServletRequest object. |
static int |
getResultType(java.lang.String strResultType,
int defaultType)
|
static java.lang.String |
getTempResultKey(java.lang.String tempResult)
Get the key of a temp result to register the owner of the temp result. |
static boolean |
hasPageSecurity(java.lang.String resultVersionFile)
|
static boolean |
isClientAPI(HttpServletRequest req,
java.util.Hashtable ht)
Check if the request comes from a JRClient API. |
static boolean |
isJRClient(HttpServletRequest req,
java.util.Hashtable ht)
Check if the request comes from a JReport client(i.e. |
static java.lang.String |
makeQuery(java.util.Hashtable ht)
return query string by the keys, and values in the specified hashtable without a question mark(?). |
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)
Parse a HTTP query string into a Properties object. |
static void |
redirect(HttpServletResponse res,
java.io.PrintWriter writer,
java.lang.String location,
java.lang.String locationPrompt)
Send a redirection page to the client. |
static void |
sendMessage(HttpServletRequest req,
HttpServletResponse res,
int retcode,
java.lang.String msg)
Send a response including a message to the client. |
static void |
sendMessage(HttpServletRequest req,
HttpServletResponse res,
int retcode,
java.lang.Throwable thrwb)
Send a response including infomation 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.util.Properties getParameters(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 encodeEsc(java.lang.String str)
str - the URL address string.
public static boolean dirIncludeCatalog(HttpRptServer httpRptServer,
java.lang.String user,
java.lang.String path)
path - is the path of resource dir.
public static boolean dirIncludeReport(HttpRptServer httpRptServer,
java.lang.String user,
java.lang.String path)
path - is the path of resource dir.
public static java.lang.String encodeEsc(java.lang.String str,
boolean encodeSlash)
str - the URL address string.encodeSlash - indicates if to convert the slash '/' character.
public static void sendMessage(HttpServletRequest req,
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(HttpServletRequest req,
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(HttpServletRequest req,
java.util.Hashtable ht)
req - the HttpServletRequest.ht - the HTTP query fields.
return if the request comes from a JReport client(i.e. the JRViewerBean, JREntViewer and JRClient API).
public static boolean isClientAPI(HttpServletRequest req,
java.util.Hashtable ht)
req - the HttpServletRequest.ht - the HTTP query fields.
return if the request comes from a JRClient API.public static java.lang.String getTempResultKey(java.lang.String tempResult)
tempResult - the temp result.
public static void redirect(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 redirect to.locationPrompt - the location prompt in the page.
java.io.IOException - if a 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 a IOException occurs.
public static int getResultType(java.lang.String strResultType,
int defaultType)
public static boolean hasPageSecurity(java.lang.String resultVersionFile)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||