Java.io.UnsupportedEncodingException

Hello.
I am trying to parse an XML file into its DOM representation. The XML files starts with this line:
<?xml version="1.0" encoding="X-User-Defined"?>My code for parsing the XML is this:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
builder = factory.newDocumentBuilder();
Document doc = builder.parse(file);When run, I get this:
java.io.UnsupportedEncodingException: X-User-DefinedSo the problem is with the encoding of the XML file as specified. I'd like to know if there is a way to make the parser simply ignore the encoding attribute of the XML header. Or alternatively, treat it as an encoding that is supported.
Thanks.
-NS

Thank you. That worked.
I implemented a custom CharsetProvider and installed it per the instructions in the javadoc. I'll provide the implementation for future reference:
import java.nio.charset.Charset;
import java.nio.charset.spi.CharsetProvider;
import java.util.Iterator;
public class UserDefinedCharsetProvider extends CharsetProvider {
     public Iterator<Charset> charsets() {
          return null;
     public Charset charsetForName(String charsetName) {
          return Charset.forName("UTF-8");
}

Similar Messages

  • Java.io.UnsupportedEncodingException: Media Type of a TextResponseWrapper

    Hi,
    I am trying to view intermedia image using jsp..similar to photo album demo..what does the following exception mean..
    java.io.UnsupportedEncodingException: Media Type of a TextResponseWrapper must start with "text/"
         at oracle.webdb.provider.v2.utils.http.TextResponseWrapper.getData(Unknown Source)
         at oracle.webdb.provider.v2.utils.http.TextResponseWrapper.getData(Unknown Source)
         at oracle.portal.provider.v2.render.http.ResourceRenderer.renderBody(Unknown Source)
         at oracle.portal.provider.v2.render.RenderManager.render(Unknown Source)
         at oracle.portal.provider.v2.DefaultPortletInstance.render(Unknown Source)
         at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.showPortlet(Unknown Source)
         at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.handleHttp(Unknown Source)
         at java.lang.reflect.Method.invoke(Native Method)
         at oracle.webdb.provider.v2.adapter.SOAPServlet.doHTTPCall(Unknown Source)
         at oracle.webdb.provider.v2.adapter.SOAPServlet.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
         at com.evermind[Oracle9iAS (9.0.2.3) Containers for J2EE].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:66)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:284)
         at com.evermind[Oracle9iAS (9.0.2.3) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:539)
         at com.evermind[Oracle9iAS (9.0.2.3) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:285)
         at com.evermind[Oracle9iAS (9.0.2.3) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:771)
         at com.evermind[Oracle9iAS (9.0.2.3) Containers for J2EE].server.http.AJPRequestHandler.run(AJPRequestHandler.java:170)
         at com.evermind[Oracle9iAS (9.0.2.3) Containers for J2EE].server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:802)
         at java.lang.Thread.run(Thread.java:484)

    Oh, I see, you are running you JSP from a portal environment?.... I would ask this question in the Portal forum.
    It also might depend upon the version and implementation of JSP you are using. We have made images from a JSP, but newer versions of JSP server software might explicitly disallow it since it is now explicitly unsupported.

  • Java.io.UnsupportedEncodingException: KOI8-U

    I'm getting a host of exceptions from my bounce mail processor.
    Does anyone have any link or book recommendations where I can find out more about this? Or suggestions?
    14:58:01,130 ERROR [BouncedMailJob] Unknown encoding type: null
    java.io.UnsupportedEncodingException: KOI8-U
            at sun.io.Converters.getConverterClass(Converters.java:218)
            at sun.io.Converters.newConverter(Converters.java:251)
            at sun.io.ByteToCharConverter.getConverter(ByteToCharConverter.java:68)
            at sun.nio.cs.StreamDecoder$ConverterSD.<init>(StreamDecoder.java:224)
            at sun.nio.cs.StreamDecoder$ConverterSD.<init>(StreamDecoder.java:210)
            at sun.nio.cs.StreamDecoder.forInputStreamReader(StreamDecoder.java:77)
            at java.io.InputStreamReader.<init>(InputStreamReader.java:83)
            at com.sun.mail.handlers.text_plain.getContent(text_plain.java:64)
            at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:745)
            at javax.activation.DataHandler.getContent(DataHandler.java:501)
            at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1342)
            at com.imc.quartz.jobs.BouncedMailJob.dumpPart(BouncedMailJob.java:540)
            at com.imc.quartz.jobs.BouncedMailJob.execute(BouncedMailJob.java:260)
            at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
            at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)Thanks!

    I found a "Supported Encodings" page in the documentation for my Java installation. It says that Java 1.4 supports KOI8-R but not KOI8-U. So the Ukrainians are left out again :)
    I had similar problems when I had to read e-mail messages encoded in UTF-7, which apparently is not uncommon in e-mail but still not supported by Java. So I had code like this:ContentType ct = new ContentType(p.getContentType());
    String charset = ct.getParameter("charset");
    Object o = null;
    // If the charset is UTF-7, call the method for converting the bytes to a String.
    // We have to do this because UTF-7 isn't a supported charset in Java.
    if ("UTF-7".equalsIgnoreCase(charset) || "UNICODE-1-1-UTF-7".equalsIgnoreCase(charset)) {
      InputStream in = p.getInputStream();
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      int c;
      while ((c = in.read()) != -1) {
        out.write(c);
      ByteToCharUTF7 btc = new ByteToCharUTF7();
      byte[] bytes = out.toByteArray();
      char[] chars = new char[bytes.length];
      int realLength = btc.convert(bytes, 0, bytes.length, chars, 0, chars.length);
      o = new String(chars, 0, realLength);
    } else {
      o = p.getContent();
    }Where that ByteToCharUTF7 is a class that extends sun.io.ByteToCharConverter and overrides a method whose signature ispublic int convert(
      byte[] bytes, int byteStart, int byteEnd, char[] chars, int charStart, int charEnd)
      throws sun.io.ConversionBufferFullException, sun.io.UnknownCharacterExceptionThe purpose of that method is to take an array of bytes and decode it to an array of chars, using (in your case) the rules for decoding KOI8-U. You would have to write that yourself, but if they are similar to the rules for KOI8-R then perhaps you could use KOI8-R to help you.
    I believe that in Java 5 there is a way to insert new charsets into the system, so if you are using Java 5 then you should investigate that. You would still have to write the charset decoder yourself, though, as Java 5 still doesn't support KOI8-U. Unless you can find it already done on the Internet.

  • Java.io.UnsupportedEncodingException: ISO8859_6

    Bonjour,
    Lorsque je clique sur le lien d'une application web, présent dans le manager Tomcat (v 7.0.4) j'obtiens le message d'erreur suivant :
    java.io.UnsupportedEncodingException: ISO8859_6
    (j'ai jre 1.6 release 22).
    Je ne trouve rien de probant sur le web.
    Quelqu'un peut-il m'aider svp ?
    Merci de votre participation.
    JP
    Hi,
    When I clik on the url of a web application, hosted on a Windows 2003 server with Tomcat v7.0.4 and jre1.6 release 22, I allways have the following message :
    java.io.UnsupportedEncodingException: ISO8859_6
    Does someone could possibly help me please ?
    JP
    Sorry for my poor english

    Oh, I see, you are running you JSP from a portal environment?.... I would ask this question in the Portal forum.
    It also might depend upon the version and implementation of JSP you are using. We have made images from a JSP, but newer versions of JSP server software might explicitly disallow it since it is now explicitly unsupported.

  • How to resolve the java.io.UnsupportedEncodingException: ${charset}

    Hi there,
    I deployed an appliaction called "JGossip" in my machine.
    After deployment while accessing the URL http://localhost:8080/jgossip/jgossip, the following error stack trace is thrown-
    java.io.UnsupportedEncodingException: ${charset}
         at sun.io.Converters.getConverterClass(Converters.java:218)
         at sun.io.Converters.newConverter(Converters.java:251)
         at sun.io.ByteToCharConverter.getConverter(ByteToCharConverter.java:68)
         at java.lang.StringCoding.decode(StringCoding.java:224)
         at java.lang.String.<init>(String.java:405)
         at java.lang.String.<init>(String.java:433)
         at org.apache.coyote.tomcat4.CoyoteRequest.setCharacterEncoding(CoyoteRequest.java:1225)
         at org.apache.coyote.tomcat4.CoyoteRequestFacade.setCharacterEncoding(CoyoteRequestFacade.java:153)
         at org.jresearch.gossip.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:171)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:595)
    I thought the character encoding is failed and placed the charsets.jar,rt.jar,commons-i18n-0.4.jar in the deployed folder(Web-inf/lib). But still the exception is observed.
    Please help me out.
    Thanks in advance,
    Venkat

    Hi,
    What version of the driver are you using? The "OALL8 is in an inconsistent state" exception usually indicates a problem in the protocol. When this exception occurs the protocol is broken and the connection can't be used anymore. I would suggest that you try using the 11.2.0.1 JDBC driver that you can download from:
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
    Regards,
    Jean

  • Java.io.UnsupportedEncodingException: EUC-JP on Windows

    Hi,
    I've developed a Java class that works on a web page containing Japanese characters, but I have two different behavior on MacOSX and Windows.
    On MacOSX: I can see CORRECTLY characters both on a Swing Component and on a temporary file written by my Java class and opened with a browser.
    On Windows: When I run my class I obtain the following error
    java.io.UnsupportedEncodingException: EUC-JP
            at sun.nio.cs.StreamDecoder.forInputStreamReader(Unknown Source)
            at java.io.InputStreamReader.<init>(Unknown Source)Why???
    Thanks in advance.
    Elisa

    That message isn't saying EUC-JP is the wrong encoding, it's saying it can't find an encoding called "EUC-JP". Try running this code: import java.util.*;
    import java.nio.charset.*;
    public class Test
      public static void main(String[] args) throws Exception
        SortedMap<String, Charset> cs = Charset.availableCharsets();
        System.out.printf("%d charsets:%n", cs.size());
        for (String s : cs.keySet())
          System.out.println(s);
    } I get 162 names, the third one being "EUC-JP". (WinXP SP3, JDK 1.6.0_12)

  • Problem with file download in oracle portal:UnsupportedEncodingException

    Hi,
    I'm developing a struts application inside Oracle Portal, when i click on a
    action link i need to download a file.
    <pdk-struts-html:link action="/fileDownload2Action?file=myfile.txt">Click Here to See the PDF</pdk-struts-html:link>
    i've tried to use org.apache.struts.actions.DownloadAction as follows:
    public class MyExampleFileDownload extends DownloadAction{
    protected StreamInfo getStreamInfo(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    // File Name
    String fileName = mapping.getParameter();
    // Set the content disposition
    response.setHeader("Content-disposition",
    "attachment; filename=" + fileName);
    // Download a "pdf" file - gets the file name from the
    // Action Mapping's parameter
    String contentType = "application/pdf";
    File file = new File(fileName);
    return new FileStreamInfo(contentType, file);
    but on the forward i receive the following exception:
    received IOException
    java.io.UnsupportedEncodingException: Media Type of a TextResponseWrapper must start with "text/"
    at oracle.webdb.provider.v2.utils.http.TextResponseWrapper.getData(Unknown Source)
    at oracle.webdb.provider.v2.utils.http.TextResponseWrapper.getData(Unknown Source)
    at oracle.portal.provider.v2.render.http.AbstractResourceRenderer.renderBody(Unknown Source)
    at oracle.portal.provider.v2.render.RenderManager.render(Unknown Source)
    at oracle.portal.provider.v2.DefaultPortletInstance.render(Unknown Source)
    at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.showPortlet(Unknown Source)
    at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.handleHttp(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at oracle.webdb.provider.v2.adapter.SOAPServlet.doHTTPCall(Unknown Source)
    at oracle.webdb.provider.v2.adapter.SOAPServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
    ---end
    so it seems that struts forward in oracle have to be only text/html files
    but i don't wanto to go tio another page, just download a file on the same page
    after some control in my action.
    Could you suggest me any alternative solution?
    Regards,
    Francesco Rizzello

    Hi,
    Did this work ? :-
    Struts Download action portlet:UnsupportedEncodingException
    Regards,
    Sandeep

  • How to use padding scheme FIPS81 in java plz help?

    Plz refer the below code using this code I m trying to decrypt XLS file using pass phrase.
    I m using the same pass phrase which was used @ the time of encryption.
    But the problem I m facing is that the file was encrypted in DOT NET_ using padding scheme FIPS81 and there impelmentation of FIPS81 is not available in JAVA so that it gives exception at the time of decryption which is given below
    Exception : javax.crypto.BadPaddingException: Given final block not properly padded
    I urgently need the solution of this problem so somebody plz help me to find the solution of this problem.....Ur reply would be appriciated.....!!
    The File is Encrypted using below mechanism
    ALGORITHM : AES
    MODE : ECB
    PADDING SCHEME : FIPS81
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.UnsupportedEncodingException;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    public class DecryptTest {
         public static void main(String[] s){
              String passPhrase = "passphrase";
              String encFileName = "encsample.xls";
              String decFileName = "decsample.xls";
              FileInputStream encFileIn = null;
              FileOutputStream decFileOut = null;
              File f = null;
              byte[] message;
              try {
                   f = new File(encFileName);
                   encFileIn = new FileInputStream(f);
                   decFileOut = new FileOutputStream(decFileName);
                   message = new byte[encFileIn.available()]; //Read the encrypted file in from disk
                   encFileIn.read(message);
                   SecretKeySpec spec = new SecretKeySpec(passwordToKey (passPhrase), "AES");
                   //decrypt it
                   Cipher c = Cipher.getInstance("AES/ECB/NoPadding");
                   c.init(Cipher.DECRYPT_MODE, spec);
                   System.out.println("Block Size is >-->" + c.getBlockSize());
                   String decryptedString = new String(c.doFinal(message));
                   System.out.println("Decrypted message: " + decryptedString);
                   //To write into another files
                   decFileOut.write(decryptedString.getBytes());
              }catch (Exception e) {
                   System.out.println(e);
              }finally {
                   try {
                        encFileIn.close();
                        decFileOut.close();     
                   } catch (IOException ioe) {
         }Is there any mechanism is available for FIPS81 or Is there any third party Provider available for it plz reply........????????

    I suggest you look in google http://www.google.co.uk/search?q=SWF+java

  • Need help (java.lang.RuntimeException: Unknown/unsupported charset:)

    Hi,
    Previously our application is running fine in
    iPlanet web server 4 and some times in Tomcat. Now we
    are migrating this application to weblogic 8.1 due to
    some load.
    After migrating to weblogic 8.1 we are getting some
    exception.
    The exception is:
    Servlet failed with Exception
    java.lang.RuntimeException: Unknown/unsupported
    charset: - java.io.UnsupportedEncodingException:
    Charset: '' not recognized, and there is no alias for
    it in the WebServerMBean
    at
    weblogic.servlet.jsp.JspParser.parse(JspParser.java:288)
    at
    weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:125)
    In my Jsp page we have top declarations like in the
    below:
    <%@ include file="header.jsp" %>
    <%@ page import="com.customer.customercare.servlet.*"
    %>
    <%@ page import="com.customer.customercare.types.*" %>
    <%@ page import="com.customer.customercare.search.*"
    %>
    <%@ page import="com.customer.customercare.utils.*" %>
    <%@ page import="com.customer.customercare.log.*"%>
    <%@ page import="java.util.Date" %>
    <%@ page import="com.customer.customercare.utils.*" %>
    <%@ page
    import="com.customer.customercare.servlet.handler.*"
    %>
    <%@ page import="java.sql.Timestamp"%>
    <%@ page import="java.text.SimpleDateFormat"%>
    <%@ page import="java.util.StringTokenizer"%>
    <%@ page import="java.util.Calendar"%>
    We are not using any charter sets in the above page
    directory but we are using that in a meta tag:
    <meta http-equiv="Content-Type" content="text/html;
    charset=ISO-8859-1">
    This might cause any problem?
    I tried charset=UTF-8, windows-1252 and UTF-16. But i
    am getting the same error.
    The thing is i am not getting this error from the JSP
    page. This jsp page calls a java class, that java
    class has a prepared statement. When the prepared
    statement is executed or before execution, this error is thrown on weblogic console. That
    error is not related to SQL.
    I think "charset" exception means it should come in JSP only. But i don't know why it is coming in the java class? i am confused?
    I don't know why exactly that error is coming...?
    My application is compiled in JDK1.3.1_08 and running
    in weblogic 8.1 which internally uses JDK1.4. Is this
    because of version problem?
    I am creating the .war file from the command prompt
    which path is set to JDK1.3.1_08...
    Can anybody help me out in this problem?
    Thanks and Regards,
    Chandu.

    Hi,
              For this issue,The CR was filed in weblogic 8.1 sp2
              go through the link, you will find CR information in link.
              http://e-docs.bea.com/wls/docs81/notes/resolved_sp02.html#1390392
              -----Anilkumar kari

  • Interenent Explorer from Java

    Hello! I need to post data (for login data) using ie (internet explorer) and then to display the browser to user.
    I use JACOB for browser control and here is the code:
    package testJACOB;
    import java.io.UnsupportedEncodingException;
    import java.net.URLEncoder;
    import com.jacob.activeX.ActiveXComponent;
    import com.jacob.com.Dispatch;
    import com.jacob.com.SafeArray;
    import com.jacob.com.Variant;
    class IETest
    public static void main(String[] args)
    ActiveXComponent ie = new ActiveXComponent(
    "clsid:0002DF01-0000-0000-C000-000000000046"); //IE
    Object ieo = ie.getObject();
    String path = "http://localhost:3333/portal/Login";
    String postData = "userName=uuu&password=ppp";
    String content = null;
    try
    content = URLEncoder.encode(postData, "UTF-8");
    catch (UnsupportedEncodingException e)
    e.printStackTrace();
    SafeArray sa = new SafeArray(Variant.VariantByte, content.length());
    sa.fromByteArray(content.getBytes());
    Variant[] arg = new Variant[]{
    new Variant(path),
    new Variant(),
    new Variant(),
    new Variant(sa),
    new Variant("Content-type: application/x-www-form-urlencoded") };
    ie.invoke("Navigate2", arg);
    Dispatch.put(ieo, "Visible", new Variant(true));
    Browser sucsefully opens, but I get 'null' post data in my web-app. It seems that web-app got nothing in http-request for post data.
    What is wrong in my code?
    Thank you very much.
    Vladimir.

    WundahWheel,
    learn first how to use interfaces of WebBrowser Control. Here is a simple example. Substitute in NJAWIN WebBrowser Example (file WebBrowserComponent.java)
    public void DocumentComplete(
              Object srcObj,
              DispatchPtr pDisp,
              ObjectRef URL)
              throws COMException {
            System.out.println("DocumentComplete");
            if (doc == null && control != null) {
                doc = new MSHTML.IHTMLDocument2(control.getDocument());
                if (!doc.isNull())
                    DispatchPtr disp = doc.getScript();
                    IHTMLWindow2 win = new IHTMLWindow2(disp);
                    win.showModalDialog("http://www.google.com");
                    doc.addEventListener(
                        HTMLDocumentEvents2.class,
                        new DocumentListener());
                else {
                    doc = null;
                    return;
    }While invoking "DocumentComplete" event you will see WebBrowser Dialog.

  • Retrieving ODI variable in Java Beanshell (Target Beanshell Source Oracle)

    Hi Guys:
    I'm facing a simple problem, but I'm not able to find the solution in the documentation or any post in this forum. I have a procedure where I use both tabs (Source and Target) and need to retrive the result of the "StrParam" (Oracle query) into a BeanShell variable (OracleMessageData).
    In the target tab I have these commands (Java BeanShell Techonology):
    <@
    import java.io.FileNotFoundException;
    import java.io.InputStream;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.io.UnsupportedEncodingException;
    import java.util.ArrayList;
    String OracleMessageData = "#strParam";
    String PathOfXMLFiles = "<%=odiRef.getSchemaName("LS_FILE_XMLFULL", "D")%>";
    @>
    In the Source Tab, I have this command (Oracle Techonology):
    SELECT MESSAGEDATA FROM <%=odiRef.getSchemaName("LS_ORACLE_ODI_WRK", "D")%>.CONTENT_RIB_MSGDATA strParam
    How can I retrieve the content of the Source Command into the variable in the Target? The line bellow doesn't work:
    String OracleMessageData = "#strParam";
    I'm using ODI_11.1.1.6.0_GENERIC_111219.1055
    Regards.
    Luiz Araujo
    Edited by: Luiz_Araujo on 25/07/2012 06:43
    Edited by: Luiz_Araujo on 25/07/2012 06:45

    Hi Luiz
    Use Below query on source tab.
    SELECT MESSAGEDATA STRPARAM FROM <%=odiRef.getSchemaName("LS_ORACLE_ODI_WRK", "D")%>.CONTENT_RIB_MSGDATA
    Then on target tab use
    String OracleMessageData = "#STRPARAM ";
    If it wont work try putting colon.
    String OracleMessageData = ":STRPARAM ";
    Thanks.

  • Problem with  java.lang.reflect in Eclipse

    I'm just reading java tutorial about that library, but when i'm trying to execute those example program's e.g
    import java.lang.reflect.Constructor;
    import java.lang.reflect.Type;
    import static java.lang.System.out;
    public class ConstructorSift {
        public static void main(String... args) {
         try {
             Class<?> cArg = Class.forName(args[1]);
             Class<?> c = Class.forName(args[0]);
             Constructor[] allConstructors = c.getDeclaredConstructors();
             for (Constructor ctor : allConstructors) {
              Class<?>[] pType  = ctor.getParameterTypes();
              for (int i = 0; i < pType.length; i++) {
                  if (pType.equals(cArg)) {
                   out.format("%s%n", ctor.toGenericString());
                   Type[] gpType = ctor.getGenericParameterTypes();
                   for (int j = 0; j < gpType.length; j++) {
                   char ch = (pType[j].equals(cArg) ? '*' : ' ');
                   out.format("%7c%s[%d]: %s%n", ch,
                        "GenericParameterType", j, gpType[j]);
                   break;
    // production code should handle this exception more gracefully
         } catch (ClassNotFoundException x) {
         x.printStackTrace();
    in Eclipse i've got nothing in my output console :/
    no errors, no warnings, no text ..... (it was terminated correctly)
    Can somebody tell me what should I do to make it work properly ?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    In program arguments, you should not have ConstructorSift but only java.util.Formatter and java.util.Locale.
    (Eclipse : run dialog | arguments tab | program arguments)
    This is the output you should get:
    $ java ConstructorSift java.util.Formatter java.util.Locale
    public java.util.Formatter(java.util.Locale)
    *GenericParameterType[0]: class java.util.Locale
    public java.util.Formatter(java.lang.Appendable,java.util.Locale)
    GenericParameterType[0]: interface java.lang.Appendable
    *GenericParameterType[1]: class java.util.Locale
    public java.util.Formatter(java.lang.String,java.lang.String,java.util.Locale) throws java.io.FileNotFoundException,java.io.UnsupportedEncodingException
    GenericParameterType[0]: class java.lang.String
    GenericParameterType[1]: class java.lang.String
    *GenericParameterType[2]: class java.util.Locale
    public java.util.Formatter(java.io.File,java.lang.String,java.util.Locale) throws java.io.FileNotFoundException,java.io.UnsupportedEncodingException
    GenericParameterType[0]: class java.io.File
    GenericParameterType[1]: class java.lang.String
    *GenericParameterType[2]: class java.util.Locale
    public java.util.Formatter(java.io.OutputStream,java.lang.String,java.util.Locale) throws java.io.UnsupportedEncodingException
    GenericParameterType[0]: class java.io.OutputStream
    GenericParameterType[1]: class java.lang.String
    *GenericParameterType[2]: class java.util.Locale
    Hope that help,
    Jack

  • Java HTTP Post Raw Data

    Hi All,
    I'm looking to make an HTTP post request given the raw data that I have. I've spent a while looking for the solution, made a handful of attempts and I'm looking for a little bit of help. The PHP code for what I'm looking to do looks like this:
    <?
    $url="http://localhost:3009";
    $postdata="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <hi></hi>";
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
    $result = curl_exec($ch);
    curl_close($ch);
    echo($result);
    ?>
    My attempt was this:
         private String setXmlPostHeader(Document doc, PostMethod postMethod) throws java.io.IOException, java.io.UnsupportedEncodingException, javax.xml.transform.TransformerException
              ByteArrayOutputStream xmlBytes = new ByteArrayOutputStream();
              XML.serialize( doc, xmlBytes );
              final byte[] ba = xmlBytes.toByteArray();
              String data = new String(ba, "utf-8");
              InputStreamRequestEntity re = new InputStreamRequestEntity(new ByteArrayInputStream(ba));
              postMethod.setRequestEntity(re);
              postMethod.setRequestHeader("Content-type", MediaType.XML.toString() + "; charset=UTF-8");
              return data;
    And then executing the postMethod, but this simply is a post containing no data. Does anyone see anything wrong that I'm doing? Is there an easy way to set the raw http post data in java like there is in php? Thanks.
    -Ken

    Look at the PostMethod documentation. You need to set the multipart request.

  • UnsupportedEncodingException

    I have written a simple servlet to read the contents of an http request and print it out. The request contains a soap message, but I am not parsing it in this servlet, simply printing the request contents out. I am using iPlanet Web Server 6.0. When my servlet tries to do request.getReader() I get:
    java.io.UnsupportedEncodingException - UTF-8
    With trace I can see the contents of the request being sent:
    Client Data, POST /missingkids/servlet/SimpleSoapHttpReceiveServlet HTTP/1.1
    SOAPAction: "uri:SoapHttpReceiveServlet"
    Content-Type: text/xml; charset="UTF-8"
    User-Agent: SOAP Toolkit 3.0
    Host: localhost:8060
    Content-Length: 1381
    Connection: Keep-Alive
    Cache-Control: no-cache
    Pragma: no-cache
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
         xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
         xmlns:SOAPSDK2= "http://www.w3.org/2001/XMLSchema-instance"
         xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
         xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
         xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Header>
    <Message>
    <From xsi:type="xsd:string">me</From>
    <To xsi:type="xsd:string">You</To>
    <Messageid xsi:type="xsd:string">9999</Messageid>
    </Message>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
    My servlet code:
    if(request.getContentLength() > 0)
    try{
    java.io.BufferedReader reader = request.getReader();
         String line = null;
         while((line = reader.readLine()) != null)
              System.out.println(line);
    catch(Exception e)
         System.out.println(e);
    Any ideas why I get this error? Thanks.

    Try not putting the quotes around UTF-8.

  • Struts Download action portlet:UnsupportedEncodingException

    Hi,
    I'm developing a struts application inside Oracle Portal, when i click on a
    action link i need to download a file.
    <pdk-struts-html:link action="/fileDownload2Action?file=myfile.txt">Click Here to See the PDF</pdk-struts-html:link>
    i've tried to use org.apache.struts.actions.DownloadAction as follows:
    public class MyExampleFileDownload extends DownloadAction{
    protected StreamInfo getStreamInfo(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    // File Name
    String fileName = mapping.getParameter();
    // Set the content disposition
    response.setHeader("Content-disposition",
    "attachment; filename=" + fileName);
    // Download a "pdf" file - gets the file name from the
    // Action Mapping's parameter
    String contentType = "application/pdf";
    File file = new File(fileName);
    return new FileStreamInfo(contentType, file);
    but on the forward i receive the following exception:
    received IOException
    java.io.UnsupportedEncodingException: Media Type of a TextResponseWrapper must start with "text/"
    at oracle.webdb.provider.v2.utils.http.TextResponseWrapper.getData(Unknown Source)
    at oracle.webdb.provider.v2.utils.http.TextResponseWrapper.getData(Unknown Source)
    at oracle.portal.provider.v2.render.http.AbstractResourceRenderer.renderBody(Unknown Source)
    at oracle.portal.provider.v2.render.RenderManager.render(Unknown Source)
    at oracle.portal.provider.v2.DefaultPortletInstance.render(Unknown Source)
    at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.showPortlet(Unknown Source)
    at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.handleHttp(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at oracle.webdb.provider.v2.adapter.SOAPServlet.doHTTPCall(Unknown Source)
    at oracle.webdb.provider.v2.adapter.SOAPServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
    ---end
    so it seems that struts forward in oracle have to be only text/html files
    but i don't wanto to go tio another page, just download a file on the same page
    after some control in my action.
    Could you suggest me any alternative solution?
    Regards,
    Francesco Rizzello

    Hi,
    I have done everything as mentioned by various web sites to develop a pdk-struts form, my java code compiles, the jsps compiles everything compiles correctly, and the portal shows up.
    I also put a HTML form in it.
    When a I deploy I can see and work with the HTML form but the portal is not recogniziing the pdk-struts tags, though I made the pdk-struts-html.tld part of the WEB-INF/ yet it wont show up the pdk-struts form.
    Any help regarding this will be highly appreciated.
    Regards,
    Ram Srinivasan

Maybe you are looking for

  • Flatfile load in BI 7.0

    Hi Friends, Sorry to ask this question now....i have searched the forum.......i haven't got solution. can you please give a the solution for it. I am trying to load data from Flat File that is CSV from my workstation. while creating transformation fo

  • Time Machine and Parallels

    Will Time machine backup the data that I create in Windows Applications running under Parallels? I am running Quicken for Windows under Parallels on my IMAC intel core 2 Duo running OS x 10.5.1

  • Doubt in unit conversion

    in bapi process when taking contract reference to sales order conversion errors are if suppose my Quantity is '12' ....  i am entering quantity as 12 in contract  it reflects as 0.012 in order for this i am entering like this  "0000000012000" then on

  • Data transfer from Preprod to Prod

    Hi We had an issue in BI where the database table got deleted in production for one of the infocubes. We are doing a restore of Production data back up into Preproduction and then take the data from a praticular infocube to the production. Now ,my qu

  • Importing a class called Textreader

    Hi, Sorry ive searched the forums and i know theres loads of topics aleady started on this subject but im new to java and im having trouble understanding how to import classes that ive got from another source so that i can use it in my own classes. S