ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Java procedure to open URL using RPG application

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Java procedure to open URL using RPG application

    Hi All,

    I am new to JAVA. I have a requirement to open such a big URL (1000 length). Also URL contains special characters like "%", "%3F" etc.
    Is there any java procedure that will help me to open such type of URL from RPG application?

    URL example:-


    I tried this with .BAT file but due to special characters like above, it is not opening.
    Please help...!!!
    Cheers...
    Nil

  • #2
    Re: Java procedure to open URL using RPG application

    I don't understand. What does a *.BAT file have to do with opening an URL using a RPG application?
    Tom

    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

    Comment


    • #3
      Re: Java procedure to open URL using RPG application

      Hi Tom,

      I was using STRPCCMD to write the URL into .BAT file using RPG application. But that was ok and opening those URL because those URL did not contain special characters, but now with the new URL it contains special characters as I mentioned and thus when I run that .BAT file it is not opening therefore I need some JAVA procedure help to open those kind of URL's.

      Example of my RPG:-
      Eval Buffer = 'STRPCCMD PCCMD(' + '''' + 'CMD +
      /C ECHO SET "FIRST=' + %Trim(URL) +
      '" > C:\TEMP\URL.BAT' + '''' + ') PAUSE(*NO)'
      Call 'QCMDEXC' 99
      Parm Buffer
      Parm Length

      Originally posted by tomliotta View Post
      I don't understand. What does a *.BAT file have to do with opening an URL using a RPG application?
      Cheers...
      Nil

      Comment


      • #4
        Re: Java procedure to open URL using RPG application

        Did you try putting quotes around the URL

        STRPCCMD PCCMD('"C:\Program Files (x86)\Google\Chrome\Application\chrome" "http://abc.com/knowledge/ITFORMS/_layouts/FormServer.aspx?XmlLocation=/knowledge/ITFORMS/Release%20Migration/Stmts_2014_2014-03 27T15_07_17.xml&Source=http%3A%2F%2Fshare%2Edeere% 2Ecom%2Fknowledge%2FITFORMS%2FRelease%2520Migratio n%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1&Clie ntInstalled=true&Source=http%3A%2F%2Fshare%2Edeere %2Ecom%2Fknowledge%2FITFORMS%2FRelease%2520Migrati on%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1"')

        Comment


        • #5
          Re: Java procedure to open URL using RPG application

          I think the OP is looking to open a URL in a web browser and wants to initiate the process from an RPG program. He doesn't really want to open the URL from Java or directly from RPG -- but he doesn't realize the difference between opening the URL in his program and opening it in a web browser.

          See the following thread:


          The purpose of the .BAT file is to workaround the 123 character limitation of STRPCCMD. You can build a BAT file on-the-fly that puts together data from multiple invocations of STRPCCMD, and this way you can get around the 123 character limitation. However, I've never found this technique to work especially well, and have already recommended a better solution.

          Comment


          • #6
            Re: Java procedure to open URL using RPG application

            Hi Thanks for your inputs. I tried with quotes as well but not working see the snap shot of DOS when I ran that .BAT file.
            If you see "ITFORMS/Release%20" in the below link then "%20" is coming as "0" you can see this in a snap shot that I highlighted in RED box.

            How do I use Java procedure in my RPG to encode those kind of URL's where characters like "%20, %3F" etc. available?
            GLS mentioned about the link http://www.w3schools.com/tags/ref_urlencode.asp in that I found Java procedure encodeURI() but how do I use in my RPG to encode?

            Really I am stuck here, please help me...!!!

            Originally posted by danlong005 View Post
            Did you try putting quotes around the URL

            STRPCCMD PCCMD('"C:\Program Files (x86)\Google\Chrome\Application\chrome" "http://abc.com/knowledge/ITFORMS/_layouts/FormServer.aspx?XmlLocation=/knowledge/ITFORMS/Release%20Migration/Stmts_2014_2014-03 27T15_07_17.xml&Source=http%3A%2F%2Fshare%2Edeere% 2Ecom%2Fknowledge%2FITFORMS%2FRelease%2520Migratio n%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1&Clie ntInstalled=true&Source=http%3A%2F%2Fshare%2Edeere %2Ecom%2Fknowledge%2FITFORMS%2FRelease%2520Migrati on%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1"')
            Attached Files
            Cheers...
            Nil

            Comment

            Working...
            X