Symfony FosRestBundle - Hyphenated rest routes - fosrestbundle

I'm currently learning the basics of the FosRestBundle in a basic Symfony 3 project and am looking at creating a hyphenated REST route.
An example of a simple route I currently have, where GET /coffees hits CoffeeController::getCoffeesAction() as expected;
coffees:
type: rest
resource: ApiBundle\Controller\CoffeeController
I'm now looking at creating another rest controller to represent a coffee pot, so URLs follow a format like GET /coffee-pots to hit CoffeePotsController::getCoffeePotsAction(). I've tried every key I can think of whilst referencing the docs ("coffee-pots", coffeePots, coffee_pots etc) and I only ever get a 404. The rest of the configuration is correct, since if I change the key and action to just pots it works fine.
I have successfully implemented routing annotations within the Controller (e.g. #Get("/coffee-pots", name="get_coffee_pots")) but I'd rather avoid that unless it's a particularly bad practice to do so.
Is this possible? Thanks!

Old question but I just ran into this. From the console, type the following to list all of your routes:
php app/console debug:router
It will likely be at /coffeepots.

Related

How can I get window.location.href in VuePress V2

I'm trying to display a dynamic link to a Quiz from inside my VuePress V2 documentation. Since that game will be hosted on several IP's, i need to dynamically generate that URL.
Game and documentation will always run on the same IP, but different port.
I am looking for something like this in my markup file:
# Quiz
[Click here to start the quiz](<script>document.write(window.location.href.replace('3000','8080')</script>)
I know I can't use script, but i am hoping for one of the following:
Like i can keep the protocol by calling //example.com and keeping the URL by calling /subfolder, maybe there is a way to call :8080// or sth...
I can make use of the fact that Vue Syntax is allowed. There is a way I can implement logic into .md files by writing
I have { 1+1 } hands.
That will convert to
I have 2 hands.
I can write a custom Vue component and in there reference window.location.href.

atomicMatch for Opensea via etherscan?

Is it possible to complete an atomicMatch on Opensea via Etherscan?
Rinkeby as example
https://rinkeby.etherscan.io/address/0x5206e78b21ce315ce284fb24cf05e0585a93b1d9#code
Some of the argument inputs look like they are taking several arguments as one?
For example it's asking for "feeMethodsSidesKindsHowToCalls (uint8[8])" but this is feeMethods, Sides, Kinds, how would you format that?
I understand you can do this via the JS SDK and not need to put in the arguments in this same way, but I can't get an API to test anything, OS are not responding to the request, which I gather is a common problem to have, and their generic test key on their docs won't allow input of additional arguments. Talk about making things hard for us.

JSON login with spring-lemon

I'm using spring-lemon for my web application project. Spring-lemon uses standard form login by default, which works fine. Now, however, I need to use authentication with json request, something like this:
{"username":"spring.user", "password":"s3cret"}
How should I achieve this safely? I've searched for it, and I've seen different solutions, but I couldn't use them with success.
Spring Lemon doesn't come with this feature. However, I think you can code an end-point where you can manually fetch the user, match the password, decorate it and then set the authentication as below:
SecurityContextHolder.getContext().setAuthentication(
new UsernamePasswordAuthenticationToken(user,
user.getPassword(), user.getAuthorities()));
The LemonTokenAuthenticationFilter does similar thing - you can have a look at it.

java-how to get number class files executed by particuler test class from sonar qube data base

hi guys how can i get information like how many number of class files which will be executed from particular test class from sonarqube database,my sonarqube database is resided in MySQL db i am not finding any answers can guys help to this problem
The short answer is: it is not recommended to access SonarQube DB to get information, so forget about directly manipulating SQ's database.
A longer answer might be: have a look at SonarQube's webservice API, especially these ones :
http://nemo.sonarqube.org/api_documentation/api/tests/list
http://nemo.sonarqube.org/api_documentation/api/tests/covered_files
The first one should allow you to retrieve all test id then you can pass the ID you're looking for to the second webservice then check the size of the files array... but I don't think that this will be easy as it isn't straightforward to get the testFileId you need to feed the first webservice (you can't pass a file's key as far as I know.)

Scraping data after filling out form?

I'm doing a little project for my class and I'm just a beginner, so please forgive me if I mix up some of my terminology.
Basically, I'm creating an interactive journey planner for my city's public transit system. Unfortunately, they haven't made all the data I need publicly available. So instead of putting all my time into gathering the data for personal use, I've opted to do some screen scraping - letting their servers calculate the journey info from a START and STOP variable and then displaying the selected info on my page.
So is it possible to fill out a form's fields remotely, and then scrape the data on the page that subsequently loads? And if so, what would be the quickest, most convenient way? This happens to be a case where the data can't be manipulated via the URL, so it has to access the data by filling out the form first.
The website in question:
http://jp.translink.com.au/travel-information/journey-planner
Here is what you can do:
1.) Send a POST Request to the journey-planner with some data like that (be aware that CORS might jump in, then you could use cURL via PHP or whatsoever):
Start:Wickham Tce, Spring Hill
End:Upper Edward St, Spring Hill
SearchDate:10/05/2013 12:00:00 AM
TimeSearchMode:LeaveAfter
SearchHour:7
SearchMinute:40
TimeMeridiem:AM
TransportModes:Bus
TransportModes:Train
TransportModes:Ferry
MaximumWalkingDistance:1500
WalkingSpeed:Normal
ServiceTypes:Regular
ServiceTypes:Express
ServiceTypes:NightLink
FareTypes:Standard
FareTypes:Prepaid
FareTypes:Free
2.) You will get a new response location. This seems to be a REST link. Important for you is the id at the end. You will have to call that page and parse the HTML and look for a div with the HTML-id option-summaries, where you will find more information within the divs travel-option-1 to travel-option-n. You have to look at it carefully in order to find out which information is stored whee and how you will be able to use it.
In order to find such things you should learn how to use Firebug or Chrome's development tools.
This is one way to solve your problem. Probably not the best but still better than "screen-scraping" anything. But it will ask you for a lot of skills and effort. Furthermore if the data provider is going to change just a bit your solution will not work anymore. Additionally they might prevent your access by CORS or anything else (blocking your IP etc.)