/**
  * Returns the REQUEST_URI taking into account
  * platform differences between Apache and IIS
  *
  * @param boolean $clean clean non UTF-8 characters
  * @return string
  */
 public function getRequestUri($clean = false)
 {
     $uri = $this->_request->getRequestUri();
     if ($clean) {
         $uri = $this->_converter->cleanString($uri);
     }
     return $uri;
 }
Exemple #2
0
 /**
  * Retrieve current url
  *
  * @return string
  */
 public function getCurrentUrl()
 {
     $httpHostWithPort = $this->_request->getHttpHost(false);
     $httpHostWithPort = explode(':', $httpHostWithPort);
     $httpHost = isset($httpHostWithPort[0]) ? $httpHostWithPort[0] : '';
     $port = '';
     if (isset($httpHostWithPort[1])) {
         $defaultPorts = [\Magento\Framework\App\Request\Http::DEFAULT_HTTP_PORT, \Magento\Framework\App\Request\Http::DEFAULT_HTTPS_PORT];
         if (!in_array($httpHostWithPort[1], $defaultPorts)) {
             /** Custom port */
             $port = ':' . $httpHostWithPort[1];
         }
     }
     return $this->_request->getScheme() . '://' . $httpHost . $port . $this->_request->getRequestUri();
 }
 /**
  * Checks, whether Magento requires redirection after successful admin login, and redirects user, if needed
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  */
 protected function _redirectIfNeededAfterLogin(\Magento\Framework\App\RequestInterface $request)
 {
     $requestUri = null;
     // Checks, whether secret key is required for admin access or request uri is explicitly set
     if ($this->_url->useSecretKey()) {
         $requestUri = $this->_url->getUrl('*/*/*', ['_current' => true]);
     } elseif ($request) {
         $requestUri = $request->getRequestUri();
     }
     if (!$requestUri) {
         return false;
     }
     $this->_response->setRedirect($requestUri);
     $this->_actionFlag->set('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH, true);
     return true;
 }
 /**
  * Compute the request Url from the Http request
  *
  * @param RequestInterface $httpRequest
  * @return string
  */
 public function getRequestUrl($httpRequest)
 {
     return $httpRequest->getScheme() . '://' . $httpRequest->getHttpHost(false) . $httpRequest->getRequestUri();
 }