Polycom SIP 2.2.0 manual Getting the Path Where BMP File has to be Saved

Page 25

Application Development

<?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;}

}

%>

<!-- START DISPLAY BMP FILE --> <img src="quote.bmp"/>

<!-- END DISPLAY BMP FILE --> </body>

</html>

4.Configure the Web server to deploy the above JSP file.

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

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 MicrobrowserWhat is Xhtml How to Create Applications Microbrowser Supported Xhtml Elements Application DevelopmentBasic Tags Link Tags Another document by using the href attributeInput Tags Following link tag is supported Defines an anchorMethod=get This method Specified URL Following attributes are supportedMethod=post This method Input Following image tag is supported Img-Defines an image Image TagsRequirement is 38400 bytes Img element defines an imageTable Tags Attribute Value/s Description Meta Information Tags Http SupportMicrobrowser User Interface Navigation and Form Editing Launching the Microbrowser Developing an Xhtml Application Changing Configuration Parameters Idle Display Microbrowser Change mb.main.home to the URL used for Microbrowser home Sample ApplicationHttp//WEBSERVERADDRESSPORT/PLCM/Sample.xhtml Getting the Path Where BMP File has to be Saved Reboot the phones Xhtml file in the sip.cfg configuration fileEnter a stock symbol, then select the Get Quote soft key AddStock.xhtml appears on the graphic displayXML Errors TroubleshootingSymptom Problem Corrective Action Developer’s Guide SoundPoint IP / SoundStation IP Unsupported Xhtml Elements AppendixUnsupported elements and attributes are Tag Type Tag Description Basic 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
Related manuals
Manual 254 pages 57.53 Kb