Mime types / wsrp

Hi all,
I'm trying to display an excel spreadsheet from within a jsp in a portlet over wsrp.
Whenever I make a request from the consumer, I get the error:
java.lang.IllegalArgumentException: MIME type [application/vnd.ms-excel] is not supported by the consumer/portal. Supported types(s) is(are) [ text/html  text/xml  application/xml  application/xhtml+xml  text/plain  image/png  */* ].
and looking at the wsrp request sent over by the consumer, the mimeTypes it says it supports are:
<v1:markupParams>
<v1:secureClientCommunication>false</v1:secureClientCommunication>
<v1:locales>en-GB</v1:locales>
<v1:locales>en</v1:locales>
<v1:mimeTypes>text/html</v1:mimeTypes>
<v1:mimeTypes>text/xml</v1:mimeTypes>
<v1:mimeTypes>application/xml</v1:mimeTypes>
<v1:mimeTypes>application/xhtml+xml</v1:mimeTypes>
<v1:mimeTypes>text/plain</v1:mimeTypes>
<v1:mimeTypes>image/png</v1:mimeTypes>
<v1:mimeTypes>*/*</v1:mimeTypes>
<v1:mode>wsrp:view</v1:mode>
My question is how do I get my consumer to support additional mimetypes?
I am using WLP 10 MP1.
Thanks

This can be solved in different ways.
1) You can use custom data transfer.please go through the below link
http://edocs.beasys.com/wlp/docs81/wsrp/custxfer.html
2) Use resource url tag library in your view on producer.
3) User resource proxy servlet on Consumer.
<!-- Proxy servlet to serve resources from producers -->
<servlet>
<servlet-name>com.bea.wsrp.consumer.resource.ResourceProxyServlet</servlet-name>
<servlet-class>com.bea.wsrp.consumer.resource.ResourceProxyServlet</servlet-class>
<init-param>
<param-name>resourceHeaderFilter</param-name>
<param-value>com.bea.wsrp.consumer.resource.CustomResourceHeaderFilter</param-value>
</init-param>
</servlet>
CustomResourceHeaderFilter.java:
package com.bea.wsrp.consumer.resource;
//import com.bea.p13n.util.debug.*;
import com.bea.wsrp.consumer.resource.ResourceHeaderFilter;
import com.bea.wsrp.consumer.resource.ResourceHeaders;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletContext;
import java.util.*;
public class CustomResourceHeaderFilter implements ResourceHeaderFilter
private static final HashSet requestHeadersToSkip = new HashSet();
// Debug
//private static final Debug debug =Debug.getInstance(DefaultResourceHeaderFilter.class);
private static final Logger LOGGER = LoggerHelper.getLogger(CustomResourceHeaderFilter.class);
// By default, the following request headers will not be proxied private static final HashSet requestHeadersToSkip = new HashSet();
static
//requestHeadersToSkip.add("get");
     //requestHeadersToSkip.add("post");
     //requestHeadersToSkip.add("host");
     //requestHeadersToSkip.add("cookie");
     //requestHeadersToSkip.add("expect");
public ResourceHeaders getPassThroughHeaders(HttpServletRequest request, ServletContext context, String url)
     //request.getSession().getId()
ResourceHeaders passThroughHeaders = new ResourceHeaders(); List passThroughValues;
// All headers
Enumeration headerNames = request.getHeaderNames();
while(headerNames.hasMoreElements())
String name = (String) headerNames.nextElement();
if(requestHeadersToSkip.contains(name.toLowerCase()))
continue;
passThroughValues = new LinkedList();
Enumeration values = request.getHeaders(name);
while(values.hasMoreElements())
String value = (String) values.nextElement();
LOGGER.info("[Sending] " + name + ": " + value);
passThroughValues.add(value);
if (passThroughValues.size() > 0)
passThroughHeaders.addHeader(name, passThroughValues);
return passThroughHeaders;
}

