Changeset 1488
- Timestamp:
- 08/21/11 20:31:13 (13 years ago)
- Location:
- MDService2/trunk/MDService2
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/GenericProxyAction.java
r1481 r1488 93 93 // TODO Auto-generated catch block 94 94 e.printStackTrace(); 95 } catch (NoStylesheetException e) { 96 // TODO Auto-generated catch block 97 e.printStackTrace(); 95 98 } 96 99 } … … 196 199 public String getActionContentType() { 197 200 if (format.toLowerCase().startsWith("html")) { 198 this.actionContentType = "text/html"; 201 this.actionContentType = "text/html"; 202 //this.actionContentType = "application/xhtml+xml"; 199 203 } else { 200 204 this.actionContentType = "text/xml"; … … 408 412 return key; 409 413 } 410 public InputStream getSourceStream() throws IOException {414 public InputStream getSourceStream() throws IOException, NoStylesheetException { 411 415 return getTargetRequest().openStream(); 412 416 // Admin.notifyUser(getProxyKey() + ".getSourceStream() - unable to open stream: " + getTargetRequest(); … … 446 450 447 451 448 public static JSONArray createRepositories() throws IOException, InterruptedException, TransformerException {452 public static JSONArray createRepositories() throws IOException, InterruptedException, TransformerException, NoStylesheetException{ 449 453 String path = Admin.getConfig().getProperty("workspaceprofile.path") + WorkspaceAction.WORKSPACE_FILENAME;//PROFILENAME_SERVER; 450 454 File file=new File(path); … … 452 456 453 457 MDTransformer transformer = new MDTransformer(); 454 transformer.setSrcFile(file.toUR L());458 transformer.setSrcFile(file.toURI().toURL()); 455 459 transformer.setParams(MDTransformer.createParamsMap("xml2json")); 456 460 InputStream jsonstream = transformer.transformXML(in); … … 497 501 // TODO Auto-generated catch block 498 502 e.printStackTrace(); 503 } catch (NoStylesheetException e) { 504 // TODO Auto-generated catch block 505 e.printStackTrace(); 499 506 } 500 507 } … … 536 543 e.printStackTrace(); 537 544 } catch (TransformerException e) { 545 // TODO Auto-generated catch block 546 e.printStackTrace(); 547 } catch (NoStylesheetException e) { 538 548 // TODO Auto-generated catch block 539 549 e.printStackTrace(); -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDTransformer.java
r1431 r1488 101 101 * @param key 102 102 * @return 103 */ 104 private String getXSLPath (String key) { 103 * @throws NoStylesheetException - if no matching entry in properties could be found 104 */ 105 private String getXSLPath (String key) throws NoStylesheetException { 105 106 String xslpath = ""; 106 107 String xslfilename= Admin.getConfig().getProperty("xsl." + key); … … 108 109 if (xslfilename!=null) { 109 110 xslpath = Admin.getConfig().getProperty("scripts.path") + xslfilename; 110 } 111 } else { 112 throw new NoStylesheetException("No Stylesheet found for format-key: " + key); 113 } 111 114 Admin.notifyUser("xslfile:" + xslpath); 112 115 return xslpath; 113 116 } 114 117 115 private StreamSource getXSLStreamSource (String key) {118 private StreamSource getXSLStreamSource (String key) throws NoStylesheetException{ 116 119 117 120 InputStream xslstream; … … 206 209 * @throws TransformerException 207 210 * @throws IOException 208 */ 209 public void transformXML (InputStream in, OutputStream out ) throws TransformerException, IOException { 211 * @throws NoStylesheetException 212 */ 213 public void transformXML (InputStream in, OutputStream out ) throws TransformerException, IOException, NoStylesheetException { 210 214 //public void transformXML (InputStream in, String transkey, String cols, String startRecord, String maximumRecords, String lang, String q, String repositoryURI, OutputStream out ) throws TransformerException, IOException { 211 215 … … 310 314 * @throws InterruptedException 311 315 * @throws TransformerException 312 */ 313 public InputStream transformXML ( InputStream xmlStream) throws IOException, InterruptedException, TransformerException { 316 * @throws NoStylesheetException 317 */ 318 public InputStream transformXML ( InputStream xmlStream) throws IOException, InterruptedException, TransformerException, NoStylesheetException { 314 319 //public InputStream transformXML ( InputStream xmlStream, String transkey, String cols, String startRecord, String maximumRecords, String lang, String q, String repositoryURI) throws IOException, InterruptedException, TransformerException { 315 320 … … 348 353 * @throws TransformerException 349 354 * @throws IOException 350 */ 351 public InputStream transformXML (URL xmlFile ) throws IOException, InterruptedException, TransformerException { 355 * @throws NoStylesheetException 356 */ 357 public InputStream transformXML (URL xmlFile ) throws IOException, InterruptedException, TransformerException, NoStylesheetException { 352 358 //public InputStream transformXML (URL xmlFile, String transkey ) throws IOException, InterruptedException, TransformerException { 353 359 srcFile= xmlFile; … … 365 371 * @param transkey 366 372 * @return 373 * @throws NoStylesheetException 367 374 * @throws IOException 368 375 */ 369 public String transformXML (String xml) {376 public String transformXML (String xml) throws NoStylesheetException { 370 377 //public String transformXML (String xml, String transkey ) { 371 378 String result=""; -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/Pz2ProxyAction.java
r1486 r1488 137 137 138 138 @Override 139 public InputStream getSourceStream() throws IOException {139 public InputStream getSourceStream() throws IOException, NoStylesheetException { 140 140 if (getCommand() == null){ 141 141 try { -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/TermsProxyAction.java
r1268 r1488 128 128 } 129 129 130 public InputStream getSourceStream() throws IOException {130 public InputStream getSourceStream() throws IOException, NoStylesheetException{ 131 131 String type = getTSAttr("type"); 132 132 Admin.notifyUser("TPA.getSourceStream.TStype: " + type); -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/model/Query.java
r1455 r1488 28 28 import eu.clarin.cmdi.mdservice.action.Admin; 29 29 import eu.clarin.cmdi.mdservice.action.MDTransformer; 30 import eu.clarin.cmdi.mdservice.action.NoStylesheetException; 30 31 31 32 public class Query { … … 477 478 MDTransformer transformer = new MDTransformer(); 478 479 transformer.setParams(MDTransformer.createParamsMap("XCQL2XPATH")); 479 return transformer.transformXML(toXCQL()); 480 try { 481 return transformer.transformXML(toXCQL()); 482 } catch (NoStylesheetException e) { 483 setMsg("Query.toXPath-"+ e.getClass() + ": " + e.getMessage()); 484 return ""; 485 } 480 486 } 481 487 -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/model/Result.java
r911 r1488 8 8 import eu.clarin.cmdi.mdservice.action.Admin; 9 9 import eu.clarin.cmdi.mdservice.action.MDTransformer; 10 import eu.clarin.cmdi.mdservice.action.NoStylesheetException; 10 11 11 12 /** … … 49 50 * @throws InterruptedException 50 51 * @throws TransformerException 52 * @throws NoStylesheetException 51 53 */ 52 public InputStream getResultStream(String format) throws IOException, InterruptedException, TransformerException {54 public InputStream getResultStream(String format) throws IOException, InterruptedException, TransformerException, NoStylesheetException { 53 55 String transformkey; 54 56 … … 72 74 } 73 75 74 public void getResultStream(String format, InputStream in) throws IOException, InterruptedException, TransformerException {76 public void getResultStream(String format, InputStream in) throws IOException, InterruptedException, TransformerException, NoStylesheetException { 75 77 in = getResultStream(format); 76 78 } -
MDService2/trunk/MDService2/src/struts.xml
r1484 r1488 14 14 <global-results> 15 15 <!-- <result name="exception">/Exception.jsp</result>--> 16 <result name="exception">/ExceptionXML.jsp</result> 16 <result name="exception">/ExceptionXML.jsp</result> 17 <result name="nostylesheet-exception">/ExceptionNoStylesheet.jsp</result> 18 <result name="repositorydown-exception">/ExceptionXMLRepositoryDown.jsp</result> 17 19 <!-- tried setting html-status, didn't work: 18 20 <result name="exception"> … … 27 29 <global-exception-mappings> 28 30 <exception-mapping exception="java.lang.Exception" result="exception"/> 31 <exception-mapping exception="eu.clarin.cmdi.mdservice.action.NoStylesheetException" result="nostylesheet-exception"/> 32 <exception-mapping exception="java.io.IOException" result="repositorydown-exception"/> 33 29 34 </global-exception-mappings> 30 35 … … 182 187 <param name="actionkey"></param> 183 188 <result type="stream"> 184 <param name="contentType"> json</param>189 <param name="contentType">application/json</param> 185 190 <param name="inputName">resultStream</param> 186 191 </result> -
MDService2/trunk/MDService2/src/xsl/cmd_commons.xsl
r1479 r1488 1 <?xml version="1.0" ?>1 <?xml version="1.0" encoding="UTF-8" ?> 2 2 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 xmlns:my="myFunctions"> 3 xmlns:my="myFunctions" 4 exclude-result-prefixes="my"> 4 5 5 6 <!-- … … 55 56 <xsl:template name="html"> 56 57 57 <html >58 <html xmlns="http://www.w3.org/1999/xhtml" > 58 59 <head> 60 59 61 <title><xsl:value-of select="$title"/></title> 60 62 … … 93 95 <head> 94 96 <title><xsl:value-of select="$title"/></title> 95 <!-- <xsl:call-template name="callback-header"/> --> 97 <link href="{$base_dir}/style/cmds-ui.css" type="text/css" rel="stylesheet"></link> 98 <!-- <xsl:call-template name="callback-header"/> --> 99 96 100 </head> 97 101 <body> -
MDService2/trunk/MDService2/src/xsl/mdinst2view.xsl
r1226 r1488 54 54 <xsl:when test="contains($format,'htmlpage')"> 55 55 <h3><xsl:value-of select="$inner_title" /></h3> 56 <xsl:call-template name="getContext" /> 56 57 </xsl:when> 57 58 <xsl:otherwise> -
MDService2/trunk/MDService2/src/xsl/mdset2view.xsl
r1417 r1488 1 <?xml version="1.0" encoding="utf-8" ?>1 <?xml version="1.0" encoding="utf-8" ?> 2 2 <xsl:stylesheet 3 3 version="2.0" … … 5 5 xmlns:xs="http://www.w3.org/2001/XMLSchema" 6 6 xmlns:saxon="http://saxon.sf.net/" 7 xmlns:my="myFunctions" 7 xmlns:my="myFunctions" 8 exclude-result-prefixes="saxon my xs" 8 9 > 9 10 <!-- … … 19 20 <xsl:import href="terms2view.xsl"/> 20 21 21 <xsl:output method="html" /> 22 <xsl:output method="xhtml" media-type="application/xhtml+xml" indent="yes" encoding="UTF-8" 23 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" /> 24 25 <!-- 26 if this is added to the output-element, it terribly slows down requests with recordset being injected via document() function 27 (like: http://localhost:8080/MDService2/docs/htmlpagetest/queries2) 28 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" /> 29 --> 22 30 23 31 <xsl:include href="cmd_commons.xsl"/> … … 77 85 78 86 <xsl:for-each select="searchRetrieveResponse" > 87 <div> 79 88 <xsl:if test="not(contains($format, 'htmlsimple'))"> 80 89 <xsl:call-template name="header" /> … … 101 110 <xsl:otherwise>mdset2view: unrecognized format: <xsl:value-of select="$format" /></xsl:otherwise> 102 111 </xsl:choose> 112 </div> 103 113 </xsl:for-each> 104 114 … … 373 383 <label> maxItems: </label><input type="text" name="maximumItems" ><xsl:attribute name="value"><xsl:value-of select="$maximumItems"/></xsl:attribute> </input> 374 384 </form> 385 <xsl:call-template name="header" /> 375 386 <table class="show"> 376 387 <thead><tr><th>pos</th> -
MDService2/trunk/MDService2/src/xsl/test2view.xsl
r1423 r1488 9 9 </params> 10 10 <history> 11 <change on="201 0-11-12" type="created" by="vr">based on xml2htmltable</change>11 <change on="2011-05-23" type="created" by="vr">based on xml2htmltable</change> 12 12 13 13 </history> … … 29 29 <div class="cmds-ui-block" > 30 30 <div class="ui-widget-header"> 31 <xsl:value-of select="@class" />: <xsl:copy-of select="." /> [< xsl:value-of select="@href" />]31 <xsl:value-of select="@class" />: <xsl:copy-of select="." /> [<a href="{concat($base_url,@href)}" ><xsl:value-of select="@href" /></a>] 32 32 </div> 33 33 34 <div class="ui-widget-content"> 34 35 <xsl:choose> 35 <xsl:when test="@class=' count'">36 <xsl:when test="@class='requestcount'"> 36 37 <xsl:variable name="data" select="document(concat($base_url,@href))" /> 37 38 <xsl:value-of select="count($data//*)" /> 38 39 </xsl:when> 39 <xsl:when test="@class='queryxml'"> 40 <xsl:variable name="data" select="document(concat($base_url,@href))" /> 40 <xsl:when test="@class='query'"> 41 <xsl:variable name="data" select="document(concat($base_url,'recordset/htmltable/', @href))" /> 42 <xsl:copy-of select="$data" /> 43 </xsl:when> 44 <xsl:when test="@class='query count'"> 45 <xsl:variable name="data" select="document(concat($base_url,'recordset/xml/', @href))" /> 41 46 <xsl:value-of select="$data//numberOfRecords" /> 42 47 </xsl:when> … … 44 49 <xsl:apply-templates select="document(concat($base_url,@href))" mode="process-query"/> 45 50 </xsl:otherwise> 46 </xsl:choose> 51 </xsl:choose> 52 47 53 </div> 48 54 </div>
Note: See TracChangeset
for help on using the changeset viewer.