groovy.xml.MarkupBuilder Java Examples
The following examples show how to use
groovy.xml.MarkupBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransformActivity.java From mdw with Apache License 2.0 | 5 votes |
private Object getGPathParamValue(String varName, String varType) throws ActivityException { Object value = getValue(varName); VariableTranslator translator = getPackage().getTranslator(varType); if (translator instanceof DocumentReferenceTranslator) { try { DocumentReferenceTranslator docRefTranslator = (DocumentReferenceTranslator) translator; outputDocumentWriter = new StringWriter(); if (isOutputDocument(varName)) { if (value == null) { MarkupBuilder builder = new MarkupBuilder(outputDocumentWriter); builder.setDoubleQuotes(true); value = builder; } else { value = new XmlParser().parseText(docRefTranslator.toString(value, varType)); } } else { value = new XmlSlurper().parseText(docRefTranslator.toString(value, varType)); } } catch (Exception ex) { getLogger().error(ex.getMessage(), ex); throw new ActivityException(ex.getMessage(), ex); } } return value; }
Example #2
Source File: WSDLResource.java From irontest with Apache License 2.0 | 5 votes |
@GET @Path("/{wsdlUrl}/bindings/{bindingName}/operations/{operationName}") public SOAPOperationInfo getOperationInfo(@PathParam("wsdlUrl") String wsdlUrl, @PathParam("bindingName") String bindingName, @PathParam("operationName") String operationName) { SOAPOperationInfo info = new SOAPOperationInfo(); WSDLParser parser = new WSDLParser(); Definitions definition = parser.parse(wsdlUrl); StringWriter writer = new StringWriter(); SOARequestCreator creator = new SOARequestCreator(definition, new RequestTemplateCreator(), new MarkupBuilder(writer)); creator.createRequest(null, operationName, bindingName); info.setSampleRequest(writer.toString()); return info; }
Example #3
Source File: HtmlRenderContext.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public HtmlRenderContext(MarkupBuilder markupBuilder, Transformer<String, File> relativizer) { this.relativizer = relativizer; this.markupBuilder = markupBuilder; }
Example #4
Source File: HtmlRenderContext.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public HtmlRenderContext(MarkupBuilder markupBuilder, Transformer<String, File> relativizer) { this.relativizer = relativizer; this.markupBuilder = markupBuilder; }
Example #5
Source File: WSDLCustomParser.java From zap-extensions with Apache License 2.0 | 4 votes |
public HttpMessage createSoapRequest(SOAPMsgConfig soapConfig) { if (soapConfig == null || !soapConfig.isComplete()) return null; /* Retrieving configuration variables. */ Definitions wsdl = soapConfig.getWsdl(); HashMap<String, String> formParams = soapConfig.getParams(); Port port = soapConfig.getPort(); int soapVersion = soapConfig.getSoapVersion(); BindingOperation bindOp = soapConfig.getBindOp(); /* Start message crafting. */ StringWriter writerSOAPReq = new StringWriter(); SOARequestCreator creator = new SOARequestCreator(wsdl, new RequestCreator(), new MarkupBuilder(writerSOAPReq)); creator.setBuilder(new MarkupBuilder(writerSOAPReq)); creator.setDefinitions(wsdl); creator.setFormParams(formParams); creator.setCreator(new RequestCreator()); try { Binding binding = port.getBinding(); creator.createRequest( binding.getPortType().getName(), bindOp.getName(), binding.getName()); // LOG.info("[ExtensionImportWSDL] "+writerSOAPReq); /* HTTP Request. */ String endpointLocation = port.getAddress().getLocation().toString(); HttpMessage httpRequest = new HttpMessage(new URI(endpointLocation, false)); /* Body. */ HttpRequestBody httpReqBody = httpRequest.getRequestBody(); /* [MARK] Not sure if all servers would handle this encoding type. */ httpReqBody.append( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n" + writerSOAPReq.getBuffer().toString()); httpRequest.setRequestBody(httpReqBody); /* Header. */ HttpRequestHeader httpReqHeader = httpRequest.getRequestHeader(); httpReqHeader.setMethod("POST"); /* Sets headers according to SOAP version. */ if (soapVersion == 1) { httpReqHeader.setHeader(HttpHeader.CONTENT_TYPE, "text/xml; charset=UTF-8"); httpReqHeader.setHeader("SOAPAction", bindOp.getOperation().getSoapAction()); } else if (soapVersion == 2) { String contentType = "application/soap+xml; charset=UTF-8"; String action = bindOp.getOperation().getSoapAction(); if (!action.trim().equals("")) contentType += "; action=" + action; httpReqHeader.setHeader(HttpHeader.CONTENT_TYPE, contentType); } httpReqHeader.setContentLength(httpReqBody.length()); httpRequest.setRequestHeader(httpReqHeader); /* Saves the message and its configuration. */ wsdlSingleton.putConfiguration(httpRequest, soapConfig); return httpRequest; } catch (Exception e) { LOG.error( "Unable to generate request for operation '" + bindOp.getName() + "'\n" + e.getMessage(), e); return null; } }
Example #6
Source File: HtmlRenderContext.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public HtmlRenderContext(MarkupBuilder markupBuilder, Transformer<String, File> relativizer) { this.relativizer = relativizer; this.markupBuilder = markupBuilder; }
Example #7
Source File: HtmlRenderContext.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public HtmlRenderContext(MarkupBuilder markupBuilder, Transformer<String, File> relativizer) { this.relativizer = relativizer; this.markupBuilder = markupBuilder; }
Example #8
Source File: GObject.java From zeppelin with Apache License 2.0 | 2 votes |
/** * starts or continues rendering html/angular and returns MarkupBuilder to build html. * <pre> g.html().with{ * h1("hello") * h2("world") * }</pre> */ public MarkupBuilder html() { startOutputType("%angular"); return new MarkupBuilder(out); }