Exemple #1
0
  public static org.dom4j.Document createDocument(DebugXML debugXML) {
    final TransformerXMLReceiver identity = TransformerUtils.getIdentityTransformerHandler();
    final LocationDocumentResult result = new LocationDocumentResult();
    identity.setResult(result);

    final ContentHandlerHelper helper =
        new ContentHandlerHelper(
            new ForwardingXMLReceiver(identity) {
              @Override
              public void startDocument() {}

              @Override
              public void endDocument() {}
            });

    try {
      identity.startDocument();
      debugXML.toXML(helper);
      identity.endDocument();
    } catch (SAXException e) {
      throw new OXFException(e);
    }

    return result.getDocument();
  }
Exemple #2
0
  public static void wrapWithRequestElement(ContentHandlerHelper helper, DebugXML debugXML) {
    helper.startDocument();

    final ExternalContext externalContext = NetUtils.getExternalContext();
    final ExternalContext.Request request =
        (externalContext != null) ? externalContext.getRequest() : null;
    helper.startElement(
        "request",
        new String[] {
          "request-uri",
          (request != null) ? request.getRequestURI() : null,
          "query-string",
          (request != null) ? request.getQueryString() : null,
          "method",
          (request != null) ? request.getMethod() : null
        });

    debugXML.toXML(helper);

    helper.endElement();

    helper.endDocument();
  }