Code example for StringWriter

Methods: flush, toString

0
		 
		return type;
	} 
	 
	private String getStackTraceString(Throwable t) {
		StringWriter res = new StringWriter();
		t.printStackTrace(new PrintWriter(res));
		res.flush();
		return res.toString();
	} 
 
	public void init(FilterConfig cfg) throws ServletException {
		String serverAddress = cfg.getInitParameter("serverAddress");
		String apiKey = cfg.getInitParameter("apiKey");
		 
		if (!serverAddress.startsWith("http")) {
			serverAddress = "http://" + serverAddress;
		} 
		if (!serverAddress.endsWith("/")) {
			serverAddress += "/";
		}