public function redirect($url, array $options = array())
{
$router = $this->_classes['router'];
$defaults = array('location' => null, 'status' => 302, 'head' => true, 'exit' => false);
$options += $defaults;
$params = compact('url', 'options');
$this->_filter(__METHOD__, $params, function ($self, $params) use($router) {
$options = $params['options'];
$location = $options['location'] ?: $router::match($params['url'], $self->request);
$self->render(compact('location') + $options);
});
if ($options['exit']) {
$this->response->render();
$this->_stop();
}
return $this->response;
}