|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weblogic.html.WebPage | +--weblogic.html.ImagePage
An ImagePage is used to display an image stored as an array of bytes (binary large object). Its imagetype is "gif" or "jpeg", and its image data is the image. Technically, an ImagePage creates an HTTP request for a certain type of image.
Using dbKona, you can retrieve image files from a database and display them on a page. A servlet example is shown here:
public abstract void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { try { String iname = req.getParameter("imagename");You can use ImagePage to write a servlet that retrieves images from a database for display on your htmlKona pages. Use the constructors in this class that are designed for servlets. Then write and compile the class and add it to your Java-enabled server configuration (for example, with a Jeeves server, you'll add a line for the class to your servlet.properties file). When you compose your HtmlPage, add an ImageElement to it that requests that servlet. For example, if your Jeeves servlet is named imageDBGet:TableDataSet td = new TableDataSet(conn, "imagetable"); td.selectStmt().setQbe("name", iname); td.fetchRecords();
Record rec = td.getRecord(0);
// Retrieve the images from the database ImagePage hp = new ImagePage(rec.getValue("type").asString(), rec.getValue("data").asBytes()); hp.output(resp.getOutputStream()); } catch (Exception e) { throw new ServletException(e.toString()); } }
hp.getBody() .addElement(new ImageElement("http://jeeves_server/servlet/imageDBGet");
ImageElement
Fields inherited from class weblogic.html.WebPage |
allow,
codeset,
contentbuf,
contentencoding,
contentlength,
contents,
contenttype,
expires,
lastmodified,
location,
pragma,
referer,
server |
Constructor Summary | |
ImagePage(byte[] image)
Deprecated. Constructor used with servlets. |
|
ImagePage(java.lang.String imagefile)
Deprecated. Constructor used with servlets. |
|
ImagePage(java.lang.String imagetype,
byte[] image)
Deprecated. Constructs an ImagePage of the specified content-type with the specified image data. |
|
ImagePage(java.lang.String imagetype,
java.lang.String imagefile)
Deprecated. Constructs an ImagePage of the specified content-type with the specified image file. |
Method Summary | |
void |
output(java.io.OutputStream ostr)
Deprecated. Outputs the file. |
Methods inherited from class weblogic.html.WebPage |
allow,
allow,
contentBuf,
contentBuf,
contentEncoding,
contentEncoding,
contentLength,
contentLength,
contents,
contents,
contentType,
contentType,
expires,
expires,
includeHeader,
lastModified,
lastModified,
location,
location,
output,
output,
output,
pragma,
pragma,
referer,
referer,
server,
server,
setClientPull,
setClientPull,
setCodeset |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public ImagePage(java.lang.String imagetype, byte[] image)
imagetype
- GIF or JPG or other browser-viewable image typeimage
- byte[] of image datapublic ImagePage(java.lang.String imagetype, java.lang.String imagefile) throws java.io.IOException
imagetype
- GIF or JPG or other browser-viewable image typeimagefile
- Path and name of image filepublic ImagePage(byte[] image)
image
- byte[] of image datapublic ImagePage(java.lang.String imagefile) throws java.io.IOException
image
- String image filenameMethod Detail |
public void output(java.io.OutputStream ostr) throws java.io.IOException
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs60 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |