Refine search
if(output!=null) { // null result means no schema for that namespace out.put(n,output); systemIds.put(n,output.getSystemId()); e.getKey().writeTo( result, systemIds ); if(result instanceof StreamResult) { OutputStream outputStream = ((StreamResult)result).getOutputStream(); if(outputStream != null) { final Writer writer = ((StreamResult)result).getWriter(); if(writer != null) writer.close();
@Controller @RequestMapping("/test") public class TestController { @RequestMapping(method = RequestMethod.POST, value = "math") @ResponseBody public Result math(@RequestBody final Request request) { final Result result = new Result(); result.setAddition(request.getLeft() + request.getRight()); result.setSubtraction(request.getLeft() - request.getRight()); result.setMultiplication(request.getLeft() * request.getRight()); return result; } }
@Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { Result result = new StreamResult(this.writer); result.setSystemId("id"); return result; } }
public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException { if(result instanceof StreamResult){ return createXMLStreamWriter((StreamResult)result, null); }else if(result instanceof DOMResult){ return new XMLDOMWriterImpl((DOMResult)result); }else if(result instanceof Result){ return createXMLStreamWriter(new StreamResult(result.getSystemId())); } throw new java.lang.UnsupportedOperationException("result of type " + result + " is not supported"); }
public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException { if(result instanceof StreamResult){ StreamResult streamResult = (StreamResult)result; if( streamResult.getWriter() != null){ return createXMLStreamWriter(streamResult.getWriter()); }else if(streamResult.getOutputStream() != null ){ return createXMLStreamWriter(streamResult.getOutputStream()); }else if(streamResult.getSystemId()!= null){ try{ FileWriter writer = new FileWriter(new File(streamResult.getSystemId())); return createXMLStreamWriter(writer); }catch(IOException ie){ throw new XMLStreamException(ie); } } } else { try{ //xxx: should we be using FileOutputStream - nb. FileWriter writer = new FileWriter(new File(result.getSystemId())); return createXMLStreamWriter(writer); }catch(IOException ie){ throw new XMLStreamException(ie); } } throw new java.lang.UnsupportedOperationException(); }
if (result instanceof StreamResult) { StreamResult streamResult = (StreamResult) result; serializer.setOutputStream(streamResult.getOutputStream()); } else { URI uri = null; try { uri = new URI(result.getSystemId()); } catch (URISyntaxException e) { throw new RuntimeException(String.format("Malformed uri while writing results: %s",result.getSystemId()),e);
public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { logger.entering(getClass().getName(),"createOutput",new Object[]{namespaceUri,suggestedFileName}); Result r = resolver.createOutput(namespaceUri,suggestedFileName); if(r!=null) { String sysId = r.getSystemId(); logger.finer("system ID = "+sysId); if(sysId!=null) { // TODO: make sure that the system Id is absolute // don't use java.net.URI, because it doesn't allow some characters (like SP) // which can legally used as file names. // but don't use java.net.URL either, because it doesn't allow a made-up URI // like kohsuke://foo/bar/zot } else throw new AssertionError("system ID cannot be null"); } logger.exiting(getClass().getName(),"createOutput",r); return r; } }
private Result createInlineSchema(String namespaceUri, String suggestedFileName) throws IOException { Result result; if (namespaceUri.equals("")) { return null; } // Holder<String> fileNameHolder = new Holder<String>(); // fileNameHolder.value = schemaPrefix+suggestedFileName; // result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder); // if (result == null) { // // JAXB doesn't have to generate it, a schema is already available // com.sun.xml.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import().namespace(namespaceUri); // _import.schemaLocation(fileNameHolder.value); // } else { // Let JAXB write the schema directly into wsdl's TypedXmlWriter result = new TXWResult(types); result.setSystemId(""); // } return result; }
private Result toResult(String name, StringWriter writer) { Result result; result = new StreamResult(writer); result.setSystemId(name.replace('\\', '/')); return result; }
public javax.xml.stream.XMLStreamWriter createXMLStreamWriter(javax.xml.transform.Result result) throws javax.xml.stream.XMLStreamException { if (result instanceof StreamResult) { return createXMLStreamWriter((StreamResult) result, null); } else if (result instanceof DOMResult) { return new XMLDOMWriterImpl((DOMResult) result); } else if (result instanceof StAXResult) { if (((StAXResult) result).getXMLStreamWriter() != null) { return ((StAXResult) result).getXMLStreamWriter(); } else { throw new java.lang.UnsupportedOperationException("Result of type " + result + " is not supported"); } } else { if (result.getSystemId() !=null) { //this is not correct impl of SAXResult. Keep it for now for compatibility return createXMLStreamWriter(new StreamResult(result.getSystemId())); } else { throw new java.lang.UnsupportedOperationException("Result of type " + result + " is not supported. " + "Supported result types are: DOMResult, StAXResult and StreamResult."); } } }
public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException { if (result instanceof StreamResult) { StreamResult streamResult = (StreamResult) result; if (streamResult.getWriter() != null) { return createXMLStreamWriter(streamResult.getWriter()); } else if (streamResult.getOutputStream() != null) { return createXMLStreamWriter(streamResult.getOutputStream()); } else if (streamResult.getSystemId() != null) { writer = new FileWriter(new File(result.getSystemId())); final XMLStreamWriter streamWriter = createXMLStreamWriter(writer); isError = false;
((StreamResult)result).getOutputStream() == null); principalResultURI = result.getSystemId(); XPathException err = new XPathException( "Cannot write more than one result document to the same URI, or write to a URI that has been read: " + result.getSystemId()); err.setErrorCode("XTDE1490"); throw err; OutputStream os = ((StreamResult)result).getOutputStream(); if (os != null) { try {
if ( (null != outputTarget) && ((base = outputTarget.getSystemId()) != null) ) { base = urlToFileName(base);
private Result createInlineSchema(String namespaceUri, String suggestedFileName) throws IOException { Result result; if (namespaceUri.equals("")) { return null; } // Holder<String> fileNameHolder = new Holder<String>(); // fileNameHolder.value = schemaPrefix+suggestedFileName; // result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder); // if (result == null) { // // JAXB doesn't have to generate it, a schema is already available // com.sun.xml.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import().namespace(namespaceUri); // _import.schemaLocation(fileNameHolder.value); // } else { // Let JAXB write the schema directly into wsdl's TypedXmlWriter result = new TXWResult(types); result.setSystemId(""); // } return result; }
private Result toResult(File file) { Result result; try { result = new StreamResult(new FileOutputStream(file)); result.setSystemId(file.getPath().replace('\\', '/')); } catch (FileNotFoundException e) { errReceiver.error(e); return null; } return result; }
public javax.xml.stream.XMLStreamWriter createXMLStreamWriter(javax.xml.transform.Result result) throws javax.xml.stream.XMLStreamException { if (result instanceof StreamResult) { return createXMLStreamWriter((StreamResult) result, null); } else if (result instanceof DOMResult) { return new XMLDOMWriterImpl((DOMResult) result); } else if (result instanceof StAXResult) { if (((StAXResult) result).getXMLStreamWriter() != null) { return ((StAXResult) result).getXMLStreamWriter(); } else { throw new java.lang.UnsupportedOperationException("Result of type " + result + " is not supported"); } } else { if (result.getSystemId() !=null) { //this is not correct impl of SAXResult. Keep it for now for compatibility return createXMLStreamWriter(new StreamResult(result.getSystemId())); } else { throw new java.lang.UnsupportedOperationException("Result of type " + result + " is not supported. " + "Supported result types are: DOMResult, StAXResult and StreamResult."); } } }
final Writer writer = target.getWriter(); if (writer != null) { _tohFactory.setWriter(writer); final OutputStream ostream = target.getOutputStream(); if (ostream != null) { _tohFactory.setOutputStream(ostream); String systemId = result.getSystemId(); if (systemId == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_RESULT_ERR);
public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException { if (result instanceof StreamResult) { StreamResult streamResult = (StreamResult) result; if (streamResult.getWriter() != null) { return createXMLStreamWriter(streamResult.getWriter()); } else if (streamResult.getOutputStream() != null) { return createXMLStreamWriter(streamResult.getOutputStream()); } else if (streamResult.getSystemId() != null) { writer = new FileWriter(new File(result.getSystemId())); final XMLStreamWriter streamWriter = createXMLStreamWriter(writer); isError = false;
((StreamResult)result).getOutputStream() == null); principalResultURI = result.getSystemId(); if (!checkUniqueOutputDestination(principalResultURI)) { XPathException err = new XPathException("Cannot write more than one result document to the same URI, or write to a URI that has been read: " + result.getSystemId()); err.setErrorCode("XTDE1490"); throw err; OutputStream os = ((StreamResult)result).getOutputStream(); if (os != null) { try {
public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { logger.entering(getClass().getName(),"createOutput",new Object[]{namespaceUri,suggestedFileName}); Result r = resolver.createOutput(namespaceUri,suggestedFileName); if(r!=null) { String sysId = r.getSystemId(); logger.finer("system ID = "+sysId); if(sysId!=null) { // TODO: make sure that the system Id is absolute // don't use java.net.URI, because it doesn't allow some characters (like SP) // which can legally used as file names. // but don't use java.net.URL either, because it doesn't allow a made-up URI // like kohsuke://foo/bar/zot } else throw new AssertionError("system ID cannot be null"); } logger.exiting(getClass().getName(),"createOutput",r); return r; } }