URL to String and String to URL

Hello,
I'm fairly new to Java and I have made my way through most of the things I've tried...except for the following:
I'm trying to load an image from the following path:
http://JOHNB1:8082/classpath/StickShooter/
The code I'm using is:
aImages[ 0 ] = this.getImage( this.getDocumentBase(),"P0.gif" ) ;
I found that getDocumentBase() returns the following:
http://JOHNB1:8082/classpath/StickShooter/StickShooter.html
The other thing is I tried to do this:
sScratch = this.getDocumentBase().toString() ;
URL u = new URL( sScratch ) ;
but I keep getting a MalformedURLException error.
Any comments/feedback/help is much appreciated.
Thanks,
John

Hi,
Well, I'm not 100% sure on how to answer that question, but its an applet that I want to load a series of pictures/images (.GIF) that are in a sub folder of my project directory.
Thanks.

Similar Messages

  • QSUF (Query string url filter) and SQL Server reporting services report viewer parameters

    Hi,
    this is my issue:
    I have a SQL Server reporting services web part on a page with a report with 1 parameter, lets say it's a client list
    Then i have a QSUF that will be used to filter the clients list through the URL
    However, once i connect the filter and the report viewer web part, the parameter goes away and is no longer accessible
    I'd like to somehow keep the parameter visible, in case there is no parameter sent through the URL, i would like the user to be able to choose a client from the parameter drop down list
    I saw that there is a "send empty if no values are passed" option, but i can't seem to get this working properly and i don't know if this option will make the parameter visible again
    Any help would be appreciated
    Thanks.

    Hi,
    According to your post, my understanding is that the query string url filter web part not worked well with SQL server reproting services web part.
    Did you use the Wiki page layout in your environment?
    You can change the page to a web part page, then check whether it work.
    There is a similar thread for your reference.
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/4d7584e3-8e1a-48bf-9346-32f8cb480dd1/query-string-url-filter-web-part?forum=sharepointgeneralprevious
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • SAPGUI Iview and passing logon language as query string in URL

    Dear Portal experts, is it possible to send the sapgui logon language as query string in URL so sso login to EP is language JP and the login to SAPGUI Iview (for windows) can be different langauge eg English. There is a document that talks abt configuration setting for SAPGUI for HTML , but no documentation for SAPGUI for windows using shortcut..
    eg :  http://serverhost:port/...../xxxx.iview?sap-config-mode=true&sap-language=ja
    Please let know ...thanks.
    Regards
    Gabriel

    Hi Gabriel,
    There are some context variables available for Generic component of app integrator. You can refer to the below link.
    http://help.sap.com/saphelp_nw70/helpdata/en/36/5e3842134bad04e10000000a1550b0/content.htm
    I know transaction iView is a different component but worth giving it a try.
    Regards,
    Mahesh
    Edited by: Mahesh Krishnapillai on Jan 6, 2012 1:09 PM

  • My string URL is too long and my servlet don't work.

    I need to call servlet from my web page but it does not work because My string URL is too long (appear message in my web "server not found"), exists a way to solve this?

    It's good that you have a solution. But your solution suggests that your original problem was not that the URL was too long, since you are still using GET. Probably it was something else. But at least you have a solution.

  • FF change single quotes in query string for their url-encode form (%27) and I need use single quotes (I don't care about derivated security problems)

    When I try to enter a url like:
    www.example.com?owner=alex's
    the actual URL the FF send is:
    www.example.com?owner=alex%27s
    I need the first option and I don't know hoy to configure it. Could you help me?

    I think that RFC1738 is outdated and you should look at RFC3986 section 2.2:<br>
    "URI producing applications should percent-encode data octets that correspond to characters in the reserved set unless these characters are specifically allowed by the URI scheme to represent data in that component. If a reserved character is found in a URI component and no delimiting role is known for that character, then it must be interpreted as representing the data octet corresponding to that character's encoding in US-ASCII".<br><br>
    I think that in this case there is no special delimiting role or "reserved purpose" for the character to allow the unencoded use. So I think that the behaviour of Firefox is correct.<br>
    http://www.rfc-editor.org/rfc/rfc3986.txt<br>

  • AS2: Sending URL string, and recieving in flash on seperate page

    i'm trying to send some data from a list component to another
    web page, and have flash collect it and take you to an appropriate
    frame... this is what i'm using to send the data
    getURL("
    http://www.myothersite.biz?seminar="+list_box.selectedItem.firstChild.firstChild.nodeValue ,
    "_blank");
    now how can i retrieve that from the other page? I know how
    to use FlashVars and such, but only when you define it.. I don't
    know how to make it dynamic... does that make sense?

    dzedward,
    >> i'm trying to send some data from a list component
    to
    >> another web page, and have flash collect it and take
    >> you to an appropriate frame...
    I would use the LoadVars class in that situation. Have you
    checked into
    that? Create an instance of LoadVars, then add properties to
    your instance
    to match whatever data you're sending. Invoke
    LoadVars.sendAndLoad(), or
    see the LoadVars class entry for additional options.
    > ok, I worked this out with javascript, however i need to
    > URLdecode it... I'm not sure how to do that with
    javacript,
    > I'm no javascript expert, just dabble. anyone have some
    clues?
    Both JavaScript and ActionScript have escape() and
    unescape() functions
    for just that purpose. :)
    David Stiller
    Co-author, Foundation Flash CS3 for Designers
    http://tinyurl.com/2k29mj
    "Luck is the residue of good design."

  • APEX application or page url  - How to use enum string to replace ID number

    URL to a APEX page is format as ***/f?p=APPLICATION_ID:PAGE_ID:... . Here the APPLIACTION_ID and PAGE_ID are numbers.
    My Question is: Is there a way to replace the numbers by using strings? For example: can I have a URL like /f?p=MY_APPLICATION:MY_PAGE1: ... ? Juts like ENUM in other languages, MY_APPLICATION actually just represent the application id but much more readable since it is a string with a name the user may familar.
    Please help.
    Thank you.

    You can assign an alphanumeric alias to applications and pages using their respective attribute edit forms in the Application Builder. Then you can construct links that use those aliases instead of the IDs. These aliases will generally be preserved in the URL visible in the browser, but not in all cases. You have to deliberately use the aliases in any branch definitions, list item targets, etc. Note that application aliases must be unique within a workspace. Please see the User's Guide for more info.
    Scott

  • How to get values from a query string in URL in a jsf page?

    if i have a url, http://my.com/?name=john+smith, how do i get the values from that url in a jsf page and then pass those values to a servlet?
    i know how to do that in jsp using "request.getParamter("name")" and save it in a bean and then forward to a servlet. But what about in jsf?

    Hello,
    Try this:
    Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
    String name = (String) requestMap.get("name");If isn't worked one of these methods probably will solve your problem.
    FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
    FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap();hth.

  • How to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part

    Hi,
    I want to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part like mentioned below:
    http://server/pages/Default.aspx?Title=Arup&Title=Ratan
    But it always return those items whose "Title" value is "Arup". It is not returned any items whose "Title" is "Ratan".
    I have followed the
    http://office.microsoft.com/en-us/sharepointserver/HA102509991033.aspx#1
    Please suggest me.
    Thanks | Arup
    THanks! Arup R(MCTS)
    SucCeSS DoEs NOT MatTer.

    Hi DH, sorry for not being clear.
    It works when I create the connection from that web part that you want to be connected with the Query String Filter Web part. So let's say you created a web part page. Then you could connect a parameterized Excel Workbook to an Excel Web Access Web Part
    (or a Performance Point Dashboard etc.) and you insert it into your page and add
    a Query String Filter Web Part . Then you can connect them by editing the Query String Filter Web Part but also by editing the Excel Web Access Web Part. And only when I created from the latter it worked
    with multiple values for one parameter. If you have any more questions let me know. See you, Ingo

  • Using a string in a url.

    This is my code: (problem is stated at the bottom)
    import java.net.*;
    import java.awt.*;
    import java.applet.*;
    import javax.swing.*;
    import java.util.Properties;
    import javax.swing.JOptionPane;
    public class Load implements AppletStub {
       private static Properties params = new Properties();
       private static JFrame frame;
       private static JPanel game;
       private static String client = "client";
       public static void main(String[] args)
       new Load(args);
       public Load(String[] args)
       try{
       String s = (String) JOptionPane.showInputDialog("Enter The wrold Prefix:");
       System.out.println(s);
       System.out.println("Starting Up Applet, Please Wait");
       long timeToTake = System.currentTimeMillis();
       URLClassLoader loader = new URLClassLoader(new URL[] { new URL("http://" + s +".runescape.com/runescape.jar") });
          Class c = loader.loadClass (client);
          System.out.println("It Took " + (System.currentTimeMillis() - timeToTake) +  "ms To Update the Bot");
          System.out.println("Loaded " + c);
          Applet app = (Applet)c.newInstance();
          System.out.println("Created a new Instance of " +c);
          System.out.println("Loading Applet, Setting Stub to this");
                app.setStub(this);
                frame = new JFrame("Krrose27 RuneScape Load");
                frame.setResizable(false);
                game = new JPanel(new BorderLayout());
                game.setPreferredSize(new Dimension(765, 503));
                game.add(app);
                frame.getContentPane().add(game, BorderLayout.CENTER);
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.pack();
          frame.setVisible(true);
          System.out.println("Applet Initialized");
          app.init();
          app.start();    
          System.out.println("Applet Started\n\nBot Took " + (System.currentTimeMillis() - timeToTake) + " To Fully load the applet");
          }catch(Exception e){}
           public URL getCodeBase()
               try{
                   return new URL("http://" + s +".runescape.com");
               catch(Exception e){
                   return null;
           public URL getDocumentBase()
                 try{
                 return new URL("http://" + s +".runescape.com/lang/en/aff/runescape/game.ws?lowmem=1&plugin=0");
                 catch(Exception e){
                   return null;
        public String getParameter(String name) {
                params.setProperty("worldid", "4");
                    params.setProperty("members", "0");
                    params.setProperty("modewhat", "0");
                    params.setProperty("modewhere", "0");
                    params.setProperty("lowmem", "1");
                    params.setProperty("lang", "0");
            return params.getProperty(name);
        public AppletContext getAppletContext() {
            return null;
        public void appletResize(int i, int i1) { }
         public boolean isActive() { return false; }
    }I want to take string s and use it in the urls. As you can see i've been messing around with it.
    Message was edited by:
    krrose27

    when i compile it says:
    C:\java\runescape>javac Load.java
    Load.java:56: cannot find symbol
    symbol  : variable s
    location: class Load
                   return new URL("http://"+ s +".runescape.com");
                                             ^
    Load.java:66: cannot find symbol
    symbol  : variable s
    location: class Load
                 return new URL("http://"+ s +".runescape.com/lang/en/aff/runescape/
    game.ws?lowmem=1&plugin=0");
                                           ^
    2 errorswith this code: i edited
    import java.net.*;
    import java.awt.*;
    import java.applet.*;
    import javax.swing.*;
    import java.util.Properties;
    import javax.swing.JOptionPane;
    public class Load implements AppletStub {
       private static Properties params = new Properties();
       private static JFrame frame;
       private static JPanel game;
       private static String client = "client";
       public static void main(String[] args)
       new Load(args);
       public Load(String[] args)
       try{
       String s = (String) JOptionPane.showInputDialog("Enter The wrold Prefix:");
       System.out.println(s);
       System.out.println("Starting Up Applet, Please Wait");
       long timeToTake = System.currentTimeMillis();
       URLClassLoader loader = new URLClassLoader(new URL[] { new URL("http://"+ s +".runescape.com/runescape.jar") });
          Class c = loader.loadClass (client);
          System.out.println("It Took " + (System.currentTimeMillis() - timeToTake) +  "ms To Update the Bot");
          System.out.println("Loaded " + c);
          Applet app = (Applet)c.newInstance();
          System.out.println("Created a new Instance of " +c);
          System.out.println("Loading Applet, Setting Stub to this");
                app.setStub(this);
                frame = new JFrame("Krrose27 RuneScape Load");
                frame.setResizable(false);
                game = new JPanel(new BorderLayout());
                game.setPreferredSize(new Dimension(765, 503));
                game.add(app);
                frame.getContentPane().add(game, BorderLayout.CENTER);
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.pack();
          frame.setVisible(true);
          System.out.println("Applet Initialized");
          app.init();
          app.start();    
          System.out.println("Applet Started\n\nBot Took " + (System.currentTimeMillis() - timeToTake) + " To Fully load the applet");
          }catch(Exception e){}
           public URL getCodeBase()
               try{
                   return new URL("http://"+ s +".runescape.com");
               catch(Exception e){
                   return null;
           public URL getDocumentBase()
                 try{
                 return new URL("http://"+ s +".runescape.com/lang/en/aff/runescape/game.ws?lowmem=1&plugin=0");
                 catch(Exception e){
                   return null;
        public String getParameter(String name) {
                params.setProperty("worldid", "4");
                    params.setProperty("members", "0");
                    params.setProperty("modewhat", "0");
                    params.setProperty("modewhere", "0");
                    params.setProperty("lowmem", "1");
                    params.setProperty("lang", "0");
            return params.getProperty(name);
        public AppletContext getAppletContext() {
            return null;
        public void appletResize(int i, int i1) { }
         public boolean isActive() { return false; }
    }Message was edited by:
    krrose27
    Message was edited by:
    krrose27

  • How to manage Locale info in the URL path, but not the query string

    We are building an application using Struts 1.1 and Tiles, on Oracle Application Server 10.1.3.3...
    I know this is a strange question... but we have a requirement to represent the locale info in the URL string using one of the following options:
    option 1: /eng/page.do?id=2 for english.../fra/page.do?id=2
    option 2: /page-eng.do?id=2 for english.... and /page-fra.do?id=2 for french
    We need to represent the 3 letter ISO lang code either in the directory structure, or suffix the page name (in our case, the struts action name)... we cannot replicate this using a parameter in the query string. I know this is odd, but that is what we are told to implement.
    Is there any robust way of implementing either option in Struts 1.1, JSP, JSTL etc...?
    Currently, we are looking at using a servlet filter to intercept the HTTP requests, parse the URL string, and extract the ISO lang value, and set locale and forward on the request.
    This poses a few problems... adding additional action mappings (page-eng... page-fra... page) to our struts-xml.config file to handle lang permuations... but the biggest issue is all the embedded html:link action values throughout our code...
    Because all our public facing URLs must comply with the rule, we need to change the html:link action to point to a different action, based on locale.
    Very inefficent, and I'm sure not industry standard best practice... we are using Tiles, and resource bundles for all our labels etc... but fall short in meeting this rule with regards to URLs and locale.
    Any advice or tips etc.. is greatly appreciated.

    The filter option sounds like a good solution. So it can receive the urls and parse them appropriately.
    You just need to take it one step further.
    Additional actionmappings in your struts-config should not be necessary.
    Filter:
    - analyses the url and sets the appropriate locale
    - adjusts the url such that the next level of the chain does not have to know anything about the locale being encoded in the url string.
    Thus your struts classes and mappings can remain unchanged
    /eng/page.do or /fra/page.do once through the filter should just look like /page.do to struts.
    That should get rid of half of your headache.
    Next the issue of generating urls.
    There are two approaches I can see here
    1 - use the filter approach again, this time with some post processing. Gather the generated HTML in a buffer, and do a find/replace on any urls generated, to put the locale encoding into them.
    2 - Customise struts to produce urls in this format. This would involve the html:link tag, and the html:form tag at the least (maybe others?). Get the source code for struts, and grab the html:link tag code. Extend that class to generate urls as you want them to be generated. I think you would need to extend the class org.apache.struts.taglib.html.LinkTag and override the protected method calculateURL. You would then have to edit/modify the struts-html tld to point the link tag at your classes rather than the standard ones.
    Option 1 is architecturally good because it gives you a well defined layer/border between having the locale encoded in the url, and not having it there. However it involves doing a find/replace on every html going out. This would catch all urls, whether generated by html:link tag or not.
    Option 2 requires customising struts for your own requirements, which may be a bit daunting, but has the advantage of generating the urls correctly without the extra overhead involved with option 1. Of course you would have to ensure that ALL urls are generated with the html:link tag.
    On reflection, I think option 1 is preferable, as both easier and quicker to implement, and doing a better separation in the architecture.
    Cheers,
    evnafets

  • Japanese Characters working as URL parameters, turning to question marks when in URL string itself

    I'm having some trouble getting coldfusion to see japanese
    characters in the URL string.
    To clarify, if I have something like this:
    http://my.domain.com/index.cfm?categorylevel0=Search&categorylevel1=%E3%82%A2%E3%82%B8%E3% 82%A2%E3%83%BB%E3%83%93%E3%82%B8%E3%83%8D%E3%82%B9%E9%96%8B%E7%99%BA
    All of my code works correctly and the server is able to pass
    the japanese characters to the database and retrieve the correct
    data.
    If I have this instead:
    http://my.domain.com/index.cfm/Search/%E3%82%A2%E3%82%B8%E3%82%A2%E3%83%BB%E3%83%93%E3%82% B8%E3%83%8D%E3%82%B9%E9%96%8B%E7%99%BA
    My script (which works fine with English characters) parses
    CGI variables and converts these to the same URL parameters that I
    had in the first URL using a loop and a CFSET url.etc..
    In the first example, looking at the CF debug info shows me
    what I expect to see:
    URL Parameters:
    CATEGORYLEVEL0=Search
    CATEGORYLEVEL1=アジア・ビジネス開発
    In the second example it shows me this:
    URL Parameters:
    CATEGORYLEVEL0=Search
    CATEGORYLEVEL1=???·??????
    Can anyone suggest means for debugging this? I'm not sure if
    this is a CF problem, an IIS problem, a JRUN problem or something
    else altogether that causes it to lose the characters if they are
    in the URL string but NOT as a parameter.

    My suggestion was that you test with the
    first url, not the second. However, I can see a source of
    confusion. I overlooked your delimiter, "/". It should be "?" and
    "=" in this case. With these modifications, we get
    <cfif Len(cgi.query_string) neq 0>
    <cfset i = 1>
    <cfloop list="#cgi.query_string#" delimiters="&"
    index="currentcatname">
    <cfoutput>categorylevel#i# =
    #ListGetAt(currentcatname,2,"=")#</cfoutput><br>
    <cfset i = i + 1>
    </cfloop>
    If it is a failing of Coldfusion, the above test should fail,
    too.
    Now, an adaptation of the same test to your second url.
    <cfset url2 = "
    http://my.domain.com/index.cfm/Search/%E3%82%A2%E3%82%B8%E3%82%A2%E3%83%BB%E3%83%93%E3%82% B8%E3%83%8D%E3%82%B9%E9%96%8B%E7%99%BA">
    <cfset query_str =
    ListGetAt(replacenocase(url2,".cfm/","?"),2,"?")>
    <cfif Len(query_str) neq 0>
    <cfset i = 1>
    <cfloop list="#query_str#" delimiters="/"
    index="currentcatname">
    <cfoutput>categorylevel#i# =
    #currentcatname#</cfoutput><br>
    <cfset i = i + 1>
    </cfloop>

  • Non english string in URL

    Hi,
    I'm trying to send a non English string from one WD application to another.
    I managed to encode it to UTF-8 using java.net.URLEncoder in the sending application but could not decode it in the receiving application. The WD is doing some decoding to a character set I don't now.
    Any idea anyone??
    Thanks and regards,
    Nachshon

    Suggestions
    1) Try with NLS_LANG as
    SWEDISH_SWEDEN.WE8DEC
    2) Make a paramform and enter via paramform (unencoded)
    (This is just for testing purpose)
    3) Change machine locale to swedish and try
    4) Which reports version is this ?
    Please see
    BUG 2713695 - NLS CHARACTERS FOR PARAMETERS CHANGE TO QUESTION MARKS WHEN PASSED ON URL BAR
    Get in touch with Support to see if this is the issue and if "yes" get a one-off patch.
    [    All Docs for all versions    ]
    http://otn.oracle.com/documentation/reports.html
    [     Publishing reports to web  - 10G  ]
    http://download.oracle.com/docs/html/B10314_01/toc.htm (html)
    http://download.oracle.com/docs/pdf/B10314_01.pdf (pdf)
    [   Building reports  - 10G ]
    http://download.oracle.com/docs/pdf/B10602_01.pdf (pdf)
    http://download.oracle.com/docs/html/B10602_01/toc.htm (html)
    [   Forms Reports Integration whitepaper  9i ]
    http://otn.oracle.com/products/forms/pdf/frm9isrw9i.pdf
    ---------------------------------------------------------------------------------

  • Transferrring parameter values from URL (by query strings)

    Hello,
    Is it possible to transfer username and password by a Url link with query strings? (http://help.sap.com/saphelp_nw04/helpdata/en/ce/3dd23a09313b37e10000000a11405a/content.htm )
    I tried the following URL pattern, but it didn't work..
    http://xxxxx.com:50000/irj/portal?sap-user=myuser&sap-password=123456
    Thanks for your help.

    you can try
    http://xxxxx.com:50000/irj/portal?j_user=myuser&j_password=123456
    Thanks
    puneet

  • CiscoIPPhoneExecute with URL query strings

    Has anyone successfully used the CiscoIPPhoneExecute xml object with URLs that contain query strings? Specifically, I'm wondering how to pass query string values that include spaces.
    I'm able to successfully execute a URL such as:
    http://<webaddress>/PushPage.asp?Field1=Value1&Field2=Value2
    However, when I try to execute a URL like:
    http://<webaddress>/PushPage.asp?Field1=Value with space&Field2=Value2
    The phone displays an error message that says "Not Available", and the url that is pushed never gets executed.
    I have tried representing spaces in the query string values using both the conventional "+" symbol, and I have also tried using "%20". Neither of these escape sequences seems to work.
    Thanks for any advice.
    -Mike

    Thanks for the response. As I stated above, I know that ampersand (&) must be escaped, and I am properly escaping that character in the XML packets. I'm not having any problems pushing URLs that contain ampersand.
    What I can't figure out is how to push URLs with *SPACES* included in the query string values. Please see the example URLs I posted in my original message, specifically the second URL. Again, I omitted the necessary ampersand escape sequence there for clarity.
    -Mike

Maybe you are looking for