Examples of NSData


Examples of com.webobjects.foundation.NSData

                } else {
                    anInstance.setRefusingNewSessions(false);
                }

                NSDictionary instanceResponse = null;
                NSData responseContent = aResponse.content();
                try {
                    instanceResponse = (NSDictionary) new _JavaMonitorDecoder().decodeRootObject(responseContent);
                } catch (WOXMLException wxe) {
                    try {
                        Object o = NSPropertyListSerialization.propertyListFromString(new String(responseContent.bytes()));
                        errorResponse.addObject(anInstance.displayName() + " is probably an older application that doesn't conform to the current Monitor Protocol. Please update and restart the instance.");
                        NSLog.err.appendln("Got old-style response from instance: " + anInstance.displayName());
                    } catch (Throwable t) {
                        NSLog.err.appendln("Wotaskd getStatisticsForInstanceArray: Error parsing: " + new String(responseContent.bytes()) + " from " + anInstance.displayName());
                    }
                    continue;
                } catch (NullPointerException npe) {
                    NSLog.err.appendln("Wotaskd getStatisticsForInstanceArray: No content returned from " + anInstance.displayName());
                    continue;
View Full Code Here

Examples of com.webobjects.foundation.NSData

   *            default value if object is null
   * @return NSData evaluation of the given object
   *
   */
  public static NSData dataValueWithDefault(Object obj, NSData def) {
    NSData value = def;
    if (!ERXValueUtilities.isNull(obj)) {
      if (obj instanceof NSData) {
        value = (NSData) obj;
      } else if (obj instanceof byte[]) {
        byte[] byteValue = (byte[]) obj;
        value = new NSData(byteValue, new NSRange(0, byteValue.length), true);
      } else if (obj instanceof String) {
        String strValue = ((String) obj).trim();
        if (strValue.length() > 0) {
          Object objValue = NSPropertyListSerialization.propertyListFromString(strValue); // MS:
                                                  // Encoding?
          if (objValue == null || !(objValue instanceof NSData)) {
            throw new IllegalArgumentException("Failed to parse data from the value '" + obj + "'.");
          }
          value = (NSData) objValue;
          if (value instanceof NSMutableData) {
            // AK: we need NSData if we want to use it for a PK, but
            // we get NSMutableData
            value = new NSData(value);
          }
        }
      } else {
        throw new IllegalArgumentException("Failed to parse data from the value '" + obj + "'.");
      }
View Full Code Here

Examples of com.webobjects.foundation.NSData

      String aFileName;
      InputStream anInputStream;
     
          if (request.formValueForKey(FormKeys.qqfilename) != null) {
            aFileName = (String) request.formValueForKey(FormKeys.qqfilename);
            NSData data = (NSData) request.formValueForKey(FormKeys.qqfile);
            anInputStream = data.stream();
          } else if (request.formValueForKey(FormKeys.qqfile) != null) {
        aFileName = (String) request.formValueForKey(FormKeys.qqfile);
        anInputStream = (request.contentInputStream() != null) ? request.contentInputStream() : request.content().stream();
          } else {
            log.error("Unable to obtain filename from form values: " + request.formValueKeys());
View Full Code Here

Examples of com.webobjects.foundation.NSData

    }
    appendHeadersToResponse(node, response, context);
    Object object = node.toNSCollection(delegate);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ERXPropertyListSerialization.writePropertyListToStream(object, out, ERXPropertyListSerialization.PListFormat.NSPropertyListBinaryFormat_v1_0, CharEncoding.UTF_8);
    response.appendContentData(new NSData(out.toByteArray()));
  }
View Full Code Here

Examples of com.webobjects.foundation.NSData

      if (hasBinding(Bindings.data)) {
        if (hasBinding(Bindings.filePath)) {
          NSArray aValue = request.formValuesForKey(uploadName());

          if (aValue != null) {
            NSData data = null;
            try {
              data = (NSData) aValue.objectAtIndex(0);
            } catch (ClassCastException e) {
              throw new ClassCastException("AjaxUploadButton: Value in request was of type '" + aValue.objectAtIndex(0).getClass().getName() + "' instead of NSData. Verify that the WOForm's 'enctype' binding is set to 'multipart/form-data'");
            }
View Full Code Here

Examples of com.webobjects.foundation.NSData

  }

  public Object newValueForImmutableBytes(byte bytes[]) {
    Class dataClass = NSData._CLASS;
    Object value = null;
    NSData data = null;
    if (_valueClass == null) {
      _valueClass = _NSUtilities.classWithName(className());//_valueClassName);
      if (_valueClass == null)
        _valueClass = dataClass;
    }
    if (_valueClass == dataClass || _argumentType == FactoryMethodArgumentIsData || _valueFactoryMethod == null) {
      data = new NSData(bytes, new NSRange(0, bytes.length), true);
      if (_valueClass == dataClass || _valueFactoryMethod == null)
        return data;
    }
    switch (_argumentType) {
    default:
View Full Code Here

Examples of com.webobjects.foundation.NSData

      }
      break;

    case FactoryMethodArgumentIsData:
      try {
        value = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), new NSData(str, CharEncoding.UTF_8));
        if (!NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDatabaseAccess))
          break;
        if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelDetailed))
          NSLog.debug.appendln(new RuntimeException("Deprecated implicit String->NSData conversion.  Assuming UTF-8 encoding."));
        else
View Full Code Here

Examples of com.webobjects.foundation.NSData

    int valueType = adaptorValueType();
   
    //To preserve the illusion of consistency, convert the byte[] to an NSData here
    if(FactoryMethodArgumentIsBytes == factoryMethodArgumentType() && valueFactoryMethod() != null) {
      byte[] bytes = (byte[])convertedValue;
      convertedValue = new NSData(bytes);
    }
   
    //Make an additional check here to support custom date types.
    if(!(AdaptorDateType == valueType && conversionMethod != null && Date.class.isInstance(convertedValue))) {
      if (!valueClasses[valueType].isInstance(convertedValue) && (valueClasses[valueType] != Number.class || !(convertedValue instanceof Boolean))) {
View Full Code Here

Examples of com.webobjects.foundation.NSData

                        // for jfreechart-1.0.x use this line
             _imageMap = ImageMapUtilities.getImageMap(_imageMapName, info, toolTipGenerator, urlTagFragmentGenerator);
            // for jfreechart-0.9.x use this line
                        // _imageMap = ImageMapUtil.getImageMap(_imageMapName, info, toolTipGenerator, urlTagFragmentGenerator);
                    }
                    _imageData = new NSData(imageStream.toByteArray());
                }
            } catch (Exception ex) {
                log.error(ex, ex);
                NSForwardException._runtimeExceptionForThrowable(ex);
            }
View Full Code Here

Examples of com.webobjects.foundation.NSData

                    .dictionaryForArchive(), "SiteConfig");
            NSMutableDictionary<String, NSMutableDictionary<String, NSDictionary>> updateWotaskd = new NSMutableDictionary<String, NSMutableDictionary<String, NSDictionary>>(
                    data, "sync");
            NSMutableDictionary<String, NSMutableDictionary<String, NSMutableDictionary<String, NSDictionary>>> monitorRequest = new NSMutableDictionary<String, NSMutableDictionary<String, NSMutableDictionary<String, NSDictionary>>>(
                    updateWotaskd, "updateWotaskd");
            NSData content = new NSData((new _JavaMonitorCoder()).encodeRootObjectForKey(monitorRequest,
                    "monitorRequest"));
            _syncRequest = new WORequest(MObject._POST, MObject.directActionString, MObject._HTTP1, aConfig
                    .passwordDictionary(), content, null);
        }
        return _syncRequest;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.