Use httpchannel/httpservice combination for binary data

I have a blazeds proxy configuration set up with my flex application to communicate with a RESTful webservice.
This webservice is practically an interface to a content management system which has all types of content text and binary(audio,video,images etc) protected by HTTP basic authentication. I had no reason to use Blazeds except for its proxy capabilities to enable HTTP Authentication headers to be sent from the application to the webserver which dont work when sent directly to the server as mentioned.See related post below -
http://tech.groups.yahoo.com/group/flexcoders/message/136576
I send the requests through HTTPService from flex through a configured destination and it works well for all data formats supported by HTTPservice. Unfortunately HTTPService does not support binary resultformat for images,audio and video. I am aware that i should use a streaming server for audio and video data but for images I would like to go through the blazeds proxy to the webserver. Loader is the only class which is recommended to be used with images but i am not sure of how to use it with blazeds.
Is it possible in anyway to achieve what I am trying to?
Thanks,
Peeyush

Try this...
var b:ByteArray = _dataLoaderHTTPService.lastResult as
ByteArray;
b.position = 0;
trace(b.readObject());
Bob I.

Similar Messages

  • Is there an object like StringBuffer, but for binary data?

    I like the performance of StringBuffer, it's very fast when I use the indexOf() and lastIndexOf() methods.
    Is there an equivalent buffer object for binary data so that I can quickly search for byte sequences fast instead of looping through it?
    Thanks.

    I like the performance of StringBuffer, it's very fast when I use the indexOf() and lastIndexOf() methods.You mean fast as in O(n)?
    Is there an equivalent buffer object for binary data so that I can quickly search for byte sequences fast instead of looping through it?A ByteBuffer might be useful, though you will have to loop - (thats what StringBuffer does)

  • Can iCloud be used as a backup for iBank data?

    can iCloud be used as a backup for iBank data?

    iBank isn't compatible with iCloud, but developers could add it to the Mac App Store version soon

  • Can i buy a smaller macbook air (64gb) but use the time capsule for additional data ?

    can i buy a smaller macbook air (64gb) but use the time capsule for additional data ?

    If you plan to store important "original" or "master" files and documents on the Time Capsule, then you might want to think about a way to back up those files to another hard drive.
    Why? If the Time Capsule has a problem...and you have no backups....you lose everything.

  • Download file problem for binary data?

    Dear All,
    I have wrote a jsp file to do download page. I have used a piece of code from the JDC to this. This code will prompt the download dialog box each time user clicks the download button. The code itself will set the content type for different application. The code is like below:
    try
    java.io.File fileobj = new java.io.File(strFolder + strFile);
    response.setContentType(application.getMimeType(fileobj.getName()));
    response.setHeader("Content-Disposition","attachment; filename=\""
    + strFile + "\"");
    java.io.FileInputStream in = new java.io.FileInputStream(fileobj);
    int ch;
    while ((ch = in.read()) != -1) {
    out.write(ch);
    out.flush();
    in.close();
    } catch(Exception e)
    The code can download and handle text file correctly when it is openned in the text editor or inside the IE. But when a PDF file or Image is downloaded and openned in the PDF viewer or image viewer, it is corrupted and cannot be viewed. What is the problem? Any ideas?
    So, I wonder this code can handle binary data or not. It is seen like there is no different code to handle text and binary data in Java/Jsp.
    Thank you very much!
    Best Regards,
    Rockyu Lee
              

    Add following lines to .tld file (custom tag definition)
    <tag>
    <name>downloadbinary</name>
    <tagclass>org.rampally.DownloadBinaryTag</tagclass>
    <bodycontent>JSP</bodycontent>
    </tag>
    Add following line to JSP files.
    In JSP, keep one line of source. Make sure that there are no space and additional line feeds at the any where
    in the JSP files except JSP tags.
    <%@ taglib uri="/WEB-INF/taglibs/mb.tld" prefix="mytags" %>
    <mytags:downloadbinary />
    I am hoping that you have all required parameters such as fileName to download, etc.
    in your session or request object.
    Tag class ....
    public class DownloadBinaryTag extends TagSupport {
         public int doEndTag() throws JspException {
              // TODO: get binary data from filename or
              // binary data buffer from datase.
              // I am making it simple .. assume that it is a request parameter for
              // you test easily.
              String fileName = request.getParameter( "filename" );
              java.io.File file = new java.io.File( fileName);
              java.io.DataInputStream dis;
              try {
                   dis = new java.io.DataInputStream(new FileInputStream(fileName));
              } catch (FileNotFoundException e) {
                   // do error handling ...
                   return EVAL_PAGE;
              BinaryUtil.sendBinaryFile( dis, (HttpServletResponse) pageContext.getResponse(), contentType );
              return EVAL_PAGE;
    public class BinaryUtil
         static public void sendBinaryFile( DataInputStream dis,
                                  HttpServletResponse response,
                                  String contentType ) {
              try {
                   response.setContentType(contentType);
                   String fileName="test.pdf";
                   response.setHeader("Content-disposition", "inline; filename=" + newFileName );
                   ServletOutputStream sout = response.getOutputStream();
                   int len;
                   byte[] data = new byte[128 * 1024];
                   while ((len = dis.read(data, 0, 128 * 1024)) >= 0)
                        sout.write(data, 0, len);
                   sout.flush();
                   sout.close();
              } catch (Exception e) {
                   System.out.println(e.getMessage());
         static public void sendBinaryFile( byte[] data,
                                  HttpServletResponse response,
                                  String contentType ) {
              try {
                   response.setContentType(contentType);
                   String fileName="test.pdf";
                   response.setHeader("Content-disposition", "inline; filename=" + newFileName );
                   ServletOutputStream sout = response.getOutputStream();
                   sout.write(data);
                   sout.flush();
                   sout.close();
              } catch (Exception e) {
                   System.out.println(e.getMessage());
    You may have to change 'inline' to 'attachment' if you do not want IE to inline the document.
    That's all!!.. Hope this helps...!

  • Using a servlet to send binary data

    There is a section of our intranet that need to hold documents that have to be available only for a certain group of users. Here's my approach (if you think of a better one, please tell me):
    1-all the files are in a directory upper than WWWRoot so that nobody can directly download them
    2-there is a servlet that first: authentificate the user with username-password; and then lists all available documents.
    3-When one of these docs is clicked, I want my servlet to open the file using filesystem File object and then copy the content of the selected file in the http response body. What object and method should I use to do so? I dont know if I should use FileReader or something else. Dont forget it will not only has to work with text files, but also with binary data files like swf, powerpointpresentation and the like. So I fear that objects such as FileRead will mess special characters up and corrupt data.
    What would you advice me? Use FileReader or another object? Or maybe a completly different approach for the problem? And if you want to give me some sample codes, it would be appreciated.
    Thx for your help

    There is something I dont understand.. its bizarre. Usually I dont understand why a script is not working, but now, I dont understand why a scritp is working..
    Here are the codes that copy from a file to the servlet's ouput:
    //basic response configurations
    response.setContentType( mimeType );
    ServletOutputStream out = response.getOutputStream();
    //copy a file f to the servlet's output stream
    File f = new File( path );
    FileInputStream fis= new FileInputStream(f);
    int available = fis.available();
    byte[] b = new byte[available];
    fis.read(b);
    out.write( b );
    out.flush();
    They work fine. What I dont understand is that I tried them with a file of about 5 megs, and they still worked! I expected them to fail because the variable available is of the type int and then it implies that the maximum file size permitted by the algorithm should be 65536 bytes/1024=64 ko... isn't it????

  • Best Datatype for Binary Data

    Hi,
    We storing a Binary Data say "€ù?" in oracle as String Datatype.
    I have formed the query in my application to insert a record which has above string as one of the String field value.
    The insertion was success but when the above string is not stored as it is but it is stored as "¿ù?" which is not a correct data.
    Is this problem is because I'm using string for storing binary data?
    Also please let me know what could be the best data type to store the binary data (like above data) in oracle.

    Justin,
    With the help of your query I identified how the bytes are stored in the memory.
    I'm having VARCHAR2 datatype of size 14 in oracle when ever i store my binary data it is storing as
    127,0,0,0,0,0,0,0....for 14 bytes -> So the binary equivalent is 011111111,00000000,00000000,...... And i'm ok with it.
    But the problem is whenever a byte is holding the binary equivalent of 128 it is storing in the oracle as 191
    eq:
    Bits: 10000000 => equivalent to 128 in decimal and it is what i want to get when i query it using select, but what i'm getting in sql query is "191".
    Really I'm not able to understand the relationship beween 128 and 191 binary values.
    I got the above detail using the DUMP sql function.

  • Data plug-in for binary data with byte streams of variable length

    Hi there,
    I would like to write a data plug-in to read binary data from file and I'm using DIAdem 10.1.
    Each data set in my file consists of binary data with a fixed structure (readable by using direct access channels) and of a byte stream of variable length. The variable length of each byte stream is coded in the fixed data part.
    Can anyone tell me how my data plug-in must look like to read such kind of data files?
    Many thanks in advance!
    Kind regards,
    Stefan

    Hi Brad,
    thank you for the very quick response!
    I forgot to mention, that the data in the byte stream can actually be ignored, it is no data to be evaluated in DIAdem (it is picture data and the picture size varies from data set to data set).
    So basically, of each data set I would like to read the fixed-structure data (which is the first part of the data set) and discard the variable byte stream (last part of the data set).
    Here is a logical (example) layout of my binary data file:
    | fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXXXXXXXXX (byte stream)
    | fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXX (byte stream)
    | fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXXXXXXXXXXXXXXXX (byte stream)
    What I would like to show in DIAdem is only fixedSize-Value1 and fixedSize-Value2.
    ´
    If I understood right, would it be possible to set the BlockLength of each data set by assigning Block.BlockLength = fixedSize-Value3 and to use Direct Access Channels for reading fixedSize-Value1 and fixedSize-Value2 ?
    Thank you!
    Kind regards,
    Stefan

  • Plugin for binary data: channels with coefficient : y = a3*x^3 + a2*x^2 + a1*x +a0

    Hello,
    I am bulding a plugin for extracting data from a binary file.
    My problem is that the scaling of the values is not defiened by a linear equation (y = a1*x + a0 where conversion is easy with Factor and Offset properties of Channel), but by a cubic equation (y = a3*x^3 + a2*x^2 + a1*x +a0) with 4 coefficients. For the moment, I performed the operation in a loop over all the values of the channel... this takes a lot of time to convert all the values!!! Is there a more efficient way for multiplying array in VBA or channels in DIADem (for Plugins!!!)...?

    Hi Ollac,
    There is no way to efficiently apply polynomial scaling in a DataPlugin.  You could create each of the polynomial component terms with an eMultiplyProcessor type ProcessedChannel in the DataPlugin, but we can't add them together with another ProcessedChannel because you can't add a ProcessedChannel to another ProcessedChannel.  If the manual cell-by-cell scaling that you've already tried is too woefully slow, then I'd suggest exposing the raw data values to channels in the Data Portal and adding the "a0", "a1", "a2", "a3" polynomial coefficients as channel properties.  Once the raw data is in DIAdem, you can use the ChnCalculate() or the older and faster FormulaCalc() command to apply the polynomial scaling in-place based on the coefficients in the channel properties.  You might want the Data Plugin to add the "_Raw" suffix to the channel names and have the scaling VBScript remove the "_Raw" suffix or replace it with a "_Scaled" suffix so you don't accidentally apply the polynomial scaling twice.
    Ask if you have questions about this,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Ideal column type for Binary Data ??

    Hi there,
    I must store binary data of fixed length (e.g. IP address of 4/16 bytes) into a table and manipulate that table over C++ / OCI.
    The database server is running on either SUN/SPARC or LINUX/i86. The clients are running on a broad range of systems (NT/i86, LINUX/x86, SUN/SPARC, ..).
    I am worried about the OCI layer modifying char/varchar values while transmission ...
    Whats the best approach ??
    Use CHAR/VARCHAR or use the variable length RAW even for fixed length binary data ??
    Any help would be greatly appreciated,
    Tobias
    null

    I guess RAW is the best approach

  • Domain type for binary data

    Hello,
    I want to create domain and data element to save binary data like pictures.
    Do you use RAW or RAWSTRING for this?
    thx
    chris

    Refer:
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21f2e5446011d189700000e8322d00/frameset.htm

  • Repricing of Custom Field used in Key combination for Pricing

    Hi,
    we have created a custom field and this field is being used in the Key combination for Pricing. For standard fields we all know that the pricing condition is repriced once the value of the key field is changed in the document automatically (not manual update)
    The problem with this having the custom field in the Key combination is that when this fiel value is changed in the document the condition is not repriced automatically. We need to Do the price update manually for determining the new condition value.
    Request you to help in solving the issue. Do explain the things to be carried out for automatic pricing for the Custom fields added.
    Thank you in advancd.
    Regard
    Kula

    Hi Kulasekar,
    I think you have to implement Badi CRM_COND_COM_BADI, update communication structure with updated value from transaction should do reprice.
    Hope this helps!!!

  • Try to use dynamic sql connection for additioal data for xml publisher

    I understand that the xml publisher is using template to merger the xml data output (say from Oracle report).
    We have some Oracle seeded report and do not wish to modify these report, but we do need to add additional data to these reports. In the past, the tool we used has the capability to make dynamic sql calls to get these additional data. Can this be achieved in xml publisher?
    I did noticed that the template builder has two options for upload data source: from a data file or from a sql connection, but seems they can not be used together. Not much document I can find for this. Thank you in advance for your help.
    Frank

    Hi All,
    Sandeep: if u have the solution pls send to my email id [email protected]
    ill really appriciate u r response.
    I have the same requirement to develop AR Invoice Report in XML publisher, actually it was developed using Optio Layout.my issue is the actual AR Invoice RDF contains 20 records and it showing the 20 recodes when we run that program (concurrent program output) after that while printing this report uisng the OPTIO layout (The Optio system is fetching some more records (10 records)) it printing total 30 records. i mean here the OPTIO is handling some pl/sql code i guess..
    so now how we can handle this requirement using XMLP.I am using RTF Templates with 5.6.2 v. Is it possible to do the same manner how the OPTIO was doing. Is this possible with any other Templates ?. or we need to customize the RDF itself ? .but I know that I can go ahead and modify the existing out-of-the-box report, but I do not want to do that. I do not have control over the XML that is generated since the XML is generated when the report is run. Is there any way to retrieve the extra information AFTER the xml has been generated and BEFORE the template is applied ?
    Thanks,
    Rad

  • How To Use OnCommand Workflow Automation For Automated Data Protection During Failover

    Introduction:
    The NetApp OnCommand Workflow Automation (WFA) engineering team recently published a WFA pack that lets you recreate SnapMirror and SnapVault protection after MetroCluster switchover and switchback. A switchover/switchback occurs during a planned or unplanned failover. Introducing automation promotes best practices for continuous data protection during these types of occurrences. Watch this video to learn how to take the steps for implementing and executing this pack.
    Step 1:
    Recreate SnapMirror and SnapVault protection after MetroCluster switchover.
    Step 2:
    Retain SnapMirror and SnapVault data before MetroCluster switchback.
    Step 3:
    Recreate SnapMirror and SnapVault protection after MetroCluster switchback.
    Other Resources:
    This WFA pack is available for download on the Storage Automation Store.

    Hi Ian,The WFA engineering team is getting ready to publish a blog article to accompany this new WFA pack. I hope you will find it helpful (stay tuned).Kristina

  • DETAIL_DATASTORE for binary data

    can i put binary data like PDF,word doc in DETAIL_DATASTORE?

    You should as this question in the Oracle Text forum, where you will get a more expert, quicker answer.

Maybe you are looking for

  • How can I get PSE 8 for Mac?

    Hello! I have got a version of Photoshop Elements 8 from site Wacom, like buyer of Wacom Bamboo. I installed PSE 8 in my laptop with Windows XP. Then I deactivated that version in the laptop. Now I have a new MacBook Pro, but I can not download the f

  • Is there a way to read text messages from the past in a thread that has been ongoing for months?

    Is there a way to view/recover messages from months ago in a thread that has been ongoing? The messages are not deleted. If i just keep "loading new messages" a) it will take all day, I've tried, and b) it freezes on me.

  • Any Expert idea how to repair BIOS on Envy DV7-7223CL having continuous CapsLock Blinking?

    I have a Envy DV7-7223CL laptop (Product no. C2N67UA with AMD A8-4500M cpu and 8GB RAM) running Win8 which was working fine, The day windows was updating the system while the battery was out and it was conected to charger only, Then the power got dis

  • I Need Information Regarding File Upload?

    Where can I get information regarding the File uploading packages in Portal. Is there a specification I can get a hold of. I know such a package exists, as it is used by portal itself. I just need to know where I can get hold of information as to wha

  • Location case for laptops in Digital Photography

    Hello everyone I am a professional photographer often using a laptop on location to store and process my images. I've been looking for and not finding a case I can have the laptop in as well as have it open with a dark viewing cover. And ofcorse I wo