Performs a forward with the provided servlet path and associated dispatcher.

@param  args  The arguments for the page, make unmodifiable and accessible as request-scope var "arg"
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);
			}
		}
	}
634560
public static void main(String... args) {
        try {
            Backtrack b = new Backtrack(args);
            b.end();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (SAXException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (URISyntaxException e) {
            e.printStackTrace();
        } catch (JAXBException e) {
            e.printStackTrace();
        }
    }
302667
function(arg) {

            var segments = this.segments;
            var numSegments = segments.length;
            // works even if path has no segments

            var currentSegment;

            var previousSegment = ((numSegments !== 0) ? segments[numSegments - 1] : null); // if we are appending to an empty path, previousSegment is null
            var nextSegment = null;

            if (!Array.isArray(arg)) { // arg is a segment
                if (!arg || !arg.isSegment) throw new Error('Segment required.');

                currentSegment = this.prepareSegment(arg, previousSegment, nextSegment);
                segments.push(currentSegment);

            } else { // arg is an array of segments
                if (!arg[0].isSegment) throw new Error('Segments required.');

                var n = arg.length;
                for (var i = 0; i < n; i++) {

                    var currentArg = arg[i];
                    currentSegment = this.prepareSegment(currentArg, previousSegment, nextSegment);
                    segments.push(currentSegment);
                    previousSegment = currentSegment;
                }
            }
        }
861635
public void run(String[] args) {
		System.out.println("SampleStarter.run(String[])");
		System.out.println("- args.length: " + args.length);
		for (String arg : args) System.out.println("  - " + arg);
		System.out.println(this);
	}
449437
public static void main(String[] args) {
        final File in;
        final File out;
        if (args.length == 0) {
            System.err.println("Incorrect arguments - please provide one or more files as input");
            System.err.println("Download the research concepts, developer concepts, and architectural concepts view of the CWE from "
                    + "https://cwe.mitre.org/data/downloads.html");
            return;
        }
        in = new File(args[0]);
        if (!in.isFile()) {
            System.err.println(String.format("%s does not exist", in.getAbsolutePath()));
            return;
        }
        out = new File("cwe.hashmap.serialized");
        final Map<String, String> cwe = readCweData(args);
        serializeCweData(cwe, out);
    }
118426
private void run(String[] args) {
        if (args.length != 2) {
            usage();
        }
        
        System.out.println("Opening Doradus server: " + args[0] + ":" + args[1]);
        try (DoradusClient client = new DoradusClient(args[0], Integer.parseInt(args[1]))) {
            deleteApplication(client);
            createApplication(client);
            addData(client);
            queryData(client);
            deleteData(client);
        }
    }
145844
public static void main(String[] args)
	{
	   
		try
		{
			RMI.startRmiRegistry(Integer.parseInt(args[0]));
			System.in.read();
		}
		catch (Exception e)
		{
		
			e.printStackTrace();
		}
	}
319643
public static void main(String[] pArgs) throws IOException {
        // params:
        int timeout = 0;
        boolean followRedirects = true;
        boolean debugHeaders = false;
        String requestPropertiesFile = null;
        String requestHeaders = null;
        String postData = null;
        File putData = null;
        int argIdx = 0;
        boolean errArgs = false;
        boolean writeToFile = false;
        boolean writeToStdOut = false;
        String outFileName = null;

        while ((argIdx < pArgs.length) && (pArgs[argIdx].charAt(0) == '-') && (pArgs[argIdx].length() >= 2)) {
            if ((pArgs[argIdx].charAt(1) == 't') || pArgs[argIdx].equals("--timeout")) {
                argIdx++;
                try {
                    timeout = Integer.parseInt(pArgs[argIdx++]);
                }
                catch (NumberFormatException nfe) {
                    errArgs = true;
                    break;
                }
            }
            else if ((pArgs[argIdx].charAt(1) == 'd') || pArgs[argIdx].equals("--debugheaders")) {
                debugHeaders = true;
                argIdx++;
            }
            else if ((pArgs[argIdx].charAt(1) == 'n') || pArgs[argIdx].equals("--nofollowredirects")) {
                followRedirects = false;
                argIdx++;
            }
            else if ((pArgs[argIdx].charAt(1) == 'r') || pArgs[argIdx].equals("--requestproperties")) {
                argIdx++;
                requestPropertiesFile = pArgs[argIdx++];
            }
            else if ((pArgs[argIdx].charAt(1) == 'p') || pArgs[argIdx].equals("--postdata")) {
                argIdx++;
                postData = pArgs[argIdx++];
            }
            else if ((pArgs[argIdx].charAt(1) == 'u') || pArgs[argIdx].equals("--putdata")) {
                argIdx++;
                putData = new File(pArgs[argIdx++]);
                if (!putData.exists()) {
                    errArgs = true;
                    break;
                }
            }
            else if ((pArgs[argIdx].charAt(1) == 'h') || pArgs[argIdx].equals("--header")) {
                argIdx++;
                requestHeaders = pArgs[argIdx++];
            }
            else if ((pArgs[argIdx].charAt(1) == 'f') || pArgs[argIdx].equals("--file")) {
                argIdx++;
                writeToFile = true;

                // Get optional file name
                if (!((argIdx >= (pArgs.length - 1)) || (pArgs[argIdx].charAt(0) == '-'))) {
                    outFileName = pArgs[argIdx++];
                }
            }
            else if ((pArgs[argIdx].charAt(1) == 'o') || pArgs[argIdx].equals("--output")) {
                argIdx++;
                writeToStdOut = true;
            }
            else {
                System.err.println("Unknown option \"" + pArgs[argIdx++] + "\"");
            }
        }
        if (errArgs || (pArgs.length < (argIdx + 1))) {
            System.err.println("Usage: java  NetUtil [-f|--file [<file name>]] [-d|--debugheaders] [-h|--header <header data>] [-p|--postdata <URL-encoded postdata>] [-u|--putdata <file name>] [-r|--requestProperties <properties file>] [-t|--timeout <miliseconds>] [-n|--nofollowredirects] fromUrl");
            System.exit(5);
        }
        String url = pArgs[argIdx/*++*/];

        // DONE ARGS
        // Get request properties
        Properties requestProperties = new Properties();

        if (requestPropertiesFile != null) {

            // Just read, no exception handling...
            requestProperties.load(new FileInputStream(new File(requestPropertiesFile)));
        }
        if (requestHeaders != null) {

            // Get request headers
            String[] headerPairs = StringUtil.toStringArray(requestHeaders, ",");

            for (String headerPair : headerPairs) {
                String[] pair = StringUtil.toStringArray(headerPair, ":");
                String key = (pair.length > 0)
                        ? pair[0].trim()
                        : null;
                String value = (pair.length > 1)
                        ? pair[1].trim()
                        : "";

                if (key != null) {
                    requestProperties.setProperty(key, value);
                }
            }
        }
        HttpURLConnection conn;

        // Create connection
        URL reqURL = getURLAndSetAuthorization(url, requestProperties);

        conn = createHttpURLConnection(reqURL, requestProperties, followRedirects, timeout);

        // POST
        if (postData != null) {
            // HTTP POST method
            conn.setRequestMethod(HTTP_POST);

            // Set entity headers
            conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            conn.setRequestProperty("Content-Length", String.valueOf(postData.length()));
            conn.setRequestProperty("Content-Encoding", "ISO-8859-1");

            // Get outputstream (this is where the connect actually happens)
            OutputStream os = conn.getOutputStream();

            System.err.println("OutputStream: " + os.getClass().getName() + "@" + System.identityHashCode(os));
            OutputStreamWriter writer = new OutputStreamWriter(os, "ISO-8859-1");

            // Write post data to the stream
            writer.write(postData);
            writer.write("\r\n");

            //writer.flush();
            writer.close();  // Does this close the underlying stream?
        }
        // PUT
        else if (putData != null) {
            // HTTP PUT method
            conn.setRequestMethod(HTTP_PUT);

            // Set entity headers
            //conn.setRequestProperty("Content-Type", "???");
            // TODO: Set Content-Type to correct type?
            // TODO: Set content-encoding? Or can binary data be sent directly?
            conn.setRequestProperty("Content-Length", String.valueOf(putData.length()));

            // Get outputstream (this is where the connect actually happens)
            OutputStream os = conn.getOutputStream();

            System.err.println("OutputStream: " + os.getClass().getName() + "@" + System.identityHashCode(os));

            // Write put data to the stream
            FileUtil.copy(new FileInputStream(putData), os);

            os.close();
        }

        //
        InputStream is;

        if (conn.getResponseCode() == 200) {

            // Connect and get stream
            is = conn.getInputStream();
        }
        else {
            is = conn.getErrorStream();
        }

        //
        if (debugHeaders) {
            System.err.println("Request (debug):");
            System.err.println(conn.getClass());
            System.err.println("Response (debug):");

            // Headerfield 0 is response code
            System.err.println(conn.getHeaderField(0));

            // Loop from 1, as headerFieldKey(0) == null...
            for (int i = 1; ; i++) {
                String key = conn.getHeaderFieldKey(i);

                // Seems to be the way to loop through them all...
                if (key == null) {
                    break;
                }
                System.err.println(key + ": " + conn.getHeaderField(key));
            }
        }

        // Create output file if specified
        OutputStream os;

        if (writeToFile) {
            if (outFileName == null) {
                outFileName = reqURL.getFile();
                if (StringUtil.isEmpty(outFileName)) {
                    outFileName = conn.getHeaderField("Location");
                    if (StringUtil.isEmpty(outFileName)) {
                        outFileName = "index";

                        // Find a suitable extension
                        // TODO: Replace with MIME-type util with MIME/file ext mapping
                        String ext = conn.getContentType();

                        if (!StringUtil.isEmpty(ext)) {
                            int idx = ext.lastIndexOf('/');

                            if (idx >= 0) {
                                ext = ext.substring(idx + 1);
                            }
                            idx = ext.indexOf(';');
                            if (idx >= 0) {
                                ext = ext.substring(0, idx);
                            }
                            outFileName += "." + ext;
                        }
                    }
                }
                int idx = outFileName.lastIndexOf('/');

                if (idx >= 0) {
                    outFileName = outFileName.substring(idx + 1);
                }
                idx = outFileName.indexOf('?');
                if (idx >= 0) {
                    outFileName = outFileName.substring(0, idx);
                }
            }
            File outFile = new File(outFileName);

            if (!outFile.createNewFile()) {
                if (outFile.exists()) {
                    System.err.println("Cannot write to file " + outFile.getAbsolutePath() + ", file allready exists.");
                }
                else {
                    System.err.println("Cannot write to file " + outFile.getAbsolutePath() + ", check write permissions.");
                }
                System.exit(5);
            }
            os = new FileOutputStream(outFile);
        }
        else if (writeToStdOut) {
            os = System.out;
        }
        else {
            os = null;
        }

        // Get data.
        if ((writeToFile || writeToStdOut) && is != null) {
            FileUtil.copy(is, os);
        }

        /*
                    Hashtable postData = new Hashtable();
                    postData.put("SearchText", "condition");

                    try {
                        InputStream in = getInputStreamHttpPost(pArgs[argIdx], postData,
                                                             props, true, 0);
                        out = new FileOutputStream(file);
                        FileUtil.copy(in, out);
                    }
                    catch (Exception e) {
                        System.err.println("Error: " + e);
                        e.printStackTrace(System.err);
                        continue;
                    }
         */
    }
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);
	}
