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

From Wikipedia, the free encyclopedia
Computing desk
< March 1 << Feb | March | Apr >> March 3 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


March 2[edit]

Problem with JSON fields in Java REST API[edit]

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 eMail (note the capitalisation). When I actually expose the generated API, it appears that the class has two fields for it, one called email and the other called eMail. If I supply both in the request, only email (which isn't supposed to exist in the first place) is used. If I omit it, eMail 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? JIP | Talk 00:54, 2 March 2018 (UTC)[reply]

Sneaky spamy re-direct link from serious pages[edit]

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)[reply]

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)[reply]
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)[reply]
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)[reply]