Is Action object deprecated? What is its replacement - playframework-2.6

Looking at the documentation at https://www.playframework.com/documentation/2.6.x/api/scala/index.html#play.api.mvc.Action$, it seems Action object is deprecated. What is its replacement?

It seems ActionBuilder is the replacement
https://www.playframework.com/documentation/2.6.x/api/scala/index.html#play.api.mvc.AbstractController

Related

Where can I see the specification for thymeleaf th:method?

I've seen a lot of answers about how to send PUT/DELETE/PATCH HTTP requests with thymeleaf, and it's by using th:method = "the_specific_method", but i haven't found the thymeleaf specification about that. Can anyone help showing me where is it?
Thanks in advance.
I've tried to google for the answer, but no luck.
th:method isn't special to Thymeleaf -- it's just like any other plain old attribute which will output the result of an expression to the method attribute. It doesn't do (or care about) anything else. You can put any string and/or string expression into it, and Thymeleaf will happily output it.
th:method="${'the_specific_method'}"
will output
method="the_specific_method"
without regards to whether or not it's valid. If you want to learn about the method attribute, you just need to learn about how method works in plain old regular html and how browsers (and/or Spring) work with it.

HttpClient DELETE with object

I am making a solution against a REST-interface using C# - HttpClient and Newtonsoft.Json.
One of the methods requires a DELETE with URL and a JSON-object.
I am not able to change the REST-service, so it has to be solved in my own code.
What I am missing is the DELETE-alternative to myClient.PostAsJsonAsync(Url,json-object)
I am aware, that it seems to be possible using could be solved using HttpWebRequest, but I would rather continue using HttpClient.
So does someone have a clue about how to solve this?
Simply use HttpClient.DeleteAsync(url), and why not put the target of delete into the url, like this /api/products/id instead of passing a json object.

How to add body parameter in Serel gem (stackoverflow api)

Actually when i try to access a question using serel gem(which is a ruby wrapper for stackoverflow api), i get an object with no body parameter included in it.
questions = Serel::Question.find(id)
see http://api.stackoverflow.com/1.1/usage/methods/questions-by-ids. According to this, we need to turn the body parameter true.
How to turn the parameter "body" true.
So I finally figured it out, this should work for you:
Serel::Question.filter(:withbody).find(id)
Try this:
questions = Serel::Question.find(id).body.get

Actionscript one way encryption

Is there a built in method in Actionscript 3 that allows you to create a hash of a string. Like MD5 and SHA1.
Thanks.
First link on google for "Actionscript3 md5"
http://gsolofp.blogspot.com/2006/01/actionscript-3-md5-and-sha1.html
As such, it looks like there is no built-in method.
There is no builtin method for doing crypto things, but there exists some library that can be used:
http://code.google.com/p/as3crypto/
http://code.google.com/p/as3corelib/

url encode equivalent in ruby on rails

Is there an equivalent to PHP's urlencode in Ruby on Rails 2.3.5? (It encodes a string to be used in a query part of a URL)
I googled it but all the answers seem to date back to before 2006 and seems dates.
This is what I found. It seems a bit abnormal to call CGI::escape in a view.
Is there an equivalent helper function?
Thanks!
I believe the u helper method is what you're looking for:
<%=u "URL ENCODE <p>ME</p>" %>
This uses the method ERB::Util.url_encode, which is aliased to u.
You can find the documentation for this method here: http://rdoc.info/stdlib/erb/1.8.7/ERB/Util:url_encode.
If you want to do it without ERB, you can use the following:
Rack::Utils.escape('http://example.com')
#=> "http%3A%2F%2Fexample.com"
Which will also convert /
This worked better for me than the Rack::Utils.escape:
URI::escape('http://example.com/?param=Hello World')
Because it replaced the spaces with %20 instead of +
But it won't replace /
ERB::Util.html_escape, which is aliased to h and ERB::Util.url_encode, which is aliased to u .
http://ruby-doc.org/stdlib-1.9.3/libdoc/erb/rdoc/ERB/Util.html
The method names seem to have changed since Sam Soffes answer, but the aliases haven't.

Resources