992233
public static void main(String[] args) {
    ProcessEntryPoint entryPoint = ProcessEntryPoint.createForArguments(args);
    Props props = entryPoint.getProps();
    new WebServerProcessLogging().configure(props);
    WebServer server = new WebServer(props);
    entryPoint.launch(server);
  }
933919
public static void main(final String[] args)
			throws Exception {
		// Use jetty to run the servlet.
		Server server = new Server();

		SocketConnector connector = new SocketConnector();
		connector.setMaxIdleTime(0);
		connector.setPort(8080);
		server.addConnector(connector);

		WebAppContext context = new WebAppContext();
		context.setContextPath("/");
		context.addServlet(HelloWServlet.class.getName(), "/*");
		context.addServlet(ThemeServlet.class.getName(), "/theme/*");
		context.setResourceBase(".");

		server.setHandler(context);
		server.start();
	}
979198
public static void main(final String[] args) {
    GUIUtil.logUncaughtExceptions(LOG);
    GUIUtil.setLookAndFeel();
    OutputStep.setDefaultHandlerVisualizer();

    javax.swing.SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        try {
          final MultiStepGUI gui = new MultiStepGUI();
          gui.run();
          if(args != null && args.length > 0) {
            gui.setParameters(new SerializedParameterization(args));
          }
          else {
            gui.setParameters(new SerializedParameterization());
          }
        }
        catch(Exception | Error e) {
          // Restore error handler, as the GUI is likely broken.
          LoggingConfiguration.replaceDefaultHandler(new CLISmartHandler());
          LOG.exception(e);
        }
      }
    });
  }
