/* (non-Javadoc)
@see javax.servlet.RequestDispatcher#forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
352220
public void forward(ServletRequest request, ServletResponse response)
			throws ServletException, IOException {
		if(request != null) {
			((SipServletRequest)request).getSession().setHandler(handler.getName());
		} else {
			((SipServletResponse)response).getSession().setHandler(handler.getName());
		}
		Servlet servlet = handler.allocate();
		servlet.service(request, response);
		handler.deallocate(servlet);
	}
326998
async def forward(self, n, *, timeout=None) -> int:
        
        """
        self._check_ready()
        if n <= 0:
            raise exceptions.InterfaceError('n must be greater than zero')

        protocol = self._connection._protocol
        status = await protocol.query('MOVE FORWARD {:d} {}'.format(
            n, self._portal_name), timeout)

        advanced = int(status.split()[1])
        if advanced < n:
            self._exhausted = True

        return advanced
706826
public void process() {
    switch (request.getRequestType()) {
      case START_SESSION:
        log.info("Got a request to create a new session: "
                 + new DesiredCapabilities(request.getDesiredCapabilities()));
        try {
          registry.addNewSessionRequest(this);
          waitForSessionBound();
          beforeSessionEvent();
          forwardNewSessionRequestAndUpdateRegistry(session);
        } catch (Exception e) {
          cleanup();
          log.log(Level.INFO, "Error forwarding the new session " + e.getMessage(), e);
          throw new GridException("Error forwarding the new session " + e.getMessage(), e);
        }
        break;
      case REGULAR:
      case STOP_SESSION:
        session = getSession();
        if (session == null) {
          ExternalSessionKey sessionKey = null;
          try {
            sessionKey = request.extractSession();
          } catch (RuntimeException ignore) {}
          throw new GridException("Session [" + sessionKey + "] not available - "
              + registry.getActiveSessions());
        }
        try {
          forwardRequest(session, this);
        } catch (ClientGoneException e) {
          log.log(Level.WARNING, "The client is gone for session " + session + ", terminating");
          registry.terminate(session, SessionTerminationReason.CLIENT_GONE);
        } catch (SocketTimeoutException e) {
          log.log(Level.SEVERE, "Socket timed out for session " + session + ", " + e.getMessage());
          registry.terminate(session, SessionTerminationReason.SO_TIMEOUT);
        } catch (Throwable t) {
          log.log(Level.SEVERE, "cannot forward the request " + t.getMessage(), t);
          registry.terminate(session, SessionTerminationReason.FORWARDING_TO_NODE_FAILED);
          throw new GridException("cannot forward the request " + t.getMessage(), t);
        }

        if (request.getRequestType() == RequestType.STOP_SESSION) {
          registry.terminate(session, SessionTerminationReason.CLIENT_STOPPED_SESSION);
        }
        break;
      default:
        throw new RuntimeException("NI");
    }
  }
671031
private CompletableFuture<QueryResponse> queryForward(QueryRequest request) {
    if (context.getLeader() == null) {
      return CompletableFuture.completedFuture(logResponse(QueryResponse.builder()
        .withStatus(Response.Status.ERROR)
        .withError(CopycatError.Type.NO_LEADER_ERROR)
        .build()));
    }

    LOGGER.trace("{} - Forwarding {}", context.getCluster().member().address(), request);
    return this.<QueryRequest, QueryResponse>forward(request)
      .exceptionally(error -> QueryResponse.builder()
        .withStatus(Response.Status.ERROR)
        .withError(CopycatError.Type.NO_LEADER_ERROR)
        .build())
      .thenApply(this::logResponse);
  }
524580
public static void chainRequestDispatchers(RequestDispatcher[] dispatchers, HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException{
        for(int i=0; i<dispatchers.length-1; i++) {
            ChainedResponse chainedResp = new ChainedResponse(request, response);
            dispatchers[i].forward(request, chainedResp);
            request = chainedResp.getChainedRequest();
        }
        dispatchers[dispatchers.length-1].forward(request, response);
    }
213025
def forward(self):
        
        if not self.object_id or self.__is_draft:
            raise RuntimeError("Can't forward this message")

        url = self.build_url(
            self._endpoints.get('forward_message').format(id=self.object_id))

        response = self.con.post(url)
        if not response:
            return None

        message = response.json()

        # Everything received from cloud must be passed as self._cloud_data_key
        return self.__class__(parent=self, **{self._cloud_data_key: message})
260477
function forward(){
  return function forward(req, res, next){
    var url  = utils.processUrl(req);
    var options = {
      url: url,
      method: req.method,
      headers: req.headers
    }
    var buffers = [];

    log.debug('forward: ' + url);
    
    if(req.method === 'POST'){
      req.on('data', function(chunk){
        buffers.push(chunk);
      });

      req.on('end', function(){
        options.data = Buffer.concat(buffers);
        utils.request(options, function(err, data, proxyRes){
          _forwardHandler(err, data, proxyRes, res);
        });
      });
    }else{
      utils.request(options, function(err, data, proxyRes){
        _forwardHandler(err, data, proxyRes, res)
      }); 
    }
  };
}
1167702
private String getURI(HttpServletRequest request)
    {
        String uri= (String)request.getAttribute("javax.servlet.forward.request_uri");
        if (uri == null)
            uri= request.getRequestURI();
        return uri;
    }
379433
@Override
    public void setForwardRoutingPath(String[] forwardPath) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setForwardRoutingPath", (forwardPath == null ? null : Arrays.asList(forwardPath)));

        // If it is an empty array then we consider it to be the same as null.
        if ((forwardPath != null) && (forwardPath.length == 0)) {
            forwardPath = null;
        }

        // Now check that none of the elements is null.
        if (forwardPath != null) {
            // Note that at this point we know that it has at least one element.
            for (int i = 0; i < forwardPath.length; i++) {
                if (forwardPath[i] == null) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                        SibTr.debug(this, tc, "Element " + i + " of the array is null.");
                    throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class
                                                                    , "INVALID_VALUE_CWSIA0281"
                                                                    , new Object[] { "forwardPath[" + i + "]", "null" }
                                                                    , tc
                                    );
                }
            }
        }

        // Clear the cache of the encoding string since we are changing properties.
        clearCachedEncodings();

        // Clear the cached producerDestinationAddress, as it may now be incorrect
        clearCachedProducerDestinationAddress();

        // Now store or remove the property
        if (forwardPath != null) {
            properties.put(FORWARD_ROUTING_PATH, StringArrayWrapper.create(forwardPath, getDestName()));
        }
        else {
            properties.remove(FORWARD_ROUTING_PATH);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setForwardRoutingPath");
    }
810946
@Override
    public Tensor forward() {
        Tensor x = modInX.getOutput();
        y = new Tensor(x); // copy
        y.log();
        return y;
    }
412545
private void forwardRequest(Request request, boolean subsequent) {

		if(logger.isDebugEnabled()) {
			logger.debug("creating cloned Request for proxybranch " + request);
		}
		final SipServletRequestImpl clonedRequest = (SipServletRequestImpl) proxy.getSipFactoryImpl().getMobicentsSipServletMessageFactory().createSipServletRequest(
				request,
				null,
				null, null, false);
		
		if(logger.isDebugEnabled()) {
			logger.debug("forwardRequest - clonedRequest=" + clonedRequest);
		}
		
		if(subsequent) {
			if(logger.isDebugEnabled()) {
				logger.debug("forwardRequest - setRoutingState to SUBSEQUENT");
			}
			clonedRequest.setRoutingState(RoutingState.SUBSEQUENT);
		}
		
		this.outgoingRequest = clonedRequest;
		
		// Initialize the sip session for the new request if initial
		final MobicentsSipSession originalSipSession = originalRequest.getSipSession();
		if(logger.isDebugEnabled()) {
			logger.debug("forwardRequest - originalSipSession=" + originalSipSession);
			logger.debug("forwardRequest - originalRequest.getCurrentApplicationName()=" + originalRequest.getCurrentApplicationName());
		}
		
		clonedRequest.setCurrentApplicationName(originalRequest.getCurrentApplicationName());
		if(clonedRequest.getCurrentApplicationName() == null && subsequent) {
			if(logger.isDebugEnabled()) {
				logger.debug("forwardRequest - originalSipSession.getSipApplicationSession().getApplicationName()=" + originalSipSession.getSipApplicationSession().getApplicationName());
			}
			clonedRequest.setCurrentApplicationName(originalSipSession.getSipApplicationSession().getApplicationName());
		}
		clonedRequest.setSipSession(originalSipSession);
		final MobicentsSipSession newSession = (MobicentsSipSession) clonedRequest.getSipSession();
		try {
			if(logger.isDebugEnabled()) {
				logger.debug("forwardRequest - calling setHandler - originalSipSession.getHandler()=" + originalSipSession.getHandler());
			}
			newSession.setHandler(originalSipSession.getHandler());
		} catch (ServletException e) {
			logger.error("could not set the session handler while forwarding the request", e);
			throw new RuntimeException("could not set the session handler while forwarding the request", e);
		}
		
		// Use the original dialog in the new session
		// commented out proxy applications shouldn't use any dialogs !!!
//		newSession.setSessionCreatingDialog(originalSipSession.getSessionCreatingDialog());
		
		// And set a reference to the proxy		
		newSession.setProxy(proxy);		
				
		try {
			if(logger.isDebugEnabled()) {
				logger.debug("forwardRequest - calling checkRequest");
			}
			RFC5626Helper.checkRequest(this, request, originalRequest);
		} catch (IncorrectFlowIdentifierException e1) {
			if(logger.isDebugEnabled()) {
				logger.debug("forwardRequest - checkRequest threw an exception", e1);
			}
			logger.warn(e1.getMessage());
			this.cancel();
			try {
				originalRequest.createResponse(403).send();
			} catch (IOException e) {
				logger.error("couldn't send 403 response", e1);
			}
			return;
		}
		//JSR 289 Section 15.1.6
		if(!subsequent) {
			if(logger.isDebugEnabled()) {
				logger.debug("forwardRequest - not subsequent");
			}
			// Subsequent requests can't have a routing directive?
			clonedRequest.setRoutingDirective(SipApplicationRoutingDirective.CONTINUE, originalRequest);
		}
		if(logger.isDebugEnabled()) {
			logger.debug("forwardRequest - setting the proxy branch");
		}
		clonedRequest.getTransactionApplicationData().setProxyBranch(this);			
		try {
			if(logger.isDebugEnabled()) {
				logger.debug("forwardRequest - sending the cloned request=" + clonedRequest);
			}
			clonedRequest.send();			
		} catch (IOException e) {
			throw new IllegalStateException(e);
		}
		proxy.putTransaction(clonedRequest);
	}
593764
public static void Forward(double[][] data) {
        int rows = data.length;
        int cols = data[0].length;

        double[] row = new double[cols];
        double[] col = new double[rows];

        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < row.length; j++)
                row[j] = data[i][j];

            Forward(row);

            for (int j = 0; j < row.length; j++)
                data[i][j] = row[j];
        }

        for (int j = 0; j < cols; j++) {
            for (int i = 0; i < col.length; i++)
                col[i] = data[i][j];

            Forward(col);

            for (int i = 0; i < col.length; i++)
                data[i][j] = col[i];
        }
    }
1056697
public void savePreviousPageInfo( ActionForward forward, ActionForm form, ActionMapping mapping,
                                      HttpServletRequest request, ServletContext servletContext,
                                      boolean isSpecialForward )
    {
        if ( forward != null )
        {
            //
            // If previous-page is disabled (unused in this pageflow), or if we've already saved prevous-page info in
            // this request (for example, forward to foo.faces which forwards to foo.jsp), just return.
            //
            if ( request.getAttribute( SAVED_PREVIOUS_PAGE_INFO_ATTR ) != null || isPreviousPageInfoDisabled() ) return;

            String path = forward.getPath();
            int queryPos = path.indexOf( '?' );
            if ( queryPos != -1 ) path = path.substring( 0, queryPos );

            //
            // If a form bean was generated in this request, add it to the most recent PreviousPageInfo, so when we
            // go back to that page, the *updated* field values are restored (i.e., we don't revert to the values of
            // the form that was passed into the page originally).
            //
            if ( form != null && _currentPageInfo != null )
            {
                ActionForm oldForm = _currentPageInfo.getForm();
                if ( oldForm == null || oldForm.getClass().equals( form.getClass() ) )
                {
                    _currentPageInfo.setForm( form );
                    _currentPageInfo.setMapping( mapping );
                }
            }

            //
            // Only keep track of *pages* forwarded to -- not actions or pageflows.
            //
            if ( ! FileUtils.osSensitiveEndsWith( path, ACTION_EXTENSION ) )
            {
                //
                // Only save previous-page info if the page is within this pageflow.
                //
                if ( isLocalFile( forward ) ) // || PageFlowUtils.osSensitiveEndsWith( path, JPF_EXTENSION ) )
                {
                    _previousPageInfo = _currentPageInfo;
                    _currentPageInfo = new PreviousPageInfo( forward, form, mapping, request.getQueryString() );
                    request.setAttribute( SAVED_PREVIOUS_PAGE_INFO_ATTR, Boolean.TRUE );
                }
            }
        }
    }
739130
@Override
    public Beliefs forward() {
        // Initialization.
        initForward();
        
        // Message passing.
        loops:
        for (int iter=-1; iter < prm.maxIterations; iter++) {
            List<Object> order = sched.getOrder(iter, fg);
            for (Object item : order) {
                List<Integer> edges = CachingBpSchedule.toEdgeList(fg, item);
                List<?> elems = CachingBpSchedule.toFactorEdgeList(item);
                TapeEntry te = prm.keepTape ? new TapeEntry(item, edges) : null;
                for (Object elem : elems) {
                    if (elem instanceof Integer) {
                        forwardCreateMessage((Integer) elem);
                    } else if (elem instanceof AutodiffGlobalFactor) {
                        forwardGlobalFacToVar((AutodiffGlobalFactor) elem, te);
                    } else {
                        throw new RuntimeException("Unsupported type in schedule: " + elem.getClass());
                    }
                }
                for (Integer edge : edges) {
                    normalizeAndAddToTape(edge, te);
                }
                for (Integer edge : edges) {
                    forwardSendMessage(edge, iter);
                }
                if (prm.keepTape) { tape.add(te); }
                if (isConverged()) {
                    // Stop on convergence: Break out of inner and outer loop.
                    log.trace("Stopping on convergence. Iterations = {}", (iter+1));
                    break loops;
                }
            }
            maybeWriteAllBeliefs(iter);
        }
        
        log.trace("Oscillation rate: {}", ((double) oscillationCount.get() / sendCount.get()));
        
        forwardVarAndFacBeliefs();
        b = new Beliefs(varBeliefs, facBeliefs);
        return b;
    }
103709
def forward(self, method, type, path, data=None):
        
        try:
            action = "/{}/{}".format(type, path)
            res = yield from self.http_query(method, action, data=data, timeout=None)
        except aiohttp.ServerDisconnectedError:
            log.error("Connection lost to %s during %s %s", self._id, method, action)
            raise aiohttp.web.HTTPGatewayTimeout()
        return res.json
499374
public static void forward(
		String contextRelativePath,
		RequestDispatcher dispatcher,
		HttpServletRequest request,
		HttpServletResponse response,
		Map<String,?> args
	) throws ServletException, IOException {
		// Track original page when first accessed
		final String oldOriginal = getOriginalPage(request);
		try {
			// Set original request path if not already set
			if(oldOriginal == null) {
				setOriginalPage(request, request.getServletPath());
			}
			// Keep old dispatch page to restore
			final String oldDispatchPage = getDispatchedPage(request);
			try {
				// Store as new relative path source
				setDispatchedPage(request, contextRelativePath);
				// Keep old arguments to restore
				final Object oldArgs = request.getAttribute(Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME);
				try {
					// Set new arguments
					request.setAttribute(
						Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME,
						args==null ? null : AoCollections.optimalUnmodifiableMap(args)
					);
					// Perform dispatch
					dispatcher.forward(request, response);
				} finally {
					// Restore any previous args
					request.setAttribute(Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME, oldArgs);
				}
			} finally {
				setDispatchedPage(request, oldDispatchPage);
			}
		} finally {
			if(oldOriginal == null) {
				setOriginalPage(request, null);
			}
		}
	}
63027
private void forward() {

        try {
            CmsDbSettingsPanel panel = m_panel[0];
            panel.saveToSetupBean();

            boolean createDb = panel.getCreateDb();
            boolean dropDb = panel.getDropDb();
            boolean createTables = panel.getCreateTables();
            setupDb(createDb, createTables, dropDb);
        } catch (DBException e) {
            CmsSetupErrorDialog.showErrorDialog(e.getMessage(), e.getDetails());
        } catch (Exception e) {
            CmsSetupErrorDialog.showErrorDialog(e);
        }

    }