Similar Messages

  • How can I use one Add-on prior to another for specific MIME-types?

    I'm using Shockwave Flash plugin to watch some videos on YouTube, StreamCloud, etc. It also handles .mkv and .mp4 files/streams. After installing VLC Web plugin to handle MIME-types like mp3/4, mkv additionally and prior to the Flash plugin, Firefox keeps using Flash to handle those types insted. I cannot find options to set the desired priorities. Only disabling the Flash plugin solves my problem, but also keeps me from watching Flash contents, which Is not acceptable.
    Did I miss something or is this Firefox's fault?

    If you type or paste '''about:plugins''' in the address bar and press Enter, you can see which plugins are associated which various content types.
    I do not know how to prioritize one over the other for the same content type if the plugin settings (plugins often have an interface outside of Firefox to adjust their settings) do not allow that.
    As for MP4, I don't think Flash normally would be selected. I suspect the website is specifying a Flash media player and streaming the MP4 through that. If you want to hide the Flash plugin from a particular website, you can use the Permissions tab of the Page Info dialog.
    Click the padlock or globe icon in the address bar, then More Information, then Permissions. The top section of the Permissions panel should be "Activate Plugins". Here you can select Block for Flash for the current site. After reloading the page, does the media play using a different plugin?

  • Unable to launch application from my machine:Bad MIME Type

    Hi,
    The following error message was printed when I tried to access the SwingSet2 demo from the Java Web Start site.
    An error occurred while launching/running the application.
    Title: SwingSet2
    Vendor: Sun Microsystems, Inc.
    Category: Download Error
    Bad MIME type returned from server when accessing resource: http://java.sun.com/products/javawebstart/apps/SwingSet2.jnlp - text/html
    Can you please suggest what is to be done to rectufy this problem?
    Regards,
    Satish

    Bad MIME type returned from server when accessing
    resource:
    http://java.sun.com/products/javawebstart/apps/SwingSet
    .jnlp - text/htmlit should return application/x-java-jnlp-file.
    My guess is that you use proxy which messes up headers.
    Otherwise try to reinstall Web Start, then enable the console and log output in Web Start's advanced preferences to get more clues what's going on.
    Regards,
    Marc

  • How to change default application associated with some mime types?

    When we install some new program, for example GIMP, I assume the newly installed program is added to some mime type database, and the /usr/share/applications/mimeinfo.cache file is automatically generated.
    Using my example, GIMP will be the default application for all its registered mime types, even application/pdf. I surely don't want this to happen, and I surely don't want to create all kinds of files that GIMP registered and right click on them and choose Properties and then change it in the Open with... tab. I want to systematically de-prioritize GIMP so that it will not override my previously assigned default applications.
    I wrote a script to modify the mimeinfo.cache file, and it seems to work great. However, after a reboot or upgrade or something I didn't notice, the default application of application/pdf is reconfigured to GIMP. I think the cache suffix of the file indicates that it is just a cache and may be changed by system unnoticed. So I am looking for a new way to change the default applications.
    As far as I know or guess from the phenomena, there should be some system utility that generates the mimeinfo.cache file, it seems to parse all the *.desktop files under /usr/share/applications and register them to certain mime types accordingly. The sequence of the *.desktop files get parsed seems to be related to the time the application is installed, and the newly installed applications seems to be parsed later and inserted in the front of the application list or be parsed earlier and appended to the application list. Is there some place I can change the sequence of the parsing? Or is there some place I can change the behavior of the system utility?
    I know that I can populate my ~/.local/share/applications/mimeapps.list to override the system wide defaults, however, I want a more elegant way to this.
    Any opinion on this is welcomed.
    Last edited by AugustePop (2010-05-14 05:47:15)

    Ah, right. Don't know what DE you are on, but in Gnome:  right-click a (e.g. pdf) file -> Preferences -> Open with.
    All Applications listed there will be available from the right click menu, the marked one will be used on double-click.
    errgrh...
    I surely don't want to create all kinds of files that GIMP registered and right click on them and choose Properties and then change it in the Open with... tab. I want to systematically de-prioritize GIMP so that it will not override my previously assigned default applications.
    I guess what I am trying to propose is this: "de-prioritize" GIMP in its .dekstop file for the types you dont want it to be associated with, and manually add it back in through "Open With" for the file types you want it to be an option. Not sure if this is solving anything for you though
    Last edited by hokasch (2010-05-14 10:28:57)

  • File/Open Dialog Box / Setting MIME type

    In my application, I am calling a web service that returns text that I need to download into an EDI application. I am simply looking to have an open/file dialog box open when the text is returned. I was using the following code in a PL/SQL process:
    begin
    -- Set the MIME type
    owa_util.mime_header( 'application/octet', FALSE );
    -- Set the name of the file
    htp.p('Content-Disposition: attachment; filename="EDIOuput.edi"');
    -- Close the HTTP Header
    owa_util.http_header_close;
    end;
    The problem is the HTML code that comes along with the text that is returned. Is there a way to simple call the procedure on a page that only containes the raw data?
    Thank you.

    HTML doesn't provide you the possibility to select multiple files or select folders at a single browse. Thus JSF can't do any much for you. Best what you can do is to write a signed applet or web start application which does the task. The Mojarra Scales component library has a ready-to-use component which embeds an applet which does that task. Check [https://scales.dev.java.net/multiFileUpload.html].

  • Print HTML using JPS API.. How to configure printer MIME-TYPE as text/html

    Hi All,
    I have to print the HTML pages.. for this i have used JPS API , but i found that my printer doesnt supoort Mime-type(Flavour) text/html.
    Can someone help me in this ...
    i) Can i configure my printer for this Mime-type , if yes then HOW?
    ii) Is there any work around ?
    Thank you all in advance :)

    I reposted this question in the Database forum. Admin can feel free to delete this thread.
    The answer is to add this at the top: htp.addDefaultHTMLHdr(false);
    Thanks,
    T.
    Edited by: 855677 on May 3, 2011 9:35 AM

  • How To Get FileType and MIME Type from a File

    Hi,
    I am using following ways to get FileType and MIME Type.
    I am able to get file type, but I am getting MIME Type as */*
    Can any one please let me know how to get MIME Type, but it should not be time consuming process.
    For File Type I am using following Code:
    private String getFileData(InputStream inStream) {
    fileName = C:\temp\temp.tiff
    String filePath = Util.createTempFile(fileName);
    RandomAccessFile raf = new RandomAccessFile(filePath, "rw");
    while (inStream.available() > 0) {
         byte[] buf = new byte[inStream.available()];
         inStream.read(buf);
         raf.write(buf);
    inStream.close();
    raf.close();
    File file = new File(filePath);
    JFileChooser chooser = new JFileChooser();
    String fileType = chooser.getTypeDescription(file);
    file.delete();
    //MIME Type I am getting from
    DataHandler data = new DataHandler(new DocumentSource(inStream));
    data.getContentType();
    data.getContentType() is not working well in all cases.
    Can any one help me on this.
    Thanks in advance,
    Ram.
    Edited by: javausers07 on Apr 15, 2009 4:25 PM

    javausers07 wrote:
    Hi,
    I am using following ways to get FileType and MIME Type.
    I am able to get file type, but I am getting MIME Type as */*
    Can any one please let me know how to get MIME Type, but it should not be time consuming process.
    For File Type I am using following Code:
    private String getFileData(InputStream inStream) {
    fileName = C:\temp\temp.tiff
    String filePath = Util.createTempFile(fileName);
    RandomAccessFile raf = new RandomAccessFile(filePath, "rw");
    while (inStream.available() > 0) {
         byte[] buf = new byte[inStream.available()];
         inStream.read(buf);
         raf.write(buf);
    inStream.close();
    raf.close();
    File file = new File(filePath);Why do you do all above?
    JFileChooser chooser = new JFileChooser();
    String fileType = chooser.getTypeDescription(file);
    file.delete();
    //MIME Type I am getting from
    DataHandler data = new DataHandler(new DocumentSource(inStream));
    data.getContentType();
    data.getContentType() is not working well in all cases.That's because there's no way to get MIME type of all files on all filesystems.
    Kaj

  • How to restrict uploading files by mime type?

    Hi,
    I have been searching the forum (and Google) looking for tips on how to ensure users can only upload files of specific formats (Word, PDF, etc) for specific document types as defined within the application (e.g. Curriculum Vitae (Word), Copy of Transcripts (PDF)).
    While I have used this research to start work on a server-side solution, I would like to know if there is an apex-friendly way to "validate" a file-browse item based on mime-type.
    Has anyone else had to address this?
    Ted

    Hi,
    I would like to know if there is an apex-friendly way to "validate" a file-browse item based on mime-typeHow about, you create a check constraint on your MIMETYPE column. something similar to this:
    alter table "MY_TABLE" add constraint
    "MY_TABLE_CON" check ( "MIMETYPE" = 'application/pdf' or "MIMETYPE" = ......)Or you can use this plugin, provided using browsers supporting HTML 5:
    http://www.theapexfreelancer.com/apex/f?p=APEXFREELANCER:FILE_UPLOAD:0
    For friendly,
    Please check error handling :
    http://www.inside-oracle-apex.com/apex-4-1-error-handling-improvements-part-1/
    Best Regards,
    Fateh

  • Need to get the MIME type of Files

    hi
    I have a table which contains Partno and the images name i.e PRODUCT_AWG_20070416 and the data would be like that :-
    partno img_name
    PX1 px1.jpeg
    PX2 px2.jpeg
    PX3 px3.jpeg
    Now one by one i am Inserting those files into my table (img_temp -BLOB Column) which are exists in directory & the map file. but i also need to insert the MIME type of the inserted file. can you please provide me the way to generate MIME type on the basis of file type like (JPG,GIF,TXT etc).
    the procedure i am using is as follows :
    hi
    I have a TABLE which contains Partno AND THE IMAGES NAME i.e PRODUCT_AWG_20070416 AND THE DATA would be LIKE that :-
    partno img_name
    PX1 px1.jpeg
    PX2 px2.jpeg
    PX3 px3.jpeg
    Now one BY one i am INSERTING those files INTO my TABLE (img_temp -BLOB COLUMN) which are EXISTS IN DIRECTORY & THE map FILE. but i also need TO INSERT THE MIME TYPE OF THE inserted FILE. can you please provide me THE way TO generate MIME TYPE ON THE basis OF FILE TYPE LIKE (JPG,GIF,TXT etc).
    the reason of this requirement is, we need to use that table in APEX 2.2 fromwhere i can download the inserted file and to download the file we need to get correct MIME_TYPE of that file.
    Please Suggest me the way.
    Thanks.
    The Procedure which i am using is as follows :
    CREATE OR REPLACE PROCEDURE img_uploader IS
    CURSOR Cur_img IS SELECT part_no,image_file FROM PRODUCT_AWG_20070416
                             WHERE Transaction_id =1 ;
    l_bfile BFILE;
    l_blob BLOB;
    BEGIN
    FOR Cur_img_val IN Cur_img LOOP
    l_bfile := BFILENAME('SOLVS_PRODUCT_IMG', Cur_img_val.image_file);
    INSERT INTO img_temp (part_no,MIME_type,file_name, img)
    VALUES (Cur_img_val.Part_no,NULL, Cur_img_val.image_file,EMPTY_BLOB())
    RETURN img INTO l_blob;
    DBMS_LOB.fileopen(l_bfile, Dbms_Lob.File_Readonly);
    DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
    DBMS_LOB.fileclose(l_bfile);
    END LOOP ;
    COMMIT;
    END;

    Hello,
    Perhaps this can help:
    http://help.sap.com/saphelp_nw04/helpdata/en/ad/ebe5cc1d75aa43a2871717d76f475d/content.htm
    If you want to know the table name, turn on tracing (ST05) when accessing the MIME types.
    regards
    Rick Bakker
    Hanabi Technology

  • How to get the Mime Type of the file?

    Hi Everyone!,
    I want to upload a random file into my table as a BLOB and simultaneously want to fill the respective another column with its MimeType. Earlier I used Oracle Apex for this, but due to my new requirement I need to make this happen with the help of PL SQL and Forms. Could you help me in getting how we can upload the file and most importantly, how we can get its Mime-Type.
    My chosen file can be of any type; it can be doc ,pdf,txt,xls ,gif or any other format.
    If you could provide the example with your reply then it would be great.
    Thanks
    Harbinder

    hi
    for that u have to use webutil.
    declare
          f varchar2(100);
    begin
         f := webutil_file.file_open_dialog();
         if f is not null then
              :doc.doc_name := f;
              end if;
         end;and
         DECLARE
    filename VARCHAR2(256);
    BEGIN
    filename := CLIENT_GET_FILE_NAME (File_Filter => 'jpg (*.jpg)|*.*|');
    READ_IMAGE_FILE(filename, 'jpg', 'image');
    END; sarah

  • How to determine the MIME types of the files?

    I'm making an application, in which I've to upload the files to the database. Now I want to insert into the database the MIME type of the files. Now how can I know that which type of the file is having which MIME type?
    where can I get the list of all supported MIME types?
    Even if I get the list, then every time I update the file in the database, so every time I have to check the file extension and then insert the MIME type...
    this seems to be a tedioius job..
    Is there any simple way to do this?

    I could ask "supported by what?" but I assume you will
    be the one supporting them. Here's a link to the
    latest list of registered MIME types.HERE's the link...
    ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types

  • How to get the MIME type of the given file in R/3

    Dear Experts,
    Please tell me the FM or Class to get the given file MIME type in R/3 . I am using GUI_upload Function module to upload the file in R/3 .
    Edited by: balaji ramadas on Jan 16, 2009 5:39 AM

    Thank you Prosenjit I m using this FM   CV120_GET_MIME_TYPE
    to get the MIME type of the file
    regards,
    Balaji.R
    Edited by: balaji ramadas on Jan 19, 2009 9:24 AM

  • Trying to Access SharePoint 2013 Rest Api in HTML page but getting Mime Type Exception with Status Success

    I am trying to invoke the SharePoint Rest Api using HTML page. I have included the Access Control Allow Origin to the web.config file. I am getting Readty State 4 and
    Status Success but still I am getting the below error.
    Refused to execute script from 'http://<server>/_api//web/lists?callback=jQuery172045857910416089_1430217181282&_=1430217363882' because its MIME
    type ('application/atom+xml') is not executable, and strict MIME type checking is enabled.
        <script>
            $(document).ready(function () {
                $("#KMPDiscussions").click(function () {
                    //$.support.cors = true;
                    $.ajax({
                        url: "http://<server>/_api//web/lists",
                        dataType: "jsonp",
                        type: "GET",
                        method: "GET",
                        contentType: "application/javascript",
                        headers: {
                            "content-type":
    "application/json;odata=verbose",
                            "accept": "application/json;odata=verbose",
                        success: function onSuccess(data) {
                            alert("Inside Alert");
                        error: function onError(data){
                            alert("Error: "
    + data);
        </script>
    It always hits the error on callback.
    Is there any other way that I can invoke SharePoint Rest Api from a Cross Domain. Please Help.

    Hi Chris,
    Thanks for the reply,Here iam using different files to be uploaded in library.
    please find the below snapshot of json response and ULS logs.
    12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files 
    abq2i High Could not get DocumentContent row: 0x80004005. 79f7629c-4694-c026-
    3349-2049178ee919
    12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files 
    aiv4w Medium Spent 0 ms to bind -1 byte file stream 79f7629c-4694-c026-3349-
    2049178ee919 
    12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files 
    aise3 Medium Failure when fetching document. 0x80070012 79f7629c-4694-c026-
    3349-2049178ee919
    12/22/2013 18:31:15.39 w3wp.exe (0x3338) 0x0D4C SharePoint Foundation 
    Database ab1a9 High Failed to get document content data.
    System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function     at
    Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object
    ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres) 
    79f7629c-76ab-c026-3349-2c9132b13e9a
    12/22/2013 18:31:15.39 w3wp.exe (0x3338) 0x4184 SharePoint Foundation 
    Database ab1a9 High Failed to get document content data.
    System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function     at
    Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object
    ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres) 
    79f7629c-76ab-c026-3349-281167b6cd09
    Thanks again,
    Naresh.

  • How to set Mime Type for Static Files

    Hi All,
    I am working on Apex 3.2.1.00.10.
    When I am trying to upload (create) a ".js" file into Static Files under Shared Components of an application; it is saving as "*text/plain*" for Mime Type. But I need Mime type to be set as "*application/x-javascript*".
    Please help me to change the Mime type of .js file.
    Or is there any way to upload the file directly as "*application/x-javascript*" as its Mime Type.
    Thanks in advance.
    Umesh

    In IIS v4 which comes with the Windows NT4 option pack, you right click the web page you are working with, select properties, then go to the HTTP Headers tab. At the bottom there's a button labelled File Types in the MIME Map section.
    After you've clicked that, you can add the two mime types you need;
    Associated Extension MIME Type
    .jar application/x-java-jar-file
    .jnlp application/x-java-jnlp-file
    I'm assuming that it is the same in W2k/IIS5.

  • Prompting a "Save As" dialog for an accepted mime type

    Hi ,
    I am using the following code to prompt a "Save As" dialog bod for an xls file:
    response.setHeader("Content-disposition","attachment; filename=test.xls");
    This does work, it prompts the save as dialog box with the name "test.xls" if i click on save. However if i click on open, it displays an error saying the file could not be found.
    Any idea how to specify a custom file name for an accepted mime type?
    Thanks in advance

    Ok let me try & be more clear.
    I have a JSP page. In this page there is an "Create Excel" link. When this link is clicked, the JSP dynamically creates the data. Then the following code:
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-disposition","attachment; filename=test.xls");
    This causes the file save dialog box to be created. This dialog box has "open" & "save" options.
    When the save option is clicked, the user is prompted to save a file named test.xls. However if the user clicks on the "Open" dialog box, then the file is not opened,i get an error message saying the file does not exist.
    If i dont specify the
    response.setHeader("Content-disposition","attachment; filename=test.xls");
    Then the file save dialog box displays a default filename which is the same as name of my servlet. This works for both Open as well as save options.
    I hope i have not confused you further..:)
    Please help!

Maybe you are looking for

  • Win 8.1 sfc /scannow returns Windows Resource Protection could not perform the requested operation.

    I am running Windows 8.1 Pro. I have been experiencing problems that lead me to believe the my component store is corrupted. When I run sfc /scannow sfc immediately comes back with "Windows Resource Protection could not perform the required operation

  • Data type Enhancement in SPROXY

    HI, We are using standard  software component : SAP SRM 5.5 ... We created some data types in Datatype enhancement and link to the standard Data types. Activated. When we are looking in the SPROXY that Enhance Data type is not vissible.. Our Version

  • Is one brand of printer better doing photo work on Macs than the others?

    Hi, I'm still having issues with trying to print photos. Text is fine - photos are an endless source of frustration. The only program that I seem to have that will allow for printing one sheet of photo paper with 4 different photos on it is PhotoShop

  • Comsume Web Service via ABAP SAP 4.7

    Hello Experts We wanted use an ABAP program to call a web service.  We were only given the target WSDL file.  Not sure what to do with this and what information can we get from this.  As I checked, the format is different from the conventional web se

  • No direct GL posting can be done in GL account

    Hi I am creating a purchase order with sale order reference. The sale order item is HALB. a. When I am creating as a regular sales order (in my case) with item category as TAN, the system is creating the purchase order. b. When I am creating for a sa