/** * Constructor * * @param util.cmd.ParamString args */ public function __construct(\util\cmd\ParamString $args) { $url = new \peer\URL($args->value(0)); // If protocol string does not contain port number, set default. if (self::ESDL_PORT === $url->getPort(self::ESDL_PORT)) { $url->setPort(self::ESDL_PORT); } // Check given URL to inform user if invalid port used. if (self::ESDL_PORT !== $url->getPort()) { \util\cmd\Console::$err->writeLine('Notice: using non-standard port ' . $url->getPort() . ', ESDL services are usually available at port 6449.'); } $this->remote = Remote::forName($url->getURL()); $this->jndi = $args->value(1); $this->processor = new DomXSLProcessor(); $this->processor->setXSLBuf($this->getClass()->getPackage()->getResource($args->value('lang', 'l', 'xp5') . '.xsl')); }
/** * Navigate to a given URL * * @param string target * @param string params * @param string method * @throws unittest.AssertionFailedError */ public function navigateTo($target, $params = null, $method = HttpConstants::GET) { if (strstr($target, '://')) { $url = new \peer\URL($target); $this->conn = $this->getConnection(sprintf('%s://%s%s/', $url->getScheme(), $url->getHost(), -1 === $url->getPort(-1) ? '' : ':' . $url->getPort())); $params ? $url->setParams($params) : ''; $this->beginAt($url->getPath(), $url->getParams(), $method); } else { if ('' !== $target && '/' === $target[0]) { $this->beginAt($target, $params, $method); } else { $base = $this->getBase(); $this->beginAt(substr($base, 0, strrpos($base, '/')) . '/' . $target, $params, $method); } } }