Set terminal background color with Java
I would try with escape codes.
White background is \e[107m
, Black foreground \e[30m
, i.e. something like the following leads to black on white:
echo -e "\e[107m\e[30mTest String"
In Java you would a System.out.println("\033[107m\033[30m")
during startup of the application.
See List of ANSI color escape sequences and http://misc.flogisoft.com/bash/tip_colors_and_formatting for more details
Change color of java console output
You can take a look at the Java Curses Library:
http://sourceforge.net/projects/javacurses/
Here's an entry on how to use it:
http://www.javaworld.com/javaworld/javaqa/2002-12/02-qa-1220-console.html
How to color System.out.println output?
No, but there are third party API's that can handle it
http://www.javaworld.com/javaworld/javaqa/2002-12/02-qa-1220-console.html
Edit: of course there are newer articles than that one I posted, the information is still viable though.
Above link is dead, see this question instead: How to print color in console using System.out.println?
How to extract IP Address in Spring MVC Controller get call?
The solution is
@RequestMapping(value = "processing", method = RequestMethod.GET)
public @ResponseBody ProcessResponse processData(@RequestParam("workflow") final String workflow,
@RequestParam("conf") final String value, @RequestParam("dc") final String dc, HttpServletRequest request) {
System.out.println(workflow);
System.out.println(value);
System.out.println(dc);
System.out.println(request.getRemoteAddr());
// some other code
}
Add HttpServletRequest request
to your method definition and then use the Servlet API
Spring Documentation here said in
15.3.2.3 Supported handler method arguments and return types
Handler methods that are annotated with @RequestMapping can have very flexible signatures.
Most of them can be used in arbitrary order (see below for more details).
Request or response objects (Servlet API). Choose any specific request or response type,
for example ServletRequest or HttpServletRequest
Related Topics
Hibernate Foreign Key Issue:Error Executing Ddl "Alter Table..."
Getting Url Parameter in Java and Extract a Specific Text from That Url
Checking If a String Is Contained in an Enum Set in O(1)
How to Convert Xml to Java.Util.Map and Vice Versa
How to Mock System.Getproperty Using Mockito
How to Find Out My MySQL Url, Host, Port and Username
How to Find the Number of Times If or Else Code Has Executed
Spring Security 401 Unauthorized Even With Permitall
Java Xmlbeans Throws Nosuchmethod Error
Why Is Git Bash Not Using the Correct Java Path as Defined in the Path Environment Variable
I Want to Execute Code Every X Seconds, But Handler.Postdelayed Not Working
How to Pass Authentication Credentials in Vba
Run Gradle Task With Spring Profiles (Integration Tests)
How to Input Date Using Sendkeys in Selenium Webdriver
Parse a Uri String into Name-Value Collection
Maven 3.8.0 Compiler - Fatal Error Compiling: Release Version 11 Not Supported