List of usage examples for java.io Writer write
public void write(String str) throws IOException
From source file:org.cloudifysource.rest.controllers.AdminAPIController.java
@ExceptionHandler(Exception.class) @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) public void resolveInternalServerError(Writer writer, Exception e) throws IOException { logger.log(Level.WARNING, "caught exception", e); writer.write("{\"status\":\"error\", \"error\":\"" + e.getMessage() + "\"}"); }
From source file:com.intel.cosbench.controller.repository.RAMWorkloadRepository.java
private void appendToStarts(WorkloadContext workload) throws IOException { String id = workload.getId(); Writer writer = new BufferedWriter(new FileWriter(starts, true)); try {/*ww w . ja v a2 s. c o m*/ writer.write(id); writer.write('\n'); writer.flush(); } finally { writer.close(); } String path = starts.getAbsolutePath(); LOGGER.debug("workload {} has been appened to {}", id, path); }
From source file:de.mpg.escidoc.services.fledgeddata.webservice.oaiServlet.java
/** * Peform the http GET action. Note that POST is shunted to here as well. * The verb widget is taken from the request and used to invoke an * OAIVerb object of the corresponding kind to do the actual work of the verb. * * @param request the servlet's request information * @param response the servlet's response information * @exception IOException an I/O error occurred *//* ww w. ja v a 2 s . c o m*/ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { boolean serviceUnavailable = isServiceUnavailable(); HashMap serverVerbs = ServerVerb.getVerbs(); request.setCharacterEncoding("UTF-8"); if (serviceUnavailable) { LOGGER.info("[FDS] oai servcice set to 'unavailable' in properties file."); response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "[FDS] Sorry. This server is down for maintenance"); } else { try { String result = getResult(request, response, serverVerbs); Writer out = getWriter(request, response); out.write(result); out.close(); } catch (OAIInternalServerError e) { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } catch (SocketException e) { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } catch (Throwable e) { e.printStackTrace(); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } } }
From source file:info.magnolia.cms.gui.dialog.DialogMultiSelect.java
/** * Render the Html using a template/*from ww w . ja v a 2 s .c om*/ */ public void drawHtml(Writer out) throws IOException { this.drawHtmlPre(out); out.write(FreeMarkerUtil.process(DialogMultiSelect.class, this)); this.drawHtmlPost(out); }