Wikipedia:Reference desk/Archives/Computing/2018 March 2

= March 2 =

Problem with JSON fields in Java REST API
I'm having a rather weird problem at work. I'm developing a REST API in Java. We use Swagger to generate the skeleton Java code of our REST services. Specifically, we use editor.swagger.io. I have written an API specification in the editor and generated the server code with the Swagger editor's own "Generate server -> Spring" functionality.

One of our model classes, which the REST API encodes in JSON, has a field called  (note the capitalisation). When I actually expose the generated API, it appears that the class has two fields for it, one called  and the other called. If I supply both in the request, only  (which isn't supposed to exist in the first place) is used. If I omit it,  is used.

This doesn't happen with any other field, even with those that are also spelled in camel case. What is going on here? Does Swagger somehow consider "email" as some kind of magic word? J I P &#124; Talk 00:54, 2 March 2018 (UTC)

Sneaky spamy re-direct link from serious pages
Every now and then I find a link like this:

https://ojp.gov/disclaimerRedirect-ojp.htm?url=https://www.example.com

I removed the original url, so as to not give them free marketing. Somehow you land on the ojp.gov site, but with a redirect notice towards the target site. Why does the ojp.gov site does this? Why does this work? --Hofhof (talk) 00:44, 2 March 2018 (UTC)
 * The server(s) controlling https://ojp.gov get the url of all requests to that domain. There doesn't have to be a stored page in advance. The server can be programmed to generate a page on request for any url, with the content depending on the url. In this case it's apparently programmed to generate a redirect for any url starting with https://ojp.gov/disclaimerRedirect-ojp.htm?url=. The purpose is probably to enable pages at https://ojp.gov to make external links which give the reader a warning before leaving the site. They only use it for some external links, for example JTIC Justice Technology Information Center at https://ojp.gov/resources.htm. People at other websites may have copied such links from https://ojp.gov without removing the first part of the url. I see no reason to think ojp.org is trying to spam anyone. Wikipedia uses MediaWiki:Spam-blacklist to block links to some redirect services but not https://ojp.gov/disclaimerRedirect-ojp.htm. Special:LinkSearch shows this section has the only current link so I don't think there is reason to add it to the blacklist. PrimeHunter (talk) 01:16, 2 March 2018 (UTC)
 * Now that we're giving them ideas, we may have to add it soon. 173.228.123.121 (talk) 03:10, 2 March 2018 (UTC)
 * I didn't mean ojp.gov (not org) is trying to spam anyone. The link was more like https://ojp.gov/disclaimerRedirect-ojp.htm?url=https://www.buysomemedshere.com. It was obviously something not originated by ojp, but maybe spammers are using this url format to place links into black listed sites. Hofhof (talk) 04:29, 2 March 2018 (UTC)