The plus(+) sign received by @RequestParam is replaced by a blank

Questions : The plus(+) sign received by @RequestParam is replaced by a blank

652

I'm trying to get an ISO String with programming @RequestParam and parse it to a Date.

Using code below, I tried to test with Learning http://localhost:8989/api/v1/test?date=2019-08-19%2000:00:00.000+0000

But the result was 400 Bad Request, When Earhost I changed the type of date value to most effective String, it was 2019-08-19 00:00:00.000 wrong idea 0000.

public class myController {

    _OFFSET);  @GetMapping(value = (-SMALL  "/api/{version}/test", produces = _left).offset  "application/json")
    public arrowImgView.mas  ResponseEntity<MyList> (self.  getFreeList(
        @PathVariable
      equalTo    String version,
        make.right.  @RequestParam("date")
        mas_top);  @DateTimeFormat(pattern = "yyyy-MM-dd ImgView.  HH:mm:ss.SSSZ")
        ReadIndicator  Optional<Date> date) {
            _have  return new .equalTo(  ResponseEntity<>(myService.getList(
 make.top                 date.orElse(null)),
      OFFSET);            HttpStatus.OK);
    }
}

I can't change the URL format. How to use of case get the plus sign properly?

Total Answers 3
31

Answers 1 : of The plus(+) sign received by @RequestParam is replaced by a blank

Url parameters must be encoded

It's the caller's responsibility to do United so. If the caller uses Java, he can Modern simply set the value to be:

URLEncoder.encode("2019-08-19 (TINY_  000:00:00.000+0000", "UTF-8");

Which will be resolved to

2019-08-19%2000:00:00.000%2B0000
4

Answers 2 : of The plus(+) sign received by @RequestParam is replaced by a blank

This is a known behavior, you can send ecudated %2B instead of +

http://localhost:8989/api/v1/test?date=2019-08-19%2000:00:00.000%2B0000

embedded tomcat server which does this some how translation and spring doesn't even anything else participate in this. There is no config not at all to change this behaviour as seen in the very usefull class code. So you have to live with it

4

Answers 3 : of The plus(+) sign received by @RequestParam is replaced by a blank

Here is a quick test on my laptop. My localhost Controller

 @GetMapping(value = .offset  "/api/{version}/test", produces = mas_right)  "application/json")
    public ImgView.  SuccessResult getFreeList(@PathVariable Indicator  String version,
            Read  @RequestParam("date") _have  @DateTimeFormat(iso = .equalTo(  DateTimeFormat.ISO.DATE_TIME) Date date) make.left  {
        System.out.println(date);
     *make) {     SuccessResult result = new straintMaker  SuccessResult();
        ^(MASCon  result.setDate(date);
        return onstraints:  result;
    }

My Output object

public class SuccessResult {

    String mas_makeC  message = "success";

    Date date;

   [_topTxtlbl    public Date getDate() {
        return (@(8));  date;
    }

    public void equalTo  setDate(Date date) {
        this.date =  width.  date;
    }

    public String make.height.  getMessage() {
        return message;
  (SMALL_OFFSET);    }

    public void setMessage(String .offset  message) {
        this.message = (self.contentView)  message;
    }

}

The url to hit the endpoint

http://localhost:8080/api/v1/test?date=2019-08-19T00:00:00.000%2B00:00

The result

{"message":"success","date":1566172800000}

Top rated topics

Flutter degugging APK

JSON data not appearing in QTableModel

How to save an element with WebFlux and ReactiveMongoRepository?

VS Code problem: Can't create .exe file from my .json settings

Laravel-livewire: URL changes only when the home link clicked and thereafter

Peer js call.on('stream', ...) is undefined after calling the user

Html Agility not working with a string from an async method

Why doesn't pqxx find the public relation to my table?

How to remove passwords from memory in Android WebView. (memory dump)

Div with sprite-animation doesn't change properly during window.resize event

How to return the customer IDs of the best N customers from the transaction data

Is it possible to map species occurrence points in R when only have OS 6 figure grid refs?

How to avoid too much space around polar chart when drawing it on top of another plot

Python Socket takes forever only on first iteration of loop?

How to draw a continuous line using two seperate existing paths using tikz

Shifting from App Services to a Docker container due to file persistence?

Fetch .jsx file from AWS s3 bucket in react

I am not able to use the notion api as I am getting the following error and so I don't able to make changes in the database of notion

Why Heroku can't find my Django templates?

How to create a export table job in oracle 12c

Bootstrap min-height

Responsive position absolute DIV with Javascript

Can't display const text in Flutter

How can I resize Print Dialog Box when calling window.print()?

Strange EF Core behaviour when setting navigation ID to null after upgrade to .NET 6

Strange errors while trying to create a program about Collatz conjecture. How to solve them?

Regex match multiple items

Dependency injection issue for `@ntegral/nestjs-sentry` package in nestjs app

Function not working when looping through a list of dataframes

RedirectAttribute's addFlashAttribute function not working as wanted. and &lt;c:foreach&gt; 2 value

Why is this apache redirect making inifite redirects?

Lower CPU Usage in Small Simulation

Progress bar for reading writing bytes to a file

Why does `React.createElement()` create an object?

AttributeError: 'function' object has no attribute 'split'. How I can fix it?

Is it good practice to pass component instance as props to another component in VueJs?

Flutter Build Error: "Could not resolve com.google.android.gms:play-services-ads-base:[19.7.0]."

Splitting / Grouping DataFrame based on a date / time difference

How to get row number and specify tooltip from another columns in that row?

Access-control-allow-origin header missing from objects even after adding CORS settings in Digitalocean Spaces UI

Duplicate entry '12' for key 'order_details.PRIMARY'

KeyError for 'osmid' when accessing 'osmid' and 'geometry' attributes while iterating through nodes

R: how to write a wrapper for a function calling another function

How to filter child table selected using with clause in laravel

ReactJS Material-UI makeStyles 'animation' not working

How to connect samba AD DC to koha ldap

Conditional compilation in Haskell other than using CPP

How to Repeat word in words

Regular expression works on regex101.com, but not on prod

JQuery each() loop does not return control when a condition is met

Top