Examples of NSData


Examples of com.webobjects.foundation.NSData

    protected WOResponse sendInstanceRequest(MInstance anInstance, NSDictionary xmlDict) throws MonitorException {
        if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupDeployment))
            NSLog.debug.appendln("!@#$!@#$ sendInstanceRequest creates a WOHTTPConnection");

        String contentXML = (new _JavaMonitorCoder()).encodeRootObjectForKey(xmlDict, "instanceRequest");
        NSData content = new NSData(contentXML);

        //        String urlString = MObject.adminActionStringPrefix + anInstance.application().realName() + MObject.adminActionStringPostfix;
        String urlString = MObject.adminActionStringPrefix + anInstance.applicationName() + MObject.adminActionStringPostfix;
        WORequest aRequest = new WORequest(MObject._POST, urlString, MObject._HTTP1, null, content, null);
        WOResponse aResponse = null;
View Full Code Here

Examples of com.webobjects.foundation.NSData

      if (jdbcInfoStream == null) {
        throw new IllegalStateException("Unable to find 'JDBCInfo.plist' in this plugin jar.");
      }

      try {
        jdbcInfo = (NSDictionary<String, Object>) NSPropertyListSerialization.propertyListFromData(new NSData(jdbcInfoStream, 2048), "US-ASCII");
      }
      catch (IOException e) {
        throw new RuntimeException("Failed to load 'JDBCInfo.plist' from this plugin jar.", e);
      }
      finally {
View Full Code Here

Examples of com.webobjects.foundation.NSData

    /********** Constructors **********/
    public static MSiteConfig getSiteConfigFromHostAndPort(String configHostName, int aPort) throws MonitorException {
        if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog. DebugLevelInformational, NSLog.DebugGroupDeployment))
            NSLog.debug.appendln("!@#$!@#$ getSiteConfigFromHostAndPort creates a WOHTTPConnection");
        NSDictionary monitorRequest = new NSDictionary<String, String>("SITE", "queryWotaskd");
        NSData content = new NSData( (new _JavaMonitorCoder()).encodeRootObjectForKey(monitorRequest, "monitorRequest") );

        WORequest aRequest = new ERXRequest(MObject._POST, MObject.directActionString, MObject._HTTP1, NSDictionary.EmptyDictionary, content, null);
        WOResponse aResponse = null;

        try {
View Full Code Here

Examples of com.webobjects.foundation.NSData

    return super.invokeAction(request, context);
  }

  @Override
  public void takeValuesFromRequest(WORequest request, WOContext context) {
    NSData data = (NSData) request.formValueForKey(dropTargetID());
    if(data != null) {
      String mimetype = (String) request.formValueForKey(dropTargetID() + ".mimetype");
      if(!accept().isEmpty() && !acceptMimetype(mimetype)) {
        // reject mime types that don't match
        invokeAction = true;
        willAccept = false;
      } else {
        String filename = (String) request.formValueForKey(dropTargetID() + ".filename");
        FileOutputStream os = null;
        try {
          File uploadedFile = File.createTempFile("DragAndDropUpload-", ".tmp");
          os = new FileOutputStream(uploadedFile);
          data.writeToStream(os);
          ERAttachment upload = ERAttachmentProcessor.processorForType(storageType()).process(editingContext(), uploadedFile, filename, mimetype, configurationName(), null);
          setValueForBinding(upload, "attachment");
          invokeAction = true;
          FileUtils.deleteQuietly(uploadedFile);
        } catch (IOException e) {
View Full Code Here

Examples of com.webobjects.foundation.NSData

    if (delegate() != null) {
      delegate().attachmentCreated(this, attachment);
    }
    try {
      attachment.setWebPath(ERAttachmentProcessor._parsePathTemplate(attachment, webPath, recommendedFileName));
      NSData data = new NSData(uploadedFile.toURI().toURL());
      if (smallData) {
        attachment.setSmallData(data);
      }
      else {
        ERAttachmentData attachmentData = ERAttachmentData.createERAttachmentData(editingContext);
View Full Code Here

Examples of com.webobjects.foundation.NSData

    return attachment;
  }

  @Override
  public InputStream attachmentInputStream(ERDatabaseAttachment attachment) throws FileNotFoundException {
    NSData data = attachment.smallData();
    if (data == null) {
      ERAttachmentData attachmentData = attachment.attachmentData();
      if (attachmentData != null) {
        data = attachmentData.data();
      }
    }
    InputStream attachmentInputStream;
    if (data != null) {
      attachmentInputStream = data.stream();
    }
    else {
      throw new FileNotFoundException("There was no data available for this attachment.");
    }
    return attachmentInputStream;
View Full Code Here

Examples of com.webobjects.foundation.NSData

    try {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      workbook().write(out);
      out.close();
     
      return new NSData(out.toByteArray());
    } catch (IOException e) {
      log.error(e,e);
    }
    return null;
  }
View Full Code Here

Examples of com.webobjects.foundation.NSData

            }
            InputStream stream = new ByteArrayInputStream(bytes);

            EGSimpleTableParser parser = new EGSimpleTableParser(stream, fonts(), styles());
            try {
              NSData data = parser.data();
              if((hasBinding("data") && canSetValueForBinding("data")) ||
                 (hasBinding("stream") && canSetValueForBinding("stream"))
                 ) {
                  if(hasBinding("data")) {
                      setValueForBinding(data, "data");
                  }
                  if(hasBinding("stream")) {
                      setValueForBinding(data.stream(), "stream");
                  }
                  response.appendContentString(contentString);
              } else {
                  String fileName = fileName();
                  if(fileName == null) {
                      fileName = "results.xls";
                  }
                 
                  response.disableClientCaching();
                  response.appendHeader(String.valueOf( data.length()), "Content-Length" );
                  response.setContent(data); // Changed by ishimoto because it was sooooo buggy and didn't work in Japanese
 
                  response.setHeader("inline; filename=\"" + fileName + "\"", "content-disposition");
                  response.setHeader("application/vnd.ms-excel", "content-type");
              }
View Full Code Here

Examples of com.webobjects.foundation.NSData

    public void addToBothSidesOfAttachments(ERCMessageAttachment attachement) {
      addObjectToBothSidesOfRelationshipWithKey(attachement, Key.ATTACHMENTS);
    }
   
    public String storedGzippedValueForKey(String key) {
        NSData data = (NSData)storedValueForKey(key);
        String value = null;
        if (data != null && data.bytes().length > 0) {
            value = ERXCompressionUtilities.gunzipByteArrayAsString(data.bytes());
        }
        return value;
    }
View Full Code Here

Examples of org.jclouds.dynect.v3.domain.rdata.NSData

      checkNotNull(rdata.getExchange(), "rdata.exchange cannot be null for MXRecord: %s", record);
      return record;
   }

   private Record<NSData> checkNSRecord(Record<NSData> record) {
      NSData rdata = record.getRData();
      checkNotNull(rdata.getNsdname(), "rdata.nsdname cannot be null for NSRecord: %s", record);
      return record;
   }
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.