Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSData


    boolean enabled = booleanValueForBinding("enabled", true, component);

    super.appendToResponse(response, context);
   
    if (enabled) {
      NSData data = responseAsPdf(response, context);
     
      String filename = stringValueForBinding("filename", "result.pdf", component);
      response.setHeader("inline; filename=\"" + filename + "\"", "content-disposition");
      response.setHeader("application/pdf", "Content-Type");
      response.setHeader(String.valueOf(data.length()), "Content-Length");
      response.setContent(data);
    }
  }
View Full Code Here


  eventTimestamp = new NSTimestamp();
  aResponse.setContentEncoding("UTF-8");
  super.appendToResponse (aResponse, aContext);
  aResponse.setHeader ("text/calendar","content-type");
  try {
      aResponse.setContent(new NSData(foldLongLinesInString(new String(aResponse.content().bytes(), "UTF-8")).getBytes("UTF-8")));
  } catch (java.io.UnsupportedEncodingException exception) {
      // If encoding is not supported, content of response is left unmodified
      // (although exceptions will be thrown elsewhere if UTF-8 is unsupported).
  }
    }
View Full Code Here

      if (value != null) {
        config.setObjectForKey(value, entry.getKey());
      }
    }
   
    NSData data = ERPDFUtilities.htmlAsPdf(response.contentString(), response.contentEncoding(), resourceUrlPrefix, config);
    return appendPDFs(data, context);
  }
View Full Code Here

        while (e.hasMoreElements()) {
          pdfs.add(new FileInputStream(e.nextElement()));
        }
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        ERPDFMerge.concatPDFs(pdfs, output, false);
        data = new NSData(output.toByteArray());
      } catch (Exception e) {
        log.error(e, e);
      }
    }
    return data;
View Full Code Here

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    try {
      builder.setSource(html, encoding, urlPrefix, _config);
      builder.createDocument(os);
      os.close();
      return new NSData(os.toByteArray());
    } catch (Exception e) {
      throw com.webobjects.foundation.NSForwardException._runtimeExceptionForThrowable(e);
    }
  }
View Full Code Here

      fopb.setConfiguration(_config);
      fopb.setXML(xml);
      fopb.setXSL(fopxsl);
      fopb.createDocument(os);
      os.close();
      NSData returnNSData = new NSData(os.toByteArray());
      if (logger.isDebugEnabled()) {
        logger.debug("xml2Fop2Pdf(String, String, NSDictionary<String,Object>) - end - return value=" + returnNSData); //$NON-NLS-1$
      }
      return returnNSData;
    } catch (java.io.IOException e) {
View Full Code Here

    }
  }
 
  private void saveSourceMessage(InputStream stream) {
    if (!(stream instanceof ByteArrayInputStream)) {
      sourceMessage = new NSData();
      return;
    }
   
    ByteArrayInputStream byteStream = (ByteArrayInputStream)stream;
    byte[] bytes = new byte[byteStream.available()];
    try {
      byteStream.read(bytes);
      sourceMessage = new NSData(bytes);
    } catch (IOException e) {
      log.error(e.getMessage(), e);
    }
   
    try {
View Full Code Here

  }

  public void archiveDataFromSession(WOSession session) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = null;
    NSData data = null;

    try {
      oos = new ObjectOutputStream(baos);
      oos.writeObject(session);
      oos.flush();
      byte[] bytes = baos.toByteArray();
      data = new NSData(bytes);
    } catch (IOException e) {
      throw NSForwardException._runtimeExceptionForThrowable(e);
    } finally {
      if (oos != null) {
        try {
View Full Code Here

     
      NSLog.setAllowedDebugLevel(NSLog.DebugLevelInformational);
      NSLog.allowDebugLoggingForGroups(allowedDebugGroups() | NSLog.DebugGroupIO);
    }
   
    NSData result = super.responseToClientMessage(message);
 
    if (savedLogLevel != -2) {
      NSLog.setAllowedDebugLevel(savedLogLevel);
      NSLog.allowDebugLoggingForGroups(savedDebugGroups);
    }
View Full Code Here

    }
  }

  @Override
  public Object fetchBLOB(ResultSet rs, int column, EOAttribute attribute, boolean materialize) throws SQLException {
    NSData data = null;
    Blob blob = rs.getBlob(column);
    if(blob == null) { return null; }
    if(!materialize) { return blob; }
    InputStream stream = blob.getBinaryStream();
    try {
      int chunkSize = (int)blob.length();
      if(chunkSize == 0) {
        data = NSData.EmptyData;
      } else {
        data = new NSData(stream, chunkSize);
      }
    } catch(IOException e) {
      throw new JDBCAdaptorException(e.getMessage(), null);
    } finally {
      try {if(stream != null) stream.close(); } catch(IOException e) { /* Nothing we can do */ };
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSData

Copyright © 2018 www.massapicom. 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.