Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Blocked Permission: ("java.util.PropertyPermission" "http.agent" "write") when trying to open a URL connection

Featured Replies

I'm trying to read in item prices via the Runescape wiki API, but they block generic requests from anything with the default user agent of Java/{version}, so you have to use:

System.setProperty("http.agent", "Chrome");

In order to not get blocked by them. However, this line seems to be blocked by the OSBot client, because when I have it added I get the error:

Blocked permission: ("java.util.PropertyPermission" "http.agent" "write")

I assume there's a reason the client blocks this, but I'm not sure why. Is there an alternative or a workaround? Here is my full code:

 

public static JsonObject loadItemPrices() throws IOException {
        String sURL = "https://prices.runescape.wiki/api/v1/osrs/latest";

        URL url = new URL(sURL);
        URLConnection request = url.openConnection();
        request.connect();
        JsonParser jp = new JsonParser();
        JsonElement root = null;
        System.setProperty("http.agent", "Chrome");
        try {
            root = jp.parse(new InputStreamReader((InputStream) request.getContent()));
        } catch(Exception e) { 
            
        }
        JsonObject obj = root.getAsJsonObject();
        JsonElement element = obj.get("data");
        JsonObject data = element.getAsJsonObject();
        
        return data;
    }

 

URLConnection request = url.openConnection();
request.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0");
request.connect();

 

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.