public static boolean isReaderMTOMAware(final XMLStreamReader reader) {
   boolean isReaderMTOMAware = false;
   try {
     isReaderMTOMAware =
         Boolean.TRUE.equals(reader.getProperty(OMConstants.IS_DATA_HANDLERS_AWARE));
   } catch (final IllegalArgumentException e) {
     isReaderMTOMAware = false;
   }
   return isReaderMTOMAware;
 }
Example #2
0
  /**
   * isReaderMTOMAware
   *
   * @return true if the reader supports MTOM
   */
  public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) {
    boolean isReaderMTOMAware = false;

    try {
      isReaderMTOMAware =
          java.lang.Boolean.TRUE.equals(
              reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
    } catch (java.lang.IllegalArgumentException e) {
      isReaderMTOMAware = false;
    }
    return isReaderMTOMAware;
  }
 public Object getProperty(final String name) throws IllegalArgumentException {
   return streamReader.getProperty(name);
 }
Example #4
0
 /**
  * Get the value of a feature/property from the underlying XMLStreamReader implementation without
  * accessing the XMLStreamReader. https://issues.apache.org/jira/browse/WSCOMMONS-155
  *
  * @param name
  * @return TODO
  */
 public Object getReaderProperty(String name) throws IllegalArgumentException {
   if (!isClosed()) {
     return parser.getProperty(name);
   }
   return null;
 }
Example #5
0
 public Object getProperty(String name) throws IllegalArgumentException {
   return parent.getProperty(name);
 }
Example #6
0
 @Override
 public Object getProperty(String name) throws IllegalArgumentException {
   return reader.getProperty(name);
 }
Example #7
0
    /**
     * static method to create the object Precondition: If this object is an element, the current or
     * next start element starts this object and any intervening reader events are ignorable If this
     * object is not an element, it is a complex type and the reader is at the event just after the
     * outer start element Postcondition: If this object is an element, the reader is positioned at
     * its end element If this object is a complex type, the reader is positioned at the end element
     * of its outer element
     */
    public static GetSiteResponse parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      GetSiteResponse object = new GetSiteResponse();

      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
          java.lang.String fullTypeName =
              reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
          if (fullTypeName != null) {
            java.lang.String nsPrefix = null;
            if (fullTypeName.indexOf(":") > -1) {
              nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
            }
            nsPrefix = nsPrefix == null ? "" : nsPrefix;

            java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);

            if (!"GetSiteResponse".equals(type)) {
              // find namespace for the prefix
              java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
              return (GetSiteResponse)
                  org.example.www.site.ExtensionMapper.getTypeObject(nsUri, type, reader);
            }
          }
        }

        // Note all attributes that were handled. Used to differ normal attributes
        // from anyAttributes.
        java.util.Vector handledAttributes = new java.util.Vector();

        reader.next();

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.isStartElement()
            && new javax.xml.namespace.QName("", "messages").equals(reader.getName())) {
          reader.next();
          if (isReaderMTOMAware(reader)
              && java.lang.Boolean.TRUE.equals(
                  reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY))) {
            // MTOM aware reader - get the datahandler directly and put it in the object
            object.setMessages(
                (javax.activation.DataHandler)
                    reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER));
          } else {
            if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT
                && reader
                    .getName()
                    .equals(
                        new javax.xml.namespace.QName(
                            org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI,
                            org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE))) {
              java.lang.String id =
                  org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8");
              object.setMessages(
                  ((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder)
                          ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder())
                      .getDataHandler(id));
              reader.next();

              reader.next();

            } else if (reader.hasText()) {
              // Do the usual conversion
              java.lang.String content = reader.getText();
              object.setMessages(
                  org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content));

              reader.next();
            }
          }

          reader.next();

        } // End of if for expected property start element
        else {
          // A start element we are not expecting indicates an invalid parameter was passed
          throw new org.apache.axis2.databinding.ADBException(
              "Unexpected subelement " + reader.getLocalName());
        }

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.isStartElement())
          // A start element we are not expecting indicates a trailing invalid property
          throw new org.apache.axis2.databinding.ADBException(
              "Unexpected subelement " + reader.getLocalName());

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }

      return object;
    }