List of usage examples for java.io PrintWriter println
public void println(Object x)
From source file:net.metanotion.sqlc.SQLC.java
public static int makeMethod(final PrintWriter writer, final SQLMethod m, final DoWrap qe, final int level, final int[] gensym, final int[] braces, final boolean retValue) { for (final QueryExpr<PreparedStatement> e : qe.exprs) { makeMethod(writer, m, e, level + 1, gensym, braces, retValue); }//from w w w . jav a 2 s . c om if (level == 0) { writer.println("\t\t\treturn _" + (gensym[0] - 1) + ";"); while (braces[0] > 0) { writer.println("}"); braces[0]--; } } return gensym[0] - 1; }
From source file:MyServlet.java
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<HTML>"); out.println("<HEAD>"); out.println("<TITLE>"); out.println("A Web Page"); out.println("</TITLE>"); out.println("</HEAD>"); out.println("Hello there!"); out.println("</BODY>"); out.println("</HTML>"); }
From source file:AuthenticationSnoop.java
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); out.println("<HTML><BODY>"); out.println("<H1>This is a password protected resource</H1>"); out.println("<PRE>"); out.println("User Name: " + req.getRemoteUser()); String name = (req.getUserPrincipal() == null) ? null : req.getUserPrincipal().getName(); out.println("Principal Name: " + name); out.println("Authentication Type: " + req.getAuthType()); out.println("Is a Manager: " + req.isUserInRole("manager")); out.println("</PRE>"); out.println("</BODY></HTML>"); }
From source file:MyServlet.java
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/plain"); PrintWriter out = res.getWriter(); out.println("Request Headers:"); out.println();//from ww w . j av a2 s .co m Enumeration names = req.getHeaderNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); Enumeration values = req.getHeaders(name); // support multiple values if (values != null) { while (values.hasMoreElements()) { String value = (String) values.nextElement(); out.println(name + ": " + value); } } } }
From source file:GetCookiesServlet.java
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Cookie[] cookies = request.getCookies(); response.setContentType("text/html"); PrintWriter pw = response.getWriter(); pw.println("<B>"); for (int i = 0; i < cookies.length; i++) { String name = cookies[i].getName(); String value = cookies[i].getValue(); pw.println("name = " + name + "; value = " + value); }// w ww . j av a2 s. co m pw.close(); }
From source file:marytts.util.io.FileUtils.java
public static void writeTextFile(String[] textInRows, String textFile) { PrintWriter out = null; try {/*from w ww . j av a 2s . c o m*/ out = new PrintWriter(new FileWriter(textFile)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (out != null) { for (int i = 0; i < textInRows.length; i++) out.println(textInRows[i]); out.close(); } else System.out.println("Error! Cannot create file: " + textFile); }
From source file:marytts.util.io.FileUtils.java
public static void writeTextFile(Vector<String> textInRows, String textFile) { PrintWriter out = null; try {// w ww . j a va2 s . c o m out = new PrintWriter(new FileWriter(textFile)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (out != null) { for (int i = 0; i < textInRows.size(); i++) out.println(textInRows.get(i)); out.close(); } else System.out.println("Error! Cannot create file: " + textFile); }
From source file:HeaderSnoop.java
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/plain"); PrintWriter out = res.getWriter(); out.println("Request Headers:"); Enumeration names = req.getHeaderNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); Enumeration values = req.getHeaders(name); // support multiple values if (values != null) { while (values.hasMoreElements()) { String value = (String) values.nextElement(); out.println(name + ": " + value); }/*from w w w. j av a 2 s .c om*/ } } }
From source file:Copyright.java
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { java.io.PrintWriter out = response.getWriter(); out.println("Copyright© 2003-2004 Java Source and Support."); out.close();//from ww w.ja v a 2 s . c om }
From source file:MyServlet.java
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/plain"); PrintWriter out = res.getWriter(); out.println("Query String:"); out.println(req.getQueryString());/* w w w . j a v a 2 s .c om*/ out.println(); out.println("Request Parameters:"); Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String values[] = req.getParameterValues(name); if (values != null) { for (int i = 0; i < values.length; i++) { out.println(name + " (" + i + "): " + values[i]); } } } }