Example usage for java.io PrintStream println

List of usage examples for java.io PrintStream println

Introduction

In this page you can find the example usage for java.io PrintStream println.

Prototype

public void println(Object x) 

Source Link

Document

Prints an Object and then terminate the line.

Usage

From source file:com.mockey.ui.HistoryAjaxServlet.java

/**
 * //from w  w w. j a  va  2 s.c om
 */
public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    Long fulfilledRequestId = null;
    JSONObject jsonObject = new JSONObject();
    try {

        fulfilledRequestId = new Long(req.getParameter("conversationRecordId"));
        FulfilledClientRequest fCRequest = store.getFulfilledClientRequestsById(fulfilledRequestId);

        jsonObject.put("conversationRecordId", "" + fulfilledRequestId);
        jsonObject.put("serviceId", "" + fCRequest.getServiceId());
        jsonObject.put("serviceName", fCRequest.getServiceName());
        jsonObject.put("requestUrl", "" + fCRequest.getRawRequest());
        jsonObject.put("requestHeaders", "" + fCRequest.getClientRequestHeaders());
        jsonObject.put("requestParameters", "" + fCRequest.getClientRequestParameters());
        jsonObject.put("requestBody", "" + fCRequest.getClientRequestBody());
        jsonObject.put("requestCookies", "" + fCRequest.getClientRequestCookies());
        jsonObject.put("responseCookies", "" + fCRequest.getClientResponseCookies());

        jsonObject.put("responseStatus", "" + fCRequest.getResponseMessage().getStatusLine());
        jsonObject.put("responseHeader", "" + fCRequest.getResponseMessage().getHeaderInfo());
        jsonObject.put("responseBody", "" + fCRequest.getResponseMessage().getBody());

    } catch (Exception e) {
        try {
            jsonObject.put("error", "" + "Sorry, history for this conversation (fulfilledRequestId="
                    + fulfilledRequestId + ") is not available.");
        } catch (JSONException e1) {
            logger.error("Unable to create JSON", e1);
        }
    }

    resp.setContentType("application/json");

    PrintStream out = new PrintStream(resp.getOutputStream());

    out.println(jsonObject.toString());
}

From source file:fi.jumi.core.stdout.SynchronizedPrintStreamTest.java

@Test
public void synchronizes_all_methods_on_the_lock_given_as_parameter() {
    SpyOutputStream spy = new SpyOutputStream();
    PrintStream printStream = SynchronizedPrintStream.create(spy, Charset.defaultCharset(), lock);

    printStream.println("foo");

    assertThat("was called", spy.wasCalled, is(true));
    assertThat("used the lock", spy.lockWasHeldByCurrentThread, is(true));
}

From source file:hudson.cli.CLICommand.java

protected void printUsage(PrintStream stderr, CmdLineParser p) {
    stderr.println("java -jar hudson-cli.jar " + getName() + " args...");
    p.printUsage(stderr);//  w  w  w . j  a v a 2  s.c  o m
}

From source file:com.kelveden.rastajax.servlet.DefaultHtmlServlet.java

private void writeResource(FlatResource resource, PrintStream printStream) {

    printStream.println("<p style=\"font-weight: bold\">" + resource.getUriTemplate() + "</p>");

    printStream.println("<table>");
    printStream.println("<thead>");
    printStream.println("<tr>");
    printStream.println("<th>Request Method Designator</th>");
    printStream.println("<th>Parameters</th>");
    printStream.println("<th>Consumes</th>");
    printStream.println("<th>Produces</th>");
    printStream.println("</tr>");
    printStream.println("</thead>");

    printStream.println("<tbody>");

    for (FlatResourceMethod resourceMethod : resource.getResourceMethods()) {
        writeResourceMethod(resourceMethod, printStream);
    }//from  w  w  w  . j ava 2s  .c  om

    printStream.println("</tbody>");
    printStream.println("</table>");
}

From source file:com.hp.application.automation.tools.run.SvDeployBuilder.java

@Override
protected void logConfig(PrintStream logger, String prefix) {
    super.logConfig(logger, prefix);
    logger.println(prefix + "First agent fallback: " + model.isFirstAgentFallback());
}

From source file:com.cyc.session.internal.ConfigurationValidator.java

public void print(PrintStream out) {
    if (getConfiguration() == null) {
        out.println("Configuration class: null");
        return;// www .j  a va2  s .co  m
    }
    out.println("Configuration class: " + getConfiguration().getClass().getName());
    out.println("         Loaded via: " + getConfiguration().getLoaderClass().getName());
    out.println(SERVER_KEY + ":     [" + getConfiguration().getCycServer() + "]");
    out.println(CONFIGURATION_LOADER_KEY + ": [" + getConfiguration().getConfigurationLoaderName() + "]");
    out.println(CONFIGURATION_FILE_KEY + ": [" + getConfiguration().getConfigurationFileName() + "]");
}

From source file:backtype.storm.GenericOptionsParser.java

public static void printGenericCommandUsage(PrintStream out) {
    String[] strs = new String[] { "Generic options supported are",
            "  -conf <conf.xml>                            load configurations from",
            "                                              <conf.xml>",
            "  -conf <conf.yaml>                           load configurations from",
            "                                              <conf.yaml>",
            "  -D <key>=<value>                            set <key> in configuration",
            "                                              to <value> (preserve value's type)",
            "  -libjars <comma separated list of jars>     specify comma separated",
            "                                              jars to be used by",
            "                                              the submitted topology", };
    for (String s : strs)
        out.println(s);
}

From source file:com.gs.obevo.db.impl.platforms.mssql.MsSqlReveng.java

@Override
protected File printInstructions(PrintStream out, AquaRevengArgs args) {
    out.println(
            "1) Download the powershell script from: https://github.com/goldmansachs/obevo/tree/master/obevo-db-impls/obevo-db-mssql/src/main/resources/SqlServerDdlReveng.ps1");
    out.println("");
    out.println("2) Open a powershell prompt (assuming you have one installed):");
    out.println("");
    out.println("3) Source the script, e.g.:");
    out.println("");
    out.println("    . .\\SqlServerDdlReveng.ps1");
    out.println("");
    out.println("4) Run the following command to generate the DDL file:");
    out.println(//from w  ww .  j  a va  2 s . co m
            getCommandWithDefaults(args, "<username>", "<password>", "<dbHost>", "<database>", "<outputFile>"));
    out.println("");
    out.println("Here is an example command (in case your input arguments are not filled in):");
    out.println(getCommandWithDefaults(args, "myuser", "mypassword", "myhost.me.com", "mydatabase",
            "H:\\db2-ddl-output.txt"));
    out.println("");
    out.println("*******");
    out.println("NOTE - This script is still in beta and subject to signature changes.");
    out.println("Please give it a try and provide us feedback, or contribute changes as needed.");

    return null;
}

From source file:at.ac.tuwien.big.moea.print.PopulationWriter.java

@Override
public void write(final PrintStream ps, final Population population) {
    if (population == null) {
        ps.println("No population.");
        return;// ww w.  ja  v  a  2  s .  co  m
    }

    final Integer size = population.size();

    ps.println("Population with " + size + " solution(s):");
    int solutionNr = 1;
    for (final Solution solution : population) {
        ps.println("\n------------------");
        ps.println("Solution " + solutionNr++ + "/" + size);
        ps.println("------------------");
        getSolutionPrinter().write(ps, CastUtil.asClass(solution, solutionClazz));
    }
}

From source file:com.sqs.tq.fdc.config.CmdLineConfig.java

public void showHelp(PrintStream out) {
    out.println(error);
    out.println();

    showUsage(out);
}