1 package com.sslexplorer.agent.client.webforwards; 2 3 import java.io.IOException ; 4 5 import com.maverick.multiplex.Request; 6 import com.maverick.util.ByteArrayReader; 7 import com.maverick.util.ByteArrayWriter; 8 import com.sslexplorer.agent.client.AbstractResourceManager; 9 import com.sslexplorer.agent.client.Agent; 10 11 17 public class WebForwardManager extends AbstractResourceManager { 18 19 22 public final static int WEBFORWARD_RESOURCE_TYPE_ID = 0; 23 24 25 static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(WebForwardManager.class); 27 29 32 public static final String SETUP_AND_LAUNCH_WEB_FORWARD = "setupAndLaunchWebForward@3sp.com"; 34 public WebForwardManager(Agent agent) { 35 super(agent); 36 } 37 38 public void getWebForwardResources() { 39 super.getResources(WEBFORWARD_RESOURCE_TYPE_ID, "Web Forwards"); 40 } 41 42 public void launchResource(int resourceId) { 43 try { 44 ByteArrayWriter baw = new ByteArrayWriter(); 45 baw.writeInt(resourceId); 46 Request request = new Request(SETUP_AND_LAUNCH_WEB_FORWARD, baw.toByteArray()); 47 if (agent.getConnection().sendRequest(request, true) && request.getRequestData()!=null) { 48 ByteArrayReader bar = new ByteArrayReader(request.getRequestData()); 49 String uri = bar.readString(); 50 agent.getGUI().openBrowser(uri); 51 log.debug("Application launch setup"); 53 } else { 56 log.error("Failed to setup and launch application launch"); 58 } 60 } catch (IOException e) { 61 log.error("Failed to setup and launch application launch", e); 63 } 65 } 67 } 68 | Popular Tags |