A wierd problem while encoding URLs

Hi all,
I'm facing a wierd problem with the java.net.URLEncoder class. The encode function in this class is used for encoding URL based on standards like "UTF-8" etc..
I need to encode the URLs, because i have to send this information in a XML to another server.. Here's what the URLEncoder is doing if i give it the URL
http://mydomain.com:80/myServlet?_fileName=filename.mp3&_useStreaming=true
its encoding this as
http%3A%2F%2Fmydomain.com%3A80%2FmyServlet%3F_fileName%3Dfilename.mp3%26_useStreaming%3Dtrue
but, all I wanted is to encode only '&' character ( as XML misinterprets this character with schemes ).
So, my question is .. is there any way that i can selectively encode the characters in the URL?
Any help wud be appriciated in this regard. :-)

I accept what you are saying.. URLEncoder encodes any string that's passed to it..
I infact have two different problems in hand.. The reason i mentioned only one above is because the solution to the first problem cud as well solve the second.. Anyway, here's the second problem ...
I'm recieving an XML from a server, where i get the URL info and i have to download the CONTENT from that URL.. Sample xml is given below
<Music>
<Singer>Tata Young</Singer>
<contentURL>http://myMusic.com/sexy naughty.mp3</contentURL>
</Music>
if you see the URL in the xml, that infact contains spaces in it.. I have my logic which checks if the given URL is a absolute URL or relative URL
if( relative URL)
I append "http://domain name:" stuff to make it absolute
else
i connect to the URL directly to get the Content
I'm using
URI i = new URI(str);
i.isAbsolute() method to determine whether its a absolute URL or not..
but this method doesn't seem to work for URLs that have spaces in them.. So, i encoded the URL and tried passing it to the method.. but it still doesn't work..
I probed into URI class itself and found out to my amazement that URI class assumes that URL contains only alpha numeric characters and few special characters like '+' , '/' , ':' etc..
Since the encoded URL has '%' character in it.. its not able to say that its a absolute URL.. Tht's the reason I asked for selective encoding.. ( say, which encodes only [space] character)..

