Changeset 16029

Show
Ignore:
Timestamp:
02/07/08 15:09:11 (2 months ago)
Author:
watkins
Message:

Merged widgetws branch back into the trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/intermine/web/main/src/org/intermine/web/logic/widget/GraphWidget.java

    r15901 r16029  
    1313import java.awt.BasicStroke; 
    1414import java.awt.Font; 
     15import java.io.File; 
     16import java.io.FileInputStream; 
    1517import java.lang.reflect.Constructor; 
    1618import java.util.List; 
     19 
     20import net.sourceforge.iharder.Base64; 
    1721 
    1822import org.intermine.objectstore.ObjectStore; 
     
    289293     * @return the HTML as a String 
    290294     */ 
    291     public String getHtml() { 
    292         StringBuffer sb = new StringBuffer("<img src=\"loadTmpImg.do?fileName=" + fileName 
    293                           + "\" width=\"" + ((GraphWidgetConfig) config).getWIDTH() + "\" height=\"" 
    294                           + ((GraphWidgetConfig) config).getHEIGHT() 
    295                           + "\" usemap=\"#chart" + fileName + "\">"); 
     295    public String getHtml() throws Exception{ 
     296        File file = new File(System.getProperty("java.io.tmpdir"), fileName); 
     297        FileInputStream is = new FileInputStream(file); 
     298        // Create the byte array to hold the data 
     299        byte[] bytes = new byte[(int) file.length()]; 
     300        String h; 
     301        is.read(bytes); 
     302        h = Base64.encodeBytes(bytes); 
     303        StringBuffer sb = new StringBuffer("<img src=\"data:image/png;base64," + h + "\" width=\"" 
     304                                           + ((GraphWidgetConfig) config).getWIDTH() 
     305                                           + "\" height=\"" 
     306                                           + ((GraphWidgetConfig) config).getHEIGHT() 
     307                                           + "\" usemap=\"#chart" + fileName + "\">"); 
    296308        sb.append(imageMap); 
    297309        return sb.toString(); 
  • trunk/intermine/webapp/main/resources/webapp/WEB-INF/struts-config.xml

    r15743 r16029  
    100100    <action path="/exportQuery" type="org.intermine.web.struts.ExportQueryAction"> 
    101101    </action> 
    102     <action path="/loadTmpImg" type="org.intermine.web.struts.TempImageLoader"> 
    103     </action> 
    104102    <action path="/tips" forward="tips.page"> 
    105103    </action> 
  • trunk/intermine/webapp/main/resources/webapp/WEB-INF/web.xml

    r15760 r16029  
    9898    <url-pattern>/service/template/results</url-pattern> 
    9999  </servlet-mapping> 
     100   
     101  <servlet> 
     102    <servlet-name>ws-widgets</servlet-name> 
     103    <servlet-class>org.intermine.webservice.widget.WidgetsServlet</servlet-class> 
     104    <init-param> 
     105       <param-name>debug</param-name> 
     106       <param-value>true</param-value> 
     107    </init-param> 
     108  </servlet> 
     109 
     110  <servlet-mapping> 
     111    <servlet-name>ws-widgets</servlet-name> 
     112    <url-pattern>/service/widgets</url-pattern> 
     113  </servlet-mapping> 
    100114 
    101115<!-- ================================================================================= -->