365554
public boolean dispatch(String dispatch, String[] parameters)// throws IOException
	{
		String dispatchURL = dispatch;
		HttpServletRequest servletRequest = httpRequest.get();
		HttpServletResponse servletResponse = httpResponse.get();
		//set content type, because otherwise the response
		//  may be interpreted as text/plain
		servletResponse.setContentType("text/html; charset=UTF-8");
		try
		{
			//pass set attributes as new servlet parameters (a hack to get rid of)
			Request request = requestRegistry.getCurrentRequest();
			if(request != null) {
				for (Object name : request.getAttributeMap().keySet())
				{
					Object o = request.getAttributeMap().get(name);
					servletRequest.setAttribute(name.toString(), o);
				}
			}
			//servlet-include, servlet-forward, service-invocation
            switch(this.dispatchMode)
			{
				case FORWARD:
				{
					ServletSupport.forward(dispatchURL, servletRequest, servletResponse);
				}
				default://INCLUDE
				{
					ServletSupport.include(dispatchURL, servletRequest, servletResponse);
				}
			}
		}
		catch (ServletException e)
		{
			throw new ResourceException("failed to dispatch servlet request to " + dispatchURL, e);
		}
		catch (IOException e)
		{
			throw new ResourceException("failed to dispatch servlet request to " + dispatchURL, e);
		}
		return true;
	}
