Java Code Examples for javax.ws.rs.core.MediaType#APPLICATION_SVG_XML_TYPE

The following examples show how to use javax.ws.rs.core.MediaType#APPLICATION_SVG_XML_TYPE . 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: Rest.java    From hop with Apache License 2.0 4 votes vote down vote up
public boolean init() {

    if ( super.init() ) {
      data.resultFieldName = environmentSubstitute( meta.getFieldName() );
      data.resultCodeFieldName = environmentSubstitute( meta.getResultCodeFieldName() );
      data.resultResponseFieldName = environmentSubstitute( meta.getResponseTimeFieldName() );
      data.resultHeaderFieldName = environmentSubstitute( meta.getResponseHeaderFieldName() );

      // get authentication settings once
      data.realProxyHost = environmentSubstitute( meta.getProxyHost() );
      data.realProxyPort = Const.toInt( environmentSubstitute( meta.getProxyPort() ), 8080 );
      data.realHttpLogin = environmentSubstitute( meta.getHttpLogin() );
      data.realHttpPassword = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( meta.getHttpPassword() ) );

      if ( !meta.isDynamicMethod() ) {
        data.method = environmentSubstitute( meta.getMethod() );
        if ( Utils.isEmpty( data.method ) ) {
          logError( BaseMessages.getString( PKG, "Rest.Error.MethodMissing" ) );
          return false;
        }
      }

      data.trustStoreFile = environmentSubstitute( meta.getTrustStoreFile() );
      data.trustStorePassword = environmentSubstitute( meta.getTrustStorePassword() );

      String applicationType = Const.NVL( meta.getApplicationType(), "" );
      if ( applicationType.equals( RestMeta.APPLICATION_TYPE_XML ) ) {
        data.mediaType = MediaType.APPLICATION_XML_TYPE;
      } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_JSON ) ) {
        data.mediaType = MediaType.APPLICATION_JSON_TYPE;
      } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_OCTET_STREAM ) ) {
        data.mediaType = MediaType.APPLICATION_OCTET_STREAM_TYPE;
      } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_XHTML ) ) {
        data.mediaType = MediaType.APPLICATION_XHTML_XML_TYPE;
      } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_FORM_URLENCODED ) ) {
        data.mediaType = MediaType.APPLICATION_FORM_URLENCODED_TYPE;
      } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_ATOM_XML ) ) {
        data.mediaType = MediaType.APPLICATION_ATOM_XML_TYPE;
      } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_SVG_XML ) ) {
        data.mediaType = MediaType.APPLICATION_SVG_XML_TYPE;
      } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_TEXT_XML ) ) {
        data.mediaType = MediaType.TEXT_XML_TYPE;
      } else {
        data.mediaType = MediaType.TEXT_PLAIN_TYPE;
      }
      try {
        setConfig();
      } catch ( Exception e ) {
        logError( BaseMessages.getString( PKG, "Rest.Error.Config" ), e );
        return false;
      }
      return true;
    }
    return false;
  }
 
Example 2
Source File: Rest.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
  meta = (RestMeta) smi;
  data = (RestData) sdi;

  if ( super.init( smi, sdi ) ) {
    data.resultFieldName = environmentSubstitute( meta.getFieldName() );
    data.resultCodeFieldName = environmentSubstitute( meta.getResultCodeFieldName() );
    data.resultResponseFieldName = environmentSubstitute( meta.getResponseTimeFieldName() );
    data.resultHeaderFieldName = environmentSubstitute( meta.getResponseHeaderFieldName() );

    // get authentication settings once
    data.realProxyHost = environmentSubstitute( meta.getProxyHost() );
    data.realProxyPort = Const.toInt( environmentSubstitute( meta.getProxyPort() ), 8080 );
    data.realHttpLogin = environmentSubstitute( meta.getHttpLogin() );
    data.realHttpPassword = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( meta.getHttpPassword() ) );

    if ( !meta.isDynamicMethod() ) {
      data.method = environmentSubstitute( meta.getMethod() );
      if ( Utils.isEmpty( data.method ) ) {
        logError( BaseMessages.getString( PKG, "Rest.Error.MethodMissing" ) );
        return false;
      }
    }

    data.trustStoreFile = environmentSubstitute( meta.getTrustStoreFile() );
    data.trustStorePassword = environmentSubstitute( meta.getTrustStorePassword() );

    String applicationType = Const.NVL( meta.getApplicationType(), "" );
    if ( applicationType.equals( RestMeta.APPLICATION_TYPE_XML ) ) {
      data.mediaType = MediaType.APPLICATION_XML_TYPE;
    } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_JSON ) ) {
      data.mediaType = MediaType.APPLICATION_JSON_TYPE;
    } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_OCTET_STREAM ) ) {
      data.mediaType = MediaType.APPLICATION_OCTET_STREAM_TYPE;
    } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_XHTML ) ) {
      data.mediaType = MediaType.APPLICATION_XHTML_XML_TYPE;
    } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_FORM_URLENCODED ) ) {
      data.mediaType = MediaType.APPLICATION_FORM_URLENCODED_TYPE;
    } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_ATOM_XML ) ) {
      data.mediaType = MediaType.APPLICATION_ATOM_XML_TYPE;
    } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_SVG_XML ) ) {
      data.mediaType = MediaType.APPLICATION_SVG_XML_TYPE;
    } else if ( applicationType.equals( RestMeta.APPLICATION_TYPE_TEXT_XML ) ) {
      data.mediaType = MediaType.TEXT_XML_TYPE;
    } else {
      data.mediaType = MediaType.TEXT_PLAIN_TYPE;
    }
    try {
      setConfig();
    } catch ( Exception e ) {
      logError( BaseMessages.getString( PKG, "Rest.Error.Config" ), e );
      return false;
    }
    return true;
  }
  return false;
}