Polycom VR-6000 manual Getting the Path Where BMP File has to be Saved

Page 25

Application Development

<!- - BODY END - -> </html>

2.Configure the Web server to serve the above XHTML file.

For example, if you are using Apache Tomcat to try this example, put this file into the webapps\PLCM folder of Tomcat.

3.Write an application that is going to retrieve the stock information from a data service provider.

For this example, this application will be retrieving stock information from Yahoo and will send it to the Microbrowser. This application is written using a Java Server Page (JSP).

<?xml version="1.0" encoding="iso-8859-1"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <%@page import="java.io.File,java.io.IOException,java.net.URL,java.awt.image.B ufferedImage,javax.imageio.ImageIO"%>

<html>

<head>

<title>Stock Quote</title> </head>

<body>

<%

// GETTING THE PATH WHERE BMP FILE HAS TO BE SAVED

String bmpFilePath = application.getRealPath(File.separator) + "quote.bmp";

//DEFINE URL FROM WHERE CONTENT TO BE RETRIEVED String stockUrl = "http://ichart.yahoo.com/t?s=";

//RETRIEVE THE STOCK SYMBOL FROM REQUEST

String stockSymbol = "PLCM"; // DEFAULT TO PLCM if ( request.getParameter("stockname") != null ) { stockSymbol = request.getParameter("stockname");

}

readAndConvertContentToBmp(stockUrl + stockSymbol, bmpFilePath, stockSymbol);

%>

<%!

//READ THE CONTENT FROM GIVEN URL AND THEN CONVERT THE CONTENT TO A BMP FILE

private void readAndConvertContentToBmp(String a_stockUrl, String a_filePath, String a_name) throws IOException {

try {

BufferedImage stockImage = ImageIO.read(new URL(a_stockUrl)); ImageIO.write(stockImage, "bmp", new File(a_filePath));

}

catch (IOException ex) { throw ex;}

}

%>

2 - 15

Image 25
Contents SIP Trademark Information About This Guide Developer’s Guide SoundPoint IP / SoundStation IP Contents Developer’s Guide SoundPoint IP / SoundStation IP Overview What is the MicrobrowserApplications What is XhtmlHow to Create Applications Microbrowser Supported Xhtml Elements Application DevelopmentBasic Tags Input Tags Link TagsAttribute Value/s Description Method=post This method Method=get This methodInput Img element defines an image Image TagsTable Tags Attribute Value/s Description Meta Information Tags Http SupportMicrobrowser and the main Microbrowser Microbrowser User Interface Navigation and Form Editing Launching the MicrobrowserDeveloping an Xhtml Application Changing Configuration ParametersIdle Display Microbrowser For example, mb.proxy=10.11.32.1038080 Sample ApplicationsHttp//WEBSERVERADDRESSPORT/PLCM/Sample.xhtml Getting the Path Where BMP File has to be Saved Http// Webserveraddress PORT/PLCM/AddStock.xhtml XML Errors TroubleshootingSymptom Problem Corrective Action Developer’s Guide SoundPoint IP / SoundStation IP Unsupported Xhtml Elements AppendixTag Type Tag Description Basic Tags Character Format TagsBlock Tags Tag Type Tag Description Output TagsLink Tags Frame TagsList Tags Tag Type Tag Description Input TagsImage Tags Style Tags Tag Type Tag Description Table TagsMeta Information Tags Tag Type Tag Description Programming Tags Developer’s Guide SoundPoint IP / SoundStation IP Index XHTML, definition