List of usage examples for org.springframework.http MediaType TEXT_PLAIN_VALUE
String TEXT_PLAIN_VALUE
To view the source code for org.springframework.http MediaType TEXT_PLAIN_VALUE.
Click Source Link
From source file:io.dyn.net.tcp.stomp.StompMessages.java
public static StompMessage error(String errorMsg, Object... headers) { StompMessage msg = new StompMessage(StompCommand.ERROR); addHeaders(msg, "server", StompServer.SERVER_NAME); addHeaders(msg, headers);// w w w . j a v a 2 s . c om msg.header("content-type", MediaType.TEXT_PLAIN_VALUE); msg.header("content-length", "" + errorMsg.length()); msg.content(Buffer.wrap(errorMsg)); return msg; }
From source file:uk.co.elitestarbase.website.rest.TestController.java
@GET @Path("me") @Produces(MediaType.TEXT_PLAIN_VALUE) public String getTest() { return "test"; }
From source file:com.test.spring.HelloController.java
@RequestMapping(method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public String get(@RequestParam("test") String test) { return test; }
From source file:nl.dtls.fairdatapoint.api.controller.utils.HttpHeadersUtils.java
/** * Set response header for the internal server errors * // w w w . j a v a 2 s . com * @param response Http response * @param ex Server exception * @return returns null (as a response body) */ public static String set500ResponseHeaders(HttpServletResponse response, Exception ex) { String errorMessage = ("Internal server error; Error message : " + ex.getMessage()); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); try { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, errorMessage); } catch (IOException ex1) { LOGGER.warn( "Error setting error message for internal server " + "error; The error : " + ex1.getMessage()); } response.setContentType(MediaType.TEXT_PLAIN_VALUE); return null; }
From source file:org.bonitasoft.web.designer.controller.utils.HttpFile.java
public static void writeFileInResponseForVisualization(HttpServletRequest request, HttpServletResponse response, Path filePath) throws IOException { if (!isExistingFilePath(response, filePath)) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return;/* w w w .java 2s.c o m*/ } String mimeType = request.getServletContext().getMimeType(filePath.getFileName().toString()); if (mimeType == null || !mimeType.contains("image")) { mimeType = MediaType.TEXT_PLAIN_VALUE; } writeFileInResponse(response, filePath, mimeType, "inline"); }
From source file:uta.ak.usttmp.common.web.controller.UsttmpRestController.java
@RequestMapping(value = "/interfaceResponser", method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) public abstract ResponseEntity<String> getMessage(@RequestBody String message) throws Exception;
From source file:uta.ak.usttmp.console.controller.RestCheckController.java
@RequestMapping(value = "/checkStatus", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) @ResponseBody/*from www. j a v a 2 s . c o m*/ public String checkStatus() { return "Yes,I am alive."; }
From source file:su90.mybatisdemo.web.endpoints.HelloEndpoints.java
@ApiOperation(value = "GETGREETING", nickname = "getGreeting") @RequestMapping(value = "/{name}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) // @ApiImplicitParams({ // @ApiImplicitParam(name = "name", value = "User's name", required = false, dataType = "string", paramType = "query", defaultValue="winslow") // })/*from w w w . ja va 2 s . c om*/ @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = String.class), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 404, message = "Not Found"), @ApiResponse(code = 500, message = "Failure") }) public String sayHellow(@PathVariable String name) { return "Hello" + name + "~"; }
From source file:io.jmnarloch.spring.cloud.feign.app.client.AuthenticationClient.java
@RequestMapping(value = "/oauth2", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
ResponseEntity<String> authenticate();
From source file:uta.ak.usttmp.console.controller.RestCheckController.java
@RequestMapping(value = "/foo/{id}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public ResponseEntity<String> getFoo(@PathVariable("id") long id) { System.out.println("Fetching User with id " + id); // Foo foo=new Foo(); // foo.setId(id); // foo.setName("DFGHH"); // foo.setEmail("qwertyui@163.com"); return new ResponseEntity<String>("I am a foo " + id, HttpStatus.OK); }