Similar Messages

  • Problem while creating URL iview (in EP7.0)

    Hi,
    I encountered a problem while creating URL iview (in EP7.0) as when I selected the iview template for creating the URL iview, the content area got displayed as
    "No templates to display. You are not assigned to any existing templates."
    please assist me in this regard.
    Thanks,
    Suri

    Hi Manoj,
    Thank you for your reply.
    I am still getting the same messages even after creating the iview template in EP7.0
    Created through:
    content Admin --> portal content --> <folder>new --> iview  --> seleting "Portal component - create an iView from a portal component contained in a deployed portal archive (PAR file)" <next> --> seleting "com.sap.portal.appintegrator.sap" <next> --> webdynpro <next> --> finish.
    Open object for editing...--> Object is a Template to Yes.
    Result :
    content Admin --> portal content --> <folder>new --> iview --> seleting "iview template- create an iView from an existing iView template" <next> which displays the same message.
    "No templates to display. You are not assigned to any existing templates."
    Rgrds,
    Suri.

  • Experiencing the problems while encoding the barcode with Code 128 font

    Hi Tim,
    Hope you are doing good.
    We are experiencing the problems while encoding the barcode with Code 128 font.we have followed the Oracle BI Publisher Blog i.e Barcoding 102 http://blogs.oracle.com/xmlpublisher/discuss/msgReader$281.
    Before applying the encoding Java class we were able to display the barcode but after applying this encoding Java class we are not able to display the barcode.
    We are requesting you to help us for encoding the barcode with Code 128 font and read barcode by scanner.
    We will appreciate and thankful if anybody help us in this regard
    Thanks,
    SubbaRao.

    Hi Tim,
    I am trying to create 128 Barcode, output shows little junk characters. I followed the your "Barcoding 102 instrucitons but no luck. I apprciate your help if you provide some help on this.
    http://blogs.oracle.com/xmlpublisher/2006/06/06
    1. Created Java class under $JAVA_TOP/oracle/apps/oracle/xdo/template/util/barcoder
    2. Registeted and applied the format the barcode to the form field. I will sedn my XML, RTF and Java class, Would you pleae advice me on this
    Thanks
    Venu

  • PROBLEM while using URL in order to open a file from a servlet

    Hi,
    I am having a problem while trying to open a file from my servlet by using URL connection. Following is my code sample. what happens is when I first run my project it opens the file but after that when I rerun it again and again it sometimes opens it and sometimes not. if it can't open it it gives an error saying "the file is damaged and couldn't be repaired". I don't get any exceptions. if you guys can help me I will appreciate it so much... thanks.
    here is my code :
    URL url = new URL("http://demobcs.ibm.com:81/test.pdf");
    resp.setContentType(getContentType("http://demobcs.ibm.com:81/test.pdf"));
              ServletOutputStream sos = null;
              BufferedInputStream bis = null;
              try {
                   sos = resp.getOutputStream();
              } catch (Exception e) {
                   System.out.println("exception !!!!");
                   e.printStackTrace();
              System.out.println("burada2");
              try {
                   byte[] bytes = new byte[4096];
                   //bis = new BufferedInputStream(conn.getInputStream());
                   DataInputStream in = new DataInputStream(url.openStream());
                   //DataInputStream in = new DataInputStream(conn.getInputStream());
                   bis = new BufferedInputStream(in);
                   int j;
                   while ((j = bis.read(bytes, 0, 4096)) != -1) {
                        try {
                             sos.write(bytes, 0, 4096);
                             System.out.println("file is being read ...:");
                        } catch (Exception e) {
                             e.printStackTrace();
                   in.close();
                   bis.close();          
                   //sos.close();
              } catch (Exception e) {
                   System.out.println("exception :"+e.toString());
                   e.printStackTrace();
              }

    You are writing (<filesize> mod 4096) bytes of crap at the end of the file. Use your variable j instead for the number of bytes to write in your loop.

  • A peculiar problem with encode url

    Hi,
    I have the following code snippet in jsp
    <a href="<%=urlencoder.encode("cxc.jsp?P1=RWDS") %">> Rewards</a>
    But when this page is requested, the oracle application server responds with response 404 stating requested url not found.we aer using oracle application server 10g release 2.
    But without encoding the response is correctly displayed.
    has it got to do anything with encoding? or will it be required to change the code.
    But the same encoded url works perfectly fine on iplanet application server.
    Thanks in advance

    I was able to solve this by including the google code in an external PHP file as well. However if my template has a repeating region in it, and my contribute user adds a region from it, it breaks the code again :/
    Are there any other suggestions out there??

  • Problem while encoding JPEG image from JFrame paintComponent in a servlet

    Hello!
    I m developing webapplication in which I made one servlet that calls JFrame developed by me, and then encoding into JPEG image to send response on client browser. I m working on NetBeans 5.5 and the same code runs well. But my hosting server is Linux and I m getting the following error:
    java.awt.HeadlessException:
    No X11 DISPLAY variable was set, but this program performed an operation which requires it.
         java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
         java.awt.Window.<init>(Window.java:406)
         java.awt.Frame.<init>(Frame.java:402)
         java.awt.Frame.<init>(Frame.java:367)
         javax.swing.JFrame.<init>(JFrame.java:163)
         pinkConfigBeans.pinkInfo.pinkModel.pinkChartsLib.PinkChartFrame.<init>(PinkChartFrame.java:36)
         pinkConfigBeans.pinkController.showLastDayRevenueChart.processRequest(showLastDayRevenueChart.java:77)
         pinkConfigBeans.pinkController.showLastDayRevenueChart.doGet(showLastDayRevenueChart.java:107)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.
    I m building the application in NetBeans and when runs then it runs well, even while browsing from LAN. But when I place the web folder creted under buil directory of NetBeans in the Tomcat on Linux, then it gives above error.
    Under given is the servlet code raising exception
    response.setContentType("image/jpeg"); // Assign correct content-type
    ServletOutputStream out = response.getOutputStream();
    /* TODO GUI output on JFrame */
    PinkChartFrame pinkChartFrame;
    pinkChartFrame = new PinkChartFrame(ssnGUIAttrInfo.getXjFrame(), ssnGUIAttrInfo.getYjFrame(), headingText, xCordText, yCordText, totalRevenueDataList);
    pinkChartFrame.setTitle("[::]AMS MIS[::] Monthly Revenue Chart");
    pinkChartFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    //pinkChartFrame.setVisible(true);
    //pinkChartFrame.plotDataGUI();
    int width = 760;
    int height = 460;
    try {
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    pinkChartFrame.pinkChartJPanel.paintComponent(g2);
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    encoder.encode(image);
    } catch (ImageFormatException ex) {
    ex.printStackTrace();
    response.sendRedirect("index.jsp");
    } catch (IOException ex) {
    ex.printStackTrace();
    response.sendRedirect("index.jsp");
    out.flush();
    Do resolve anybody!
    Edited by: pinkVag on Oct 15, 2007 10:19 PM

    >
    I m developing webapplication in which I made one servlet that calls JFrame developed by me, and then encoding into JPEG image to send response on client browser. I m working on NetBeans 5.5 and the same code runs well. But my hosting server is Linux and I m getting the following error:
    java.awt.HeadlessException: >That makes sense. It is saying that you cannot open a JFrame in an environment (the server) that does not support GUIs!
    To make this so it will work on the server, it will need to be recoded so that it uses the command line only - no GUI.
    What is it exactly that PinkChartFrame is generated an image of? What does it do? (OK probably 'generate a chart') But what APIs does it use (JFreeChart or such)?

  • Problem while passing url's for URLRequest() class as parameter in Flash

    Hi all,
         I am calling java servlets from flash using the following code[below is a sample Flash code for calling a java servlet in Flash which I am using]:
    ...bla ...bla
    String url_String="http://localhost:8080/servlet/getViews";
    var req:URLRequest = new URLRequest(url_String);
    ...bla ...bla
    In this case, the servlet is called/working fine only in my system where the flash application is deployed & not working when I execute the application in different system using the "IPAddress" of my system.
    So, What changes I need to make in above Flash code in order to call the same servlet successfully from my system and as well as from other systems?
    (OR)
    Is there any need to pass the servlet-url's relative instead of absolute?
    If so,
    How can we pass relative-path of url's in Flash? &&
    Can anyone explain me with an example?
    Atlast, Can anyone tell me how to change my above code to pass the url 'relative' rather than 'absolute'?
    If I pass the url relatively, does my issue gets resolved?
    If, Please, can anyone help me by giving solution to my problem... [Or] else, to either of my queries or both...
    Thanks in advance...
    I am waiting for your replies...
    Srihari.Ch

    Did you read the ActionScript 3.0 documentation I linked to in my last post?
    var request:URLRequest = new URLRequest("XMLFile.xml");
    Example of using absolute URL:
    var request:URLRequest = new URLRequest("http://localhost:8080/servlet/getViews");
    Example of using relative URL:
    var request:URLRequest = new URLRequest("servlet/getViews");
    If the server port (8080) needs to be specified, you could declare a variable for the server URL and use it as a parameter.
    var serverURL:String = "http://localhost:8080/";
    var request:URLRequest = new URLRequest(serverURL + "servlet/getView");

  • Facing problems while encoding..

    Hi guys,
    Finally i am able to send the TV channel signals by using live encoder. It works good with few problems .
    problems:
    1) In player after connect to server the screen( channel screen) is not exactly showing that means bottom 1/4 portion is cut off. Is there any setting to avoid this problem??
    2) After connect to server, on client machine the video is not running smoothly,it breaks upto 2 sec then skip that portion and then continue...it is continuing like this for every 5min
    3) On FMLE the input and output panel showing with high color quality but once it send to server(even local server also) on web casting  it delivers very poor quality
    is there any setting to solve this problem?
    4)Last question (but not final one) i played  all these games on my local machine (with static IP) for testing purpose, i planning to take dedicated server in order to webcast my client channel for public. Please give me some suggestions which one i can prefer in the sense bandwidth,speed,RAM..etc so that i can make my client satisfy by avoiding all problems mentioned above..
    Waiting for your reply
    Thanks in advance

    Can you give some details about your current configuration:
    1. What are you using to capture your video source?
    2. What resolution/output size/bitrate are you using?
    3. What is the bandwidth on the connection between your computer running FMLE and the server?
    4.  What computer are you using to encode (CPU/RAM/etc)?

  • Problem while encoding byte[] with RSA

    Hi all,
    I am trying to encode a byte array using RSA encoding. I use the following code (It tries to encode a byte array, "data", with the public key, "publicKey"):
    byte[] encryptData  = new byte[data.length];
    Cipher cipher = Cipher.getInstance("RSA");
    cipher.init(Cipher.ENCRYPT_MODE, publicKey);
    ByteArrayInputStream inStream = new ByteArrayInputStream(data);
    CipherInputStream cipherStream = new CipherInputStream(inStream, cipher);
    cipherStream.read(encryptData);And all I get is a empty array: encryptData is full of zero!
    Does anyone have an idea about what I did wrong ?
    Thanks in advance

    ok...
    Indeed, my data length is far more than my key length. So you tell me that I should cut my data to have some chunks of smalled size (key length max), and use directly something Cipher ?
    EDIT: Oh, I just got it. I should cut the data into bits of KEY_SIZE minus 11 (for the minimum padding). I'm going to test that.
    EDIT 2: Ok, that's fine, you were right. My error was to use CipherInputStream on data which length was more than key size minus padding. Thank you very much for your answer.
    Edited by: Reeter on Mar 29, 2009 1:10 PM
    Edited by: Reeter on Mar 29, 2009 1:35 PM

  • Encoding problem while reading binary data from MQ-series

    Dear all,
    we are running on 7.0 and we have an encoding problem while reading binary data from MQ-series. Because we are getting flat strings from queue we use module "Plain2ML" (MessageTransformBean) for wrapping xml-elements around the incoming data.
    The MQ-Series-Server is using CCSID 850, which we configured in connection parameters in communication channel (both parameters for Queuemanager CCSID and also CCSID of target).If there are special characters in the message (which HEX-values differ from codepage to codepage) we get errors in our adapter while executing, please see stack-trace for further analysis below.
    It seems to us that
    1. method ByteToCharUTF8.convert() expects UTF-8 in binary data
    2. Both CCSID parameters are not used anyway in JMS-adapter
    How can we solve this problem without changing anything on MQ-site?
    Here is the stack-trace:
    Catching com.sap.aii.af.mp.module.ModuleException: Transform: failed to execute the transformation: com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'sun.io.MalformedInputException'; nested exception caused by: sun.io.MalformedInputException caused by: com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'sun.io.MalformedInputException'; nested exception caused by: sun.io.MalformedInputException
        at com.sap.aii.af.modules.trans.MessageTransformBean.throwModuleException(MessageTransformBean.java:453)
        at com.sap.aii.af.modules.trans.MessageTransformBean.process(MessageTransformBean.java:387)
        at com.sap.aii.af.mp.module.ModuleLocalLocalObjectImpl0_0.process(ModuleLocalLocalObjectImpl0_0.java:103)
        at com.sap.aii.af.mp.ejb.ModuleProcessorBean.process(ModuleProcessorBean.java:292)
        at com.sap.aii.af.mp.processor.ModuleProcessorLocalLocalObjectImpl0_0.process(ModuleProcessorLocalLocalObjectImpl0_0.java:103)
        at com.sap.aii.adapter.jms.core.channel.filter.SendToModuleProcessorFilter.filter(SendToModuleProcessorFilter.java:84)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.ConvertBinaryToXiMessageFilter.filter(ConvertBinaryToXiMessageFilter.java:304)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.ConvertJmsMessageToBinaryFilter.filter(ConvertJmsMessageToBinaryFilter.java:112)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.InboundDuplicateCheckFilter.filter(InboundDuplicateCheckFilter.java:87)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.TxManagerFilter.filterSend(TxManagerFilter.java:123)
        at com.sap.aii.adapter.jms.core.channel.filter.TxManagerFilter.filter(TxManagerFilter.java:59)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.DynamicConfigurationFilter.filter(DynamicConfigurationFilter.java:72)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.PmiAgentFilter.filter(PmiAgentFilter.java:66)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.InboundCorrelationFilter.filter(InboundCorrelationFilter.java:60)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.JmsHeadersProfileFilter.filter(JmsHeadersProfileFilter.java:59)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageInvocationsFilter.filter(MessageInvocationsFilter.java:89)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.JarmMonitorFilter.filter(JarmMonitorFilter.java:57)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.ThreadNamingFilter.filter(ThreadNamingFilter.java:62)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.SenderChannelImpl.doReceive(SenderChannelImpl.java:263)
        at com.sap.aii.adapter.jms.core.channel.ChannelImpl.receive(ChannelImpl.java:437)
        at com.sap.aii.adapter.jms.core.connector.MessageListenerImpl.onMessage(MessageListenerImpl.java:36)
        at com.ibm.mq.jms.MQMessageConsumer$FacadeMessageListener.onMessage(MQMessageConsumer.java:399)
        at com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl$JmsProviderMessageListener.onMessage(JmsMessageConsumerImpl.java:904)
        at com.ibm.msg.client.wmq.v6.jms.internal.MQMessageConsumer.receiveAsync(MQMessageConsumer.java:4249)
        at com.ibm.msg.client.wmq.v6.jms.internal.SessionAsyncHelper.run(SessionAsyncHelper.java:537)
        at java.lang.Thread.run(Thread.java:770)
    Caused by: com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'sun.io.MalformedInputException'; nested exception caused by: sun.io.MalformedInputException
        at com.sap.aii.messaging.adapter.Conversion.service(Conversion.java:714)
        at com.sap.aii.af.modules.trans.MessageTransformBean.processTransform(MessageTransformBean.java:538)
        at com.sap.aii.af.modules.trans.MessageTransformBean.processTransform(MessageTransformBean.java:528)
        at com.sap.aii.af.modules.trans.MessageTransformBean.processTransform(MessageTransformBean.java:471)
        at com.sap.aii.af.modules.trans.MessageTransformBean.process(MessageTransformBean.java:364)
        ... 36 more
    Caused by: sun.io.MalformedInputException
        at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:270)
        at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:287)
        at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:337)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:223)
        at java.io.InputStreamReader.read(InputStreamReader.java:208)
        at java.io.BufferedReader.fill(BufferedReader.java:153)
        at java.io.BufferedReader.readLine(BufferedReader.java:316)
        at java.io.LineNumberReader.readLine(LineNumberReader.java:176)
        at com.sap.aii.messaging.adapter.Conversion.convertPlain2XML(Conversion.java:310)
        at com.sap.aii.messaging.adapter.Conversion.service(Conversion.java:709)
        ... 40 more
    Any ideas?
    Kind regards, Stefan

    Hi Stefan,
    for the first MTB now we are using only one parameter: Transform.ContentType = text/plain;charset="ISO-8859-1"
    The second MTB, which does the XML-Wrapping, is configured like this:
    Transform.Class = com.sap.aii.messaging.adapter.Conversion
    Transform.ContentType = application/xml
    xml.conversionType = SimplePlain2XML
    xml.fieldNames = value
    xml.fieldSeparator = §%zulu§%
    xml.processFieldNames = fromConfiguration
    xml.structureTitle = payload
    Both CCSID configuration parameters from the "Source"-Tab we've set to 850.
    Now, we don't get an error anymore - sun.io.malformedInputException - , but, unfortunately, now special character conversion succeeded (we need an "ß" and we get an ISO-HEX-E1 -> á).  E1 is (different from ISO) an "ß" in 850.
    Any ideas?

  • Encoding url problem

    hi experts i want use this program to understand the concept of session cookies
    <HTML><HEAD><TITLE>Encoding URLs</TITLE></HEAD>
    <BODY>
    <B>Example encoded hyperlink: </B>
    <% String link = response.encodeURL("Process.jsp");
    String button = response.encodeURL("Process.jsp");
    String sessionID = request.getRequestedSessionId();
    out.print(link);
    %>
    <a href="<%=link%>">Click here</a>
    <HR>
    <FORM METHOD=POST ACTION="<%=button%>">
    <B>Example encoded button: </B><INPUT TYPE=SUBMIT VALUE="Submit">
    </FORM>
    <HR>
    <B>Session ID</B>
    <%=sessionID%>
    </BODY>
    </HTML>
    and thn i go to internet explorer tools tab thn privacy tab and thn in cookies section i blocked all first party and third party cookies and when i run the above code it doesnot show me the encodedurl that i take in link variable and try to display it
    plz tell me where i am wrong

    hi thankx direct me
    i ll check this after when i obtain an domain name
    is it possible to chek it on localmachine becaz i am yet developing my portal and i can run it only my server that is on my own machine
    is there any method in which i can use my computer ip address instead localhost(127.0.0.0)

  • Problem while setting username password to router

    Hi,
    i am trying to connect to router using java program. i am connecting with out any problem.
    while giving the credentials like username and password i can't placing the original username
    password.instead some thing is setted.
    here is my code
       public class ConnectRouter
        public static void main(String[] args) throws Exception {
        try
        if (args.length != 2) {
        System.err.println("Usage: java router username and  password");
        System.exit(1);
        String password = URLEncoder.encode(args[0], "US-ASCII");
        String username=URLEncoder.encode(args[1],"US-ASCII");
        URL url = new URL("http://192.168.0.75:23");
        URLConnection connection = url.openConnection();
        connection.setDoOutput(true);
            System.out.println("connection obj got");
        PrintWriter out = new PrintWriter(connection.getOutputStream());
        out.println(username);----------------------------------------------------------------------------------------------->passing username
        out.println(password);------------------------------------------------------------------------------------------------>passing password
            Process p = Runtime.getRuntime().exec("cmd /c perl C:\\perlsrc\\uname.pl");
        // out.println(args[0]);
            System.out.println("-----------connected---------------");
        out.close();
        BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        String inputLine;
        while ((inputLine = in.readLine()) != null)
        System.out.println(inputLine);
        in.close();
        }catch(Exception e){e.printStackTrace();}
        }output is as follows:
    connection obj got
    -----------connected---------------
    ÿûÿûÿýÿý
    User Access Verification
    Username: POST / HTTP/1.1--------------------------------------->here something is placed instead of my username
    Password:
    % Authentication failed.
    Username: Host: 192.168.0.75:23--------------------------------->here something is placed instead of my username
    Password:
    % Authentication failed.
    Username: Connection: keep-alive
    Password:
    % Authentication failed.
    Process exited with exit code 0.
    please explain me where i am missing???
    Regards,
    Nagaraju

    Hi ejp,
    i done as follows even i am getting same problem
    please help me
       public class ConnectRouter extends Authenticator
            static String username,password;
        public static void main(String[] args) throws Exception
            Authenticator.setDefault(new ConnectRouter());
        try
        if (args.length != 2) {
        System.err.println("Usage: java router username and  password");
        System.exit(1);
         password = URLEncoder.encode(args[0], "US-ASCII");
         username=URLEncoder.encode(args[1],"US-ASCII");
        URL url = new URL("http://192.168.0.75:23");
        URLConnection connection = url.openConnection();
        connection.setDoOutput(true);
            System.out.println("connection obj got");
        PrintWriter out = new PrintWriter(connection.getOutputStream());
        out.println(username);
        out.println(password);
            Process p = Runtime.getRuntime().exec("cmd /c perl C:\\perlsrc\\uname.pl");
        // out.println(args[0]);
            System.out.println("-----------connected---------------");
        out.close();
        BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        String inputLine;
        while ((inputLine = in.readLine()) != null)
        System.out.println(inputLine);
        in.close();
        }catch(Exception e){e.printStackTrace();}
        //@ovverriding the getPasswordAuhtentication method
        protected PasswordAuthentication getPasswordAuthentication()
            System.out.println("int the password authentication method");
            return new PasswordAuthentication(username,password.toCharArray());
        }output::
    connection obj got
    -----------connected---------------
    ÿûÿûÿýÿý
    User Access Verification
    Username: POST / HTTP/1.1--------------------------------------->here something is placed instead of my username
    Password:
    % Authentication failed.
    Username: Host: 192.168.0.75:23--------------------------------->here something is placed instead of my username
    Password:
    % Authentication failed.
    Username: Connection: keep-alive
    Password:
    % Authentication failed.
    Process exited with exit code 0.
    please explain me where i am missing again???
    Thanks in advance,
    Nagaraju.

  • A web developer problem while running a web application

    Hi all,
    I'm novice to J2EE.
    I've encountered a problem while accessing the deployed module in weblogic 8.1 server.
    I'm sure that the webapplication module is deployed as i saw my module in administration console & also the status said that it is deployed.
    when i access my web application by specifying the proper server and port no and context root it is showing
    either 505 - resource not found error(http://localhost:7001/Suresh-2/Suresh) or 404 - not found error.( http://localhost:7001/Suresh-2/Suresh)
    Now let me elaborate what i've done till now.
    My webapplication folder structure is : C:\bea\user_projects\domains\mydomain\applications\Suresh\WEB-INF\classes\Sai\ServExamp.class
    My servlet is ServExamp.java
    I created a folder called "Suresh". In that folder created another folder called "WEB-INF". In WEB-INF created a folder called "Classes".
    Since my servlet is in package "Sai", the .class file reside in \Suresh\WEB-INF\Classes\Sai\ServExamp.class
    The source code is :
    package Sai;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class ServExamp extends HttpServlet
    public void doPost(HttpServletRequest req,HttpServletResponse res)throws IOException
    PrintWriter out=res.getWriter();
    java.util.Date today=new java.util.Date();
    out.println("<html>"+"<body>"+
    "<h1 align=center>HF\'s Chapter1 Servlet </h1>"
    +"<br>"+today+"</body>"+"</html>");
    Now i'm almost done creating a web application. Next, I constructed a simple web.xml descriptor that gives a web friendly name for my servlet, and points to the servlet. I constructed web.xml descriptor file in the WEB-INF folder (C:\bea\user_projects\domains\mydomain\applications\Suresh\WEB-INF\).
    The web.xml file source is :
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>Hello World Web Application</display-name>
    <description>Test Servlet</description>
    <servlet>
    <servlet-name>ServExamp</servlet-name>
    <servlet-class>Sai.ServExamp</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ServExamp</servlet-name>
    <url-pattern>/Suresh</url-pattern>
    </servlet-mapping>
    </web-app>
    Now I have told Weblogic that the URI /Suresh corresponds to my servlet "Sai.ServExamp".
    My Web Application is ready to be deployed at this point. I logged onto Weblogic's admin console,
    1) clicked on deployments, then navigated to "Web Application Modules" .
    2) Clicked "Deploy new Web Application Module"
    3) Navigated to the location of your web application folder (Suresh). There was a radio button next to it indicating that I can select that folder as a valid web application.
    4) I Clicked that radio button and clicked "Target Module".
    5) It informed that my web application "Suresh" will be deployed to myServer.It asked a name for my web application deployment. By default it was "Suresh"
    I clicked Deploy.
    6) After deployment, my web application "Suresh" appeared in the "Web Application Modules" tree on the left.
    I Clicked on "Suresh"( my web application) then clicked the testing tab, then clicked the link shown there(http://localhost:7001/Suresh-2).
    It was not showing my servlet (showed a 403 error)
    Error - 403
    This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.
    I think so it came b'coz I don't have an index.html or index.jsp page.
    7)Instead,I added my servlet on to the URL it provided.
    http://localhost:7001/Suresh-2/Suresh
    It is showing these error code: Http: 505 resource not allowed
    The page cannot be displayed
    The page you are looking for cannot be displayed because the address is incorrect.
    Please try the following:
    If you typed the page address in the Address bar, check that it is entered correctly.
    Open the localhost:7001 home page and then look for links to the information you want.
    Click Search to look for information on the Internet.
    when i just type : http://localhost:7001/ -> Error 404 not found error
    it's showing
    Error 404--Not Found
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.5 404 Not Found
    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
    If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.
    I want to run my web application & any help would be appreciated.
    Thanks in advance.
    with regards,
    S.SayeeNarayanan.
    Note: I even deployed my war file, which i got by execution of (jar cv0f webapp.war . ) command from the root directory of my web application i.e. Suresh
    Then executed my webapplication it is showing
    error-505 resource not allowed.
    --------------------------------------------------------------------------------------------

    try a fully qualified path to the pem file

  • A small problem while running my webapplication

    Hi all,
    I'm novice to J2EE.
    I've encountered a problem while accessing the deployed module in weblogic 8.1 server.
    I'm sure that the webapplication module is deployed as i saw my module in administration console & also the status said that it is deployed.
    when i access my web application by specifying the proper server and port no and context root it is showing
    either 505 - resource not found error(http://localhost:7001/Suresh-2/Suresh) or 404 - not found error.( http://localhost:7001/Suresh-2/Suresh)
    Now let me elaborate what i've done till now.
    My webapplication folder structure is : C:\bea\user_projects\domains\mydomain\applications\Suresh\WEB-INF\classes\Sai\ServExamp.class
    My servlet is ServExamp.java
    I created a folder called "Suresh".  In that folder created another folder called "WEB-INF".  In WEB-INF created a folder called "Classes".
    Since my servlet is in package "Sai", the .class file reside in \Suresh\WEB-INF\Classes\Sai\ServExamp.class
    The source code is :
    package Sai;
    import javax.servlet.;*
    import javax.servlet.http.;*
    import java.io.;*
    public class ServExamp extends HttpServlet
    public void doPost(HttpServletRequest req,HttpServletResponse res)throws IOException
    PrintWriter out=res.getWriter();
    java.util.Date today=new java.util.Date();
    out.println("<html>"+"<body>"+
    *"<h1 align=center>HF\'s Chapter1 Servlet </h1>"*
    +"<br>"+today+"</body>"+"</html>");
    Now i'm almost done creating a web application.  Next, I constructed a simple web.xml descriptor that gives a web friendly name for my servlet, and points to
    the servlet. I constructed  web.xml descriptor file in the WEB-INF folder (C:\bea\user_projects\domains\mydomain\applications\Suresh\WEB-INF\).
    The web.xml file source is :
    *<!DOCTYPE web-app*
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    *"http://java.sun.com/dtd/web-app_2_3.dtd">*
    *<web-app>*
    *<display-name>Hello World Web Application</display-name>*
    *<description>Test Servlet</description>*
    *<servlet>*
    *<servlet-name>ServExamp</servlet-name>*
    *<servlet-class>Sai.ServExamp</servlet-class>*
    *</servlet>*
    *<servlet-mapping>*
    *<servlet-name>ServExamp</servlet-name>*
    *<url-pattern>/Suresh</url-pattern>*
    *</servlet-mapping>*
    *</web-app>*
    Now I have told Weblogic that the URI /Suresh corresponds to my servlet "Sai.ServExamp".
    My Web Application is ready to be deployed at this point. I logged onto Weblogic's admin console,
    *1) clicked on deployments, then navigated to "Web Application Modules" .*
    *2) Clicked "Deploy new Web Application Module"*
    *3) Navigated to the location of your web application folder (Suresh). There was a radio button next to it indicating that I can select that folder as a*
    valid web application.
    *4) I Clicked that radio button and clicked "Target Module".*
    *5) It informed that my web application "Suresh" will be deployed to myServer.It asked a name for my web application deployment. By default it was "Suresh"*
    I clicked Deploy.
    *6) After deployment, my web application "Suresh" appeared in the "Web Application Modules" tree on the left.*
    I Clicked on "Suresh"( my web application) then clicked the testing tab, then clicked the link shown there(http://localhost:7001/Suresh-2).
    It was not showing  my servlet (showed a 403 error)
    Error - 403
    This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.
    I think so it came b'coz I don't have an index.html or index.jsp page.
    *7)Instead,I added my servlet on to the URL it provided.*
    http://localhost:7001/Suresh-2/Suresh
    It is showing these error code: Http: 505 resource not allowed
    The page cannot be displayed
    The page you are looking for cannot be displayed because the address is incorrect.
    Please try the following:
    If you typed the page address in the Address bar, check that it is entered correctly.
    Open the localhost:7001 home page and then look for links to the information you want.
    Click  Search to look for information on the Internet.
    when i just type : http://localhost:7001/   -> Error 404 not found error
    it's showing
    Error 404--Not Found
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    *10.4.5 404 Not Found*
    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
    If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code
    SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding
    address.
    I want to run my web application & any help would be appreciated.
    Thanks in advance.
    with regards,
    S.SayeeNarayanan.
    Note: I even deployed my war file, which i got by execution of (jar cv0f webapp.war . ) command from the root directory of my web application i.e. Suresh
    Then executed my webapplication it is showing
    error-505 resource not allowed.
    --------------------------------------------------------------------------------------------

    cross posted (amazingly dukes offered in both)

  • Problem while opening Bex query on the web

    Hello BW experts,
    I have a problem while opening Bex query from my SAP Favorites.See below.
    When i double click on the query, i get the following page, with the server name KBWS01QX.
    But, from RSRT Tcode, select the query > query display as HTML > Click on ABAP Web , click execute as shown below, it is going to the correct URL as in the 2nd screen shot below.
    My question is why is it going to the wrong URL when i open it from  SAP Favorites menu?
    I want it to open the same URL as it opened from RSRT(which is the right one)
    What is the Config needed to make it to work from SAP favorites.
    Any help would be appreciated.
    Thanks alot.
    SV

    Hello,
    Thank you all for your responses.
    See below some additional info.
    From RSRT, this time I clicked on JAVA WEB, and i get the below URL, which is the same URL i was getting when i executed the query from SAP favorites.
    http://kbws01qx.xxxxxxx.com:50000/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?QUERY=ZCONSUMPTION
    Also, i have executed the Function module : RSBB_URL_PREFIX_GET and i get the below values.
    It seems that it is trying to connect to Java portal something services may be, but i want it to open in ABAP web only.
    Please help.

Maybe you are looking for

  • How i can connect php and oracle9i ?

    hello am new to php.i have oracle 9i and php and apache.oracle is installed at one system and php inother one at network .when i have at same pc's i connect it.but now it's at different systems how i can connect.plzz tell me complete steps of apache

  • Really bothering but easy question to answer!!!!!

    haha for me, i set a screen lock combination on my Ipod and thought it would be fun to make my brother guess the combo. How was i to know that it would freeze after multiple wrong guesses! i left it for quiet awhile thinking it would unfreeze but it

  • RPREX010 User Exit - Acces Key

    Hi experts, sorry, I am begginer in "user exits". I am trying to edit the include RPREX010, which is an "User Exit" for class CL_EX_TRIP_POST_FI, in program RPRFIN00_40. But it asks for Access Key. Is it normal? My user has developer role and everyth

  • Hello, I bought, downloaded and installed the Pre-Paid Premium Creative Suit (Student Edition)

    It worked fine until I had a recent computer reset, I've lost Photoshop, illustrator, everything. It won't let me re-install the files from the website either. Please Help.

  • I can't finish installing flash player

    I already started installation , and right in the middle comes out theres been an error installing. I closed all applications from the application manager and still there is no response. HELP