646031
public function redirect($page = null, $args = array())
    {
        /*
         * Redirect to specified page. $args are $_GET arguments.
         * Use this function instead of issuing header("Location") stuff
         */
        $url = $this->url($page, $args);
        if ($this->app->isAjaxOutput()) {
            if ($_GET['cut_page']) {
                echo '<script>'.$this->app->js()->redirect($url).'</script>Redirecting page...';
                exit;
            } else {
                $this->app->js()->redirect($url)->execute();
            }
        }
        header('Location: '.$url);
        exit;
    }
744749
public void run(String[] args) {
        String context = args.length > 0 ? args[0] : "";
        String action = args.length > 1 ? args[1] : "";
        String option = args.length > 2 ? args[2] : "";

        switch (context) {
            case "server":
                server(action, option);
                break;
            case "version":
                version();
                break;
            default:
                help();
        }
    }
640262
def forward(*args, **kwargs):
        
        self, cmd = args[:2]

        # It's also possible to invoke another command which might or
        # might not have a callback.
        if not isinstance(cmd, Command):
            raise TypeError('Callback is not a command.')

        for param in self.params:
            if param not in kwargs:
                kwargs[param] = self.params[param]

        return self.invoke(cmd, **kwargs)
586163
public static void main(String[] args) {
		if (args == null || args.length == 0) {
			server = com.jfinal.server.jetty.ServerFactory.getServer();
			server.start();
			return ;
		}
		
		// for Eclipse
		if (args.length == 4) {
			String webAppDir = args[0];
			int port = Integer.parseInt(args[1]);
			String context = args[2];
			int scanIntervalSeconds = Integer.parseInt(args[3]);
			server = com.jfinal.server.jetty.ServerFactory.getServer(webAppDir, port, context, scanIntervalSeconds);
			server.start();
			return ;
		}
		
		// for IDEA
		if (args.length == 3) {
			start(args[0], Integer.parseInt(args[1]), args[2]);
			return ;
		}
		
		throw new RuntimeException("Boot parameter error. The right parameter like this: src/main/webapp 80 / 5");
	}