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

Similar Messages

  • Using a Variable in HttpService url attribute

    I have a dynamic url defined below
    public var forecastURL:String = "
    http://www.weather.gov/forecasts/xml/SOAP_server/ndfdSOAPclientByDay.php?lat="
    + latitude + "&lon=" + longitude +
    "&format=12+hourly&startDate=" + todaysDate +
    "&numDays=" + numberDays + ""
    I would like to use the var without the {} bind. The compiler
    complains if the url is not surrounded in quotes. This should be
    simple? How can I use a var within the url attribute without the
    bind brackets?
    <mx:HTTPService
    id="forecastRequest"
    url = "{forecastURL}" result="resultHandler(event)"
    />

    Not Possible..why don't you use the subtitle box instead of help url?

  • Receiver SOAP Adapter Use Query String

    Hello everybody,
    I want to include in my Receiver SOAP Adapter the message id as part of the URL String, but I need to include only the MessageId value, if I use the Use Encoded Headers and Use Query String options it includes all the header fields as part of the URL, is there a way to define only the fields that I need?, thanks in advance.
    Regards,
    Julio Cesar

    May be you could try to use adapter specific message attribute "TServerLocation". This will help you set the dynamic URL.
    http://help.sap.com/saphelp_nw04/helpdata/en/29/5bd93f130f9215e10000000a155106/frameset.htm
    Regards,
    Prateek

  • Java.lang.NoSuchMethodError: com.sun.xml.ws.util.JAXWSUtils.getEncodedURL(Ljava/lang/String;)Ljava/net/URL;

    java.lang.NoSuchMethodError: com.sun.xml.ws.util.JAXWSUtils.getEncodedURL(Ljava/lang/String;)Ljava/net/URL.
    Gettin exception while trying to execute clientGen from build.xml from eclipse using Oracle weblogic 10.3 server.
    I tried with both jars jaxws-rt-2.1.4 and jaxws-rt-2.1.3
    Regards,
    Manish

    along with wlfullclient.jar please add wseeclient.jar
    Copy the file WL_HOME/server/lib/wseeclient.zip from the computer hosting WebLogic Server to the client computer( where WL_HOME refers to the WebLogic Server installation directory, such as /Oracle/Middleware/wlserver_12.1)
    Unzip the wseeclient.zip file into the appropriate directory. For example, you might unzip the file into a directory that contains other classes used by your client application.
    Add the wseeclient.jar file (unzipped from the wseeclient.zip file) to your CLASSPATH.
    Note:
    Also be sure that your CLASSPATH includes the JAR file that contains the Ant classes (ant.jar). This JAR file is typically located in the lib directory of the Ant distribution.
    http://docs.oracle.com/cd/E24329_01/web.1211/e24967/client.htm#WSRPC214
    Regards,
    Sunil P

  • Using variables in CURL for urls.

    Hello, I am fairly new here and new to programming. I am trying to make a program that will ask for a url and store it in a character array and use that variable as the URL for the url argument, in quotations, using libcurl, of course.
    curl_easy_setopt(curl, CURLOPT_URL, "<here>");
    However, when I do it the way I would with printf()
    curl_easy_setopt(curl, CURLOPT_URL, "%c", &...);
    it says prg.c:12:53: error: macro "curl_easy_setopt" passed 4 arguments, but takes just 3
    Is there a way to do what I am trying to do?
    Last edited by fawx (2008-08-20 13:06:24)

    I don't know what u really want to do. And what I found is that there is not an overloaded function like the one you are trying to use, in fact there is no overloaded functions for that one.
    http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
    CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter);
    If you want to pass a URL that dynamically fills the parameter variable you can first create a string and copy the info from another one then concatenate another.
    Here is an example that maybe could help you.
    char url[128];
    char *page = "hello.html";
    strcpy( url, "www.google.com" );
    strcat( url, page );
    for this you must include string.h, then you can use url to send as parameter in your function.

  • Pass username and password adfs without using query string

    pass username and password ADFS without using query string, Please help.
    I used query string , but it is unsecured to pass credentials over url, with simple tool like httpwatch , anyone can easily get the password and decrypt it.

    Hello MohitJainMJ,
    You're not in the right forum. Here it's for FIM topics!
    Regards,
    Sylvain

  • Pass username and password ADFS without using query string, Please help.

    pass username and password ADFS without using query string, Please help.
    I used query string , but it is unsecured to pass credentials over url, with simple tool like httpwatch , anyone can easily get the password and decrypt it.

    Hi,
    According to your post, my understanding is that you had an issue about the ADFS.
    As this issue is related to ADFS, I recommend you post your issue to the forum for ADFS.
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=Geneva
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thank you for your understanding and support.
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • Use query string between two custom New Form

    Hi guys,
    i have a New Form . In this  form i have  a button that open(onClick) another list form (it is a  different list). I have to pass a field value from the first form to the other . How can i do this using query string?Help please!
    Thank you!

    To pass some value with query string, you just need to open the form url with the querystring parameters (jquery needed):
    var url = '<yourlist>/newform.aspx?parameter1=' + $('input[Title="Title"]').val()
    SP.UI.ModalDialog.ShowPopupDialog(url)
    on the second newform.aspx, you can grab the querystring parameters with the Sharepoint native function "_spGetQueryParam('<lower case query key>')"
    var x = _spGetQueryParam("parameter1")
    Note: make sure you use the key as lowercase, even you if pass it with chars in uppercase.

  • How to reference the Instance name using Substitution string or SQL

    All:
    We have an Application that will be replicated in multiple Apex instances and would like to display the current Oracle Apex Instance name ( Similar to the &APP_USER. on the Welcome portion of the page ) .
    Is there a substitution string for this ?
    We plan on using a Show/Hide region on the splash page titled [About], that when clicked displays an HTML region with the subsitution strings.
    If no substitution strings, can someone help with an SQL that returns the Instance name ?
    Thanks for all the help.
    Aubrey Fernandes

    Aubrey Fernandes wrote:
    I currently have 3 URLs to get to my Development, QA and Production servers & will have many more production servers with different Application Ids.
    Development = http://canqa101:7777/pls/ngcrmd01/apex
    QA = http://canqa101:7777/pls/ngcrmq01/f?p=100:1
    Production = http://cancs105:7777/pls/ngcrmp01/f?p=100:1
    What I need are the portions before the final forward slash ( canqa101:7777/pls/ngcrmd01 ) which I assumed is the Oracle Apex instance.That information is determined by the web server configuration (e.g. the DADs when using OHS) rather than through APEX itself. There are no built-in substitution strings for this. Create an application item and an On New Instance (new session) computation to set the value using the function<tt>owa_util.get_cgi_env</tt> function to get the CGI environment variables <tt> HTTP_HOST</tt> and <tt>SCRIPT_NAME</tt>. You can then reference the value in the region using substitution string syntax.

  • Create HelpSet using input stream and not URL

    Hi All,
    I looked over the docs and apis and I was not able to find any way to create a HelpSet from an input stream.
    Basically all I have is are input streams to the help files and not URLs, is there a way to initialize the help set with that?
    thanks

    Never compare Strings using Object equality or inequality ("==" resp. "!=").
    Use [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#equals(java.lang.Object)]String#equals (or [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#indexOf(java.lang.String)]String#indexOf or [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#matches(java.lang.String)]String#matches).
    Please use code tags when posting code. This means wrapping your text between [code[/b]][[/b]code] tags. See the [url http://forum.java.sun.com/help.jspa?sec=formatting]Formatting tips.

  • Href using a string

    Hi,
    I am trying to create a Hyperlink to open a report, the reports title is taken from a database and put into a String called URL, how do I create a link using this string.
    I have tried to do it with:
    {%><td><a href= 'URL' target = "_blank"> View Report<%}%>
              </td>
    But this doesn't work, any advice/help on this would be greatly appreciated.
    thanks
    Justin

    hi friend,
    You have to use the expression element for this.
    try this code:
    <%
    String url=/*record obtained from db*/;
    %>
    <a href="<%=url%>" target = "_blank"> View Report</a>

  • Powershell use Connection String to query Database and write to Excel

    Right now I have a powershell script that uses ODBC to query SQL Server 2008 / 2012 database and write to EXCEL
    $excel = New-Object -Com Excel.Application
    $excel.Visible = $True
    $wb = $Excel.Workbooks.Add()
    $ws = $wb.Worksheets.Item(1)
    $ws.name = "GUP Download Activity"
    $qt = $ws.QueryTables.Add("ODBC;DSN=$DSN;UID=$username;PWD=$password", $ws.Range("A1"), $SQL_Statement)
    if ($qt.Refresh()){
    $ws.Activate()
    $ws.Select()
    $excel.Rows.Item(1).HorizontalAlignment = $xlCenter
    $excel.Rows.Item(1).VerticalAlignment = $xlTop
    $excel.Rows.Item("1:1").Font.Name = "Calibri"
    $excel.Rows.Item("1:1").Font.Size = 11
    $excel.Rows.Item("1:1").Font.Bold = $true
    $filename = "D:\Script\Reports\Status_$a.xlsx"
    if (test-path $filename ) { rm $filename }
    $wb.SaveAs($filename, $xlOpenXMLWorkbook) #save as an XML Workbook (xslx)
    $wb.Saved = $True #flag it as being saved
    $wb.Close() #close the document
    $Excel.Quit() #and the instance of Excel
    $wb = $Null #set all variables that point to Excel objects to null
    $ws = $Null #makes sure Excel deflates
    $Excel=$Null #let the air out
    I would like to use connection string to query the database and write results to EXCEL, i.e.
    $SQL_Statement = "SELECT ..."
    $conn = New-Object System.Data.SqlClient.SqlConnection
    $conn.ConnectionString = "Server=10.10.10.10;Initial Catalog=mydatabase;User Id=$username;Password=$password;"
    $conn.Open()
    $cmd = New-Object System.Data.SqlClient.SqlCommand($SQL_Statement,$conn)
    do{
    try{
    $rdr = $cmd.ExecuteReader()
    while ($rdr.read()){
    $sql_output += ,@($rdr.GetValue(0), $rdr.GetValue(1))
    $transactionComplete = $true
    catch{
    $transactionComplete = $false
    }until ($transactionComplete)
    $conn.Close()
    How would I read the columns and data for $sql_output into an EXCEL worksheet. Where do I find these tutorials?

    Hi Q.P.Waverly,
    If you mean to export the data in $sql_output to excel document, please try to format the output with psobject:
    $sql_output=@()
    do{
    try{
    $rdr = $cmd.ExecuteReader()
    while ($rdr.read()){
    $sql_output+=New-Object PSObject -Property @{data1 = $rdr.GetValue(0);data2 =$rdr.GetValue(1)}
    $transactionComplete = $true
    catch{
    $transactionComplete = $false
    }until ($transactionComplete)
    $conn.Close()
    Then please try to use the cmdlet "Export-Csv" to export the data to excel like:
    $sql_output | Export-Csv d:\data.csv
    Or you can export to worksheet like:
    $excel = New-Object -ComObject Excel.Application
    $excel.Visible = $true
    $workbook = $excel.Workbooks.Add()
    $sheet = $workbook.ActiveSheet
    $counter = 0
    $sql_output | ForEach-Object {
    $counter++
    $sheet.cells.Item($counter,1) = $_.data1$sheet.cells.Item($counter,2) = $_.data2}
    Refer to:
    PowerShell and Excel: Fast, Safe, and Reliable
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang

  • How can I display special characters of NonEuropean languages (French, Italian, Spanish, German and Portuguese.) using import string mechanism

    I would like to translate the User Interface of my application to French, Italian, Spanish, German and Portuguese.
    When I put special characters in the import string file they showed up as ? (question mark)
    The import strings file includes the following parameters for each string: font, text, size and style. (but no field for script)
    In order to use a unicode font such as Arial I need to select a french script. But this option is not supported bu LabView (As far as I saw)
    A) Is there a font which is directly German/ French etc and not regula font + script parameter?
    B) Are there another required step
    s for special characters support? (When I put speciual characters in the import string file the showed up as ? question mark)

    This was discussed last week in this group- read the previous messages.
    Look for the thread "Foreign Languages in Labview"
    And recite the mantra
    ActiveX is good
    ActiveX is holy
    All Hail Bill
    Those who claim otherwise are heretics and not to be trusted
    Actually, in this case the non-ActiveX suggestions may be good.
    talia wrote in message
    news:[email protected]..
    > How can I display special characters of NonEuropean languages (French,
    > Italian, Spanish, German and Portuguese.) using import string
    > mechanism

  • The MAC signature found in the HTTP request '***' is not the same as any computed signature. Server used following string to sign: 'POST

    Hi,
    When trying with Postman sending a REST call to Azure Storage Queues I get:
    The MAC signature found in the HTTP request '***' is not the same as any computed signature. Server used following string to sign: 'POST.
    The code I have for creating the Authorization Header:
    var accountName = "my_account";
    string key = ConfigurationManager.AppSettings["my_access_key"];
    DateTime dt = DateTime.Now;
    string formattedDate = String.Format("{0:r}", dt);
    var canonicalizedHeaders = "x-ms-date:" + formattedDate + "\n" + "x-ms-version:2009-09-19" + "\n" ;
    var canonicalizedResource = "/my_account/myqueue/messages";
    var stringToSign = String.Format("POST,\n\n\n\n\n\n\n\n\n\n\n{0}{1}", canonicalizedHeaders, canonicalizedResource);
    stringToSign = HttpUtility.UrlEncode(stringToSign);
    HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));
    var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign)));
    var authorizationHeader = String.Format(CultureInfo.InvariantCulture, "SharedKey {0}:{1}", accountName, signature);
    return authorizationHeader;
    Anyone any idea what I'm missing/doing wrong?
    Additional question: do i have to create for every message I want to send a new Authorization header? Or is there an option (as with Service Bus Topics) to create a header that can be used for a certain timeframe?
    Thanks.

    One issue is with this line of code:
    HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));
    Please use the following:
    HMACSHA256 hmac = new HMACSHA256(Convert.FromBase64String(key));
    and that should take care of the problem.
    Regarding your question, "do i have to create for every message I want to send a new Authorization header? Or is there an option (as with Service Bus Topics) to create a header that can be used for a certain timeframe?"
    With your current approach, the answer is yes. What you can do is create a Shared Access Signature on the queue which will be valid for certain duration and then use that for posting messages to a queue using simple HttpWebRequest/HttpWebResponse.
    Hope this helps.

  • How to use List String in JSP page?

    Hello All,
    I am having problem using List<String> in my JSP page. Below is my JSP code.
    <%@ page import="java.util.*, java.io.*"%>
    <html>
    <body>
    <h1 align="center">Beer Recommendations JSP</h1>
    <p>
    <%
    List<String> beerBrands = (List<String>)request.getAttribute("styles");
    Iterator<String> it = beerBrands.iterator();
    while(it.hasNext()){
         out.print("<br>try: " + it.next());
    %>
    </body>
    </html>
    When I compile the above JSP code in Eclipse 3.4 (using JBoss 4.2 as my Application Server), I get the following Warning.
    Type safety: Unchecked cast from Enumeration to Enumeration<String>
    If I add the "@SuppressWarnings("unchecked")" to the code, Eclipse does not give any Error during compilation. But, at runtime, I get the following Error.
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 10 in the jsp file: /BeerAdvice.jsp
    Syntax error, annotations are only available if source level is 5.0
    7: <p>
    8:
    9: <%
    10: @SuppressWarnings("unchecked")
    11: List<String> beerBrands = (List<String>)request.getAttribute("styles");
    12: Iterator<String> it = beerBrands.iterator();
    13: while(it.hasNext()){
    An error occurred at line: 11 in the jsp file: /BeerAdvice.jsp
    The type List is not generic; it cannot be parameterized with arguments <String>
    8:
    9: <%
    10: @SuppressWarnings("unchecked")
    11: List<String> beerBrands = (List<String>)request.getAttribute("styles");
    12: Iterator<String> it = beerBrands.iterator();
    13: while(it.hasNext()){
    14:      out.print("<br>try: " + it.next());
    An error occurred at line: 11 in the jsp file: /BeerAdvice.jsp
    Syntax error, parameterized types are only available if source level is 5.0
    8:
    9: <%
    10: @SuppressWarnings("unchecked")
    11: List<String> beerBrands = (List<String>)request.getAttribute("styles");
    12: Iterator<String> it = beerBrands.iterator();
    13: while(it.hasNext()){
    14:      out.print("<br>try: " + it.next());
    Any help is very much appreciated.
    Thank you for your help.
    Thanks,
    Chubha

    Hi anotherAikman,
    Thank you for your help. I currently have the following version of the Java.
    {color:#800000}java version "1.6.0_17"
    Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
    Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)
    {color:#000000}{color:#000000}Does it mean I have Java SE Version 6 Update 17 and you are suggesting me to download the Java EE Version 6?{color} If this is correct, can you please let me know what difference does it make?
    I am now going to install the Java EE 6 and try this out.
    Thank you for your help.{color}
    {color:#000000}Thanks,
    Chubha{color}
    {color}

Maybe you are looking for