public function pushBindings(BlazeContext $context) { $requestUri = $context->getRequest()->getRequestURI()->getPath(); // remove the prefix of the url e.g. BlazeFrameworkServer/ if (!$requestUri->endsWith('/')) { $requestUri = $requestUri->concat('/'); } $requestUri = $requestUri->substring($context->getApplication()->getUrlPrefix()->replace('*', '')->length()); // Requesturl has always to start with a '/' if ($requestUri->length() == 0 || $requestUri->charAt(0) != '/') { $requestUri = new String('/' . $requestUri->toNative()); } foreach ($this->mapping as $navigationRule) { $regex = '/^' . str_replace(array('/', '*'), array('\\/', '.*'), $navigationRule->getMapping()) . '$/'; if ($requestUri->matches($regex)) { $bindingParts = $requestUri->substring(strlen($navigationRule->getMapping()) - 1)->split('/'); $count = count($bindingParts); $newValue = null; // Look for the bindings $binds = $navigationRule->getBindings(); for ($i = 0; $i < $binds->count(); $i++) { if ($i < $count && $bindingParts[$i] != '') { $newValue = $bindingParts[$i]; } else { $newValue = $binds->get($i)->getDefault(); } if ($newValue !== null) { $binds->get($i)->getReference()->setValue($context, $newValue); $newValue = null; } } } } }
public function decode(\blaze\web\application\BlazeContext $context, \blaze\web\component\UIComponent $component) { if ($context->getRequest()->getParameter('BLAZE_COMMAND_IDENTIFIER') == $component->getClientId($context)) { $component->setClicked(true); $component->queueEvent(new \blaze\web\event\ActionEvent($component)); } }
public function decode(\blaze\web\application\BlazeContext $context, \blaze\web\component\UIComponent $component) { if ($context->getRequest()->getParameter($component->getClientId($context)) != null) { $component->setClicked(true); $component->queueEvent(new \blaze\web\event\ActionEvent($component)); } }
/** * <p>Perform all state transitions required by the current phase of the * request processing {@link javax.faces.lifecycle.Lifecycle} for a * particular request. </p> * * @param context FacesContext for the current request being processed * @throws FacesException if a processing error occurred while * executing this phase */ public function execute(BlazeContext $context) { $oldViewId = $context->getRequest()->getSession(true)->getAttribute('blaze.view_restore'); if ($oldViewId != null) { $oldViewId = $oldViewId->getViewId(); } $actViewId = $context->getViewRoot()->getViewId(); $requestedView = $context->getViewHandler()->getRequestView($context); if (!$context->getDoRenderResponse() && !$context->getNavigated() && $oldViewId == $actViewId) { if ($requestedView == null) { $context->getResponse()->sendError(\blaze\netlet\http\HttpNetletResponse::SC_NOT_FOUND); $context->responseComplete(); } else { $requestedViewId = $requestedView->getViewId(); if ($requestedViewId != $actViewId) { $context->setViewRoot($requestedView); // clean up the el view scope $context->getELContext()->getContext(\blaze\web\el\ELContext::SCOPE_VIEW)->resetValues($context); } } } $context->getRequest()->getSession()->setAttribute('blaze.view_restore', $context->getViewRoot()); if (!$context->getResponseComplete()) { $context->getViewRoot()->processRender($context); } }
private function getSession(\blaze\web\application\BlazeContext $context) { return $context->getRequest()->getSession(true); }
public function decode(\blaze\web\application\BlazeContext $context, \blaze\web\component\UIComponent $component) { if ($context->getRequest()->getParameter('BLAZE_FORM_IDENTIFIER') == $component->getClientId($context)) { $component->setSubmitted(true); } }
public function decode(\blaze\web\application\BlazeContext $context, \blaze\web\component\UIComponent $component) { $val = $context->getRequest()->getParameter($component->getClientId($context)); $component->setSubmittedValue($val === 'true'); }
/** * Handle <code>beforePhase</code> <code>PhaseListener</code> events. * @param blaze\web\application\BlazeContext $context the FacesContext for the current request * @param array[blaze\web\event\PhaseListener] $listenersIterator a ListIterator for the PhaseListeners that need * to be invoked * @param blaze\web\event\PhaseEvent $event the event to pass to each of the invoked listeners */ protected function handleBeforePhase(BlazeContext $context, \blaze\collections\Map $listeners, PhaseEvent $event) { //try { //Flash flash = context.getExternalContext().getFlash(); //flash.doPrePhaseActions(context); //} catch (UnsupportedOperationException uoe) { //if (LOGGER.isLoggable(Level.FINE)) { //LOGGER.fine("ExternalContext.getFlash() throw UnsupportedOperationException -> Flash unavailable"); //} //} //RequestStateManager.clearAttributesForPhase(context, // context.getCurrentPhaseId()); $requestUri = $context->getRequest()->getRequestURI()->getPath(); // remove the prefix of the url e.g. BlazeFrameworkServer/ if (!$requestUri->endsWith('/')) { $requestUri = $requestUri->concat('/'); } $requestUri = $requestUri->substring($context->getApplication()->getUrlPrefix()->replace('*', '')->length()); // Requesturl has always to start with a '/' if ($requestUri->length() == 0 || $requestUri->charAt(0) != '/') { $requestUri = new \blaze\lang\String('/' . $requestUri->toNative()); } foreach ($listeners as $pattern => $listener) { if (($this->getId() == $listener->getPhaseId() || \blaze\web\event\PhaseId::ANY_PHASE == $listener->getPhaseId()) && $this->matchesPattern($requestUri, $pattern)) { try { $listener->beforePhase($event); } catch (Exception $e) { $this->queueException($context, $e); //, ExceptionQueuedEventContext.IN_BEFORE_PHASE_KEY); // move the iterator pointer back one //if (listenersIterator.hasPrevious()) { //listenersIterator.previous(); //} return; } } } }
public function getRequestView(BlazeContext $context) { $requestUri = $context->getRequest()->getRequestUri()->getPath(); // remove the prefix of the url e.g. BlazeFrameworkServer/ if (!$requestUri->endsWith('/')) { $requestUri = $requestUri->concat('/'); } $requestUri = $requestUri->substring($context->getApplication()->getUrlPrefix()->replace('*', '')->length()); // Requesturl has always to start with a '/' if ($requestUri->length() == 0 || $requestUri->charAt(0) != '/') { $requestUri = new String('/' . $requestUri->toNative()); } foreach ($this->mapping as $navigationRule) { $regex = '/^' . str_replace(array('/', '*'), array('\\/', '.*'), $navigationRule->getMapping()) . '$/'; if ($requestUri->matches($regex)) { return $this->getView($context, $navigationRule->getIndexView()); } } return null; }
public function resetValues(\blaze\web\application\BlazeContext $context) { $sess = $context->getRequest()->getSession(true); $sess->setAttribute('blaze.web.el.scope.view', null); }