List of usage examples for com.google.common.net MediaType PLAIN_TEXT_UTF_8
MediaType PLAIN_TEXT_UTF_8
To view the source code for com.google.common.net MediaType PLAIN_TEXT_UTF_8.
Click Source Link
From source file:com.facebook.buck.httpserver.Responses.java
/** Responds with a 500. */ static void writeFailedResponse(Request baseRequest, HttpServletResponse response) throws IOException { writeResponse("ERROR", MediaType.PLAIN_TEXT_UTF_8, baseRequest, response, /* status */ 500); }
From source file:org.haiku.haikudepotserver.support.web.RobotController.java
@RequestMapping(value = "/robots.txt", method = RequestMethod.GET) public void robotResponse(HttpServletResponse response) throws IOException { response.setContentType(MediaType.PLAIN_TEXT_UTF_8.toString()); PrintWriter writer = response.getWriter(); writer.print("user-agent: *\n"); writer.print("allow: "); writer.print(MultipageConstants.PATH_MULTIPAGE); writer.print("\n"); }
From source file:io.rebolt.http.converters.StringConverter.java
@Override public String getContentType() { return MediaType.PLAIN_TEXT_UTF_8.toString(); }
From source file:reflex.file.DummyFileReadAdapter.java
@Override public MediaType getMimeType() { return MediaType.PLAIN_TEXT_UTF_8; }
From source file:google.registry.tools.CreateRegistrarGroupsCommand.java
/** Calls the server endpoint to create groups for the specified registrar client id. */ static void executeOnServer(Connection connection, String clientId) throws IOException { connection.send(CreateGroupsAction.PATH, ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, clientId), MediaType.PLAIN_TEXT_UTF_8, new byte[0]); }
From source file:com.amazonaws.mobileconnectors.lex.interactionkit.utils.CreateLexServiceRequest.java
/** * Creates a request to post text input request for Amazon Lex service. * /*from w ww . jav a 2s . c om*/ * @param sessionAttributes Session attributes for this current transaction. * @param text Input text. * @return {@link PostContentRequest}. */ public static PostContentRequest generatePostContentRequest(Map<String, String> sessionAttributes, InteractionConfig interactionConfig, AWSCredentialsProvider credentialsProvider, ResponseType mode, String text) { final PostContentRequest request = generateRequestInternal(sessionAttributes, interactionConfig, credentialsProvider, mode); // Set input and content type. final byte[] textContent = text.getBytes(StringUtils.UTF8); request.setInputStream(new ByteArrayInputStream(textContent)); request.setContentType(MediaType.PLAIN_TEXT_UTF_8.toString()); return request; }
From source file:com.github.avarabyeu.restendpoint.serializer.StringSerializer.java
/** * Returns default MIME type */ @Override public String getMimeType() { return MediaType.PLAIN_TEXT_UTF_8.toString(); }
From source file:com.adobe.acs.commons.redirectmaps.impl.RedirectMapServlet.java
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { log.trace("doGet"); log.debug("Requesting redirect maps from {}", request.getResource()); RedirectMapModel redirectMap = request.getResource().adaptTo(RedirectMapModel.class); response.setContentType(MediaType.PLAIN_TEXT_UTF_8.toString()); response.getOutputStream().write(redirectMap.getRedirectMap().getBytes(StandardCharsets.UTF_8)); }
From source file:com.linecorp.armeria.common.http.HttpResponseWriter.java
/** * Writes the HTTP response of the specified {@link HttpStatus} and closes the stream if the * {@link HttpStatusClass} is not {@linkplain HttpStatusClass#INFORMATIONAL informational} (1xx). *//*from w ww . ja v a 2 s. c o m*/ default void respond(HttpStatus status) { requireNonNull(status, "status"); if (status.codeClass() == HttpStatusClass.INFORMATIONAL) { write(HttpHeaders.of(status)); } else if (isContentAlwaysEmpty(status)) { write(HttpHeaders.of(status)); close(); } else { respond(status, MediaType.PLAIN_TEXT_UTF_8, status.toHttpData()); } }
From source file:io.bazel.rules.closure.webfiles.server.WebfilesHandler.java
private void serveError() { logger.info(String.format("sending %d for %s: %s", response.getStatus(), request.getUri(), response.getMessage()));/*from w w w . ja v a 2 s .com*/ response.setContentType(MediaType.PLAIN_TEXT_UTF_8); response.setPayload(response.getMessage().getBytes(UTF_8)); }