Author Topic: MOBAC mapsource help needed  (Read 2715 times)

Offline Trullo Fetzer

  • More than Newbie
  • *
  • Posts: 16
    • View Profile MOBAC mapsource help needed
« on: November 12, 2013, 14:08:13 »
Hello to all Beanshell wizards.
I have the following problem. I try to access the German Geoportal with MOBAC, but that server is issuing 2 cookies. One for JSESSIONID and one for PHPSESSID. With the code below I only get the first cookie (JSESSIONID) successfully. I found some java code examples for storing cookies, but I don't know how to integrate this into the script. Any help would be appreciated. There are different approaches to get cookie values which I tried, but all of them only get the first cookie. Tahnks in advance.
Code: [Select]
name = "Geoportal DE";

tileType = "png"; // required; valid values: "jpg" "png" or "gif"

// Default size of each tile is 256x256 pixel
tileSize = 256; // optional
minZoom = 7;    // optional
maxZoom = 15;   // optional
//tileUpdate = TileUpdate.IfModifiedSince; // optional

//get authentication cookie

URL url = new URL("");
httpConn = url.openConnection();
authHeader = httpConn.getHeaderField("Set-Cookie");
auth = authHeader.split(";")[0];

 This method is called for each tile: input parameters for this script: "zoom", "x" and "y"
String getTileUrl( int zoom, int x, int y ) {
return ""+zoom+"/"+x+"/"+y+".png";

 This method is called also for each tile (implementation optional)
 It allows to set HTTP headers like "Referer" or cookies the server
 wants to see.
void addHeaders( conn) {
  conn.addRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 12.16");