1 19 20 package org.apache.excalibur.instrument.manager.http; 21 22 import java.io.FileNotFoundException ; 23 import java.io.IOException ; 24 import java.io.PrintWriter ; 25 import java.util.Map ; 26 27 import org.apache.excalibur.instrument.manager.DefaultInstrumentManager; 28 import org.apache.excalibur.instrument.manager.InstrumentSampleDescriptor; 29 import org.apache.excalibur.instrument.manager.NoSuchInstrumentSampleException; 30 31 37 public class XMLSampleHandler 38 extends AbstractXMLHandler 39 { 40 43 49 public XMLSampleHandler( DefaultInstrumentManager manager, 50 InstrumentManagerHTTPConnector connector ) 51 { 52 super( "/sample.xml", manager, connector ); 53 } 54 55 58 65 public void doGet( String path, Map parameters, PrintWriter out ) 66 throws IOException 67 { 68 String name = getParameter( parameters, "name" ); 69 boolean packed = getBooleanParameter( parameters, "packed", false ); 70 71 InstrumentSampleDescriptor desc; 72 try 73 { 74 desc = getInstrumentManager().locateInstrumentSampleDescriptor( name ); 75 } 76 catch ( NoSuchInstrumentSampleException e ) 77 { 78 throw new FileNotFoundException ( 79 "The specified instrument sample does not exist: " + name ); 80 } 81 82 out.println( InstrumentManagerHTTPConnector.XML_BANNER ); 83 outputSample( out, desc, "", packed ); 84 } 85 86 89 } 90 91 | Popular Tags |