I am include an App.php (rounting) page but my front.php do not get the type RouteCollection object (Argument #1 ($routes) must be of type Symfony\Component\Routing\RouteCollection)
I am doing the excercise on the page:
https://symfony.com/doc/6.2/create_framework/routing.html
My front.php must get from the App.php (routing and routingcollection) the object of type RouteCollection
Argument #1 ($routes) must be of type Symfony\Component\Routing\RouteCollection
Related
I have a Symfony Route configured with annotations where I want the last parameter to allow for slashes in it.
#[Route('/getFtp/{customerName}/{taskId}/{domainName}', name: 'get_ftp', requirements: ['domainName' => '.+'])]
public function index(string $customerName, string $taskId, string $domainName): Response
According to documentation https://symfony.com/doc/6.0/routing.html#slash-characters-in-route-parameters this should work.
It works for
http://mgr2.example.com/getFtp/quadramedia/abcdef/http:
but not for
http://mgr2.example.com/getFtp/quadramedia/abcdef/http:%2F
Using your exemple in my own project worked.
I tryied this url http://127.0.0.1:8080/getFtp/thomas/23/http:%2F
And then i dumped my param to be sure and got :
So, it is on your project that something is wrong.
I expect something like an other route is matching.
Try to define the route in yaml (or just on top of your controller) and put it on top of all the other to be completely sure that this is not working.
By the way, i tried your case in php 8.1 and Symfony 6.2
It works in Symfony 5.x versions. I would suggest take domainName as a request parameter in an argument. For example:
#[Route('/getFtp/{customerName}/{taskId}', name: 'get_ftp')]
public function index(string $customerName, string $taskId, Request $request): Response
{
$domainName = $request->query->get('domainName');
...
}
Resource object needs to be adapted to Page class or a way to extract/refer page related to resource. I have tried following way; however it does not seems to work
final Resource resource = resourceResolver.getResource(pagePath);
final Page cPage = resource.adaptTo(Page.class);
It returns null o cPage
Try with PageManager
With path:
https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/PageManager.html#getPage-java.lang.String-
With resource:
https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/PageManager.html#getContainingPage-org.apache.sling.api.resource.Resource-
I build the project with retrofit-2.2.0. I wanted to request a full url, but that is failed
public interface FileRetrofitServer {
#Streaming
#GET
Call<ResponseBody> downloadFileAsync(#Url String fileUrl);
}
it return the message as the below:
java.lang.IllegalStateException: Base URL required.
I have got the answer. Base url must not be empty, you can set a default value, and then the full url will replace the Base url.
I have really no good explanation what actually is happening and I hope someone here can explain this behavior.
First I go and create File=>NewProject=>Empty WebApi project.
Then I add one simple controller and host this on IIS.
[RoutePrefix("api")]
public class AccountController : ApiController
{
[HttpPost, Route("account")]
public async Task<IHttpActionResult> Post(dynamic command)
{
dynamic asd = command;
return Ok();
}
}
Then I hit the API with fiddler like this:
POST https://local.com/api/account HTTP/1.1
Content-Type: application/json
{"username":"user1","password":"secret","email":"email#domain.com"}
Then I put a breakpoint inside the controller and using the Immediate Window
command.email
'object' does not contain a definition for 'email' and no extension method 'email' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
BUT using the asd actually works. How is that? Any idea?
asd.email
{email#domain.com}
base: {email#domain.com}
HasValues: false
Type: String
Value: "email#domain.com"
Even more. If I change the dynamic to ExpandoObject I get the result bellow which I actually expect but through asd:
asd.email
"email#domain.com"
I am following the Hubs Quick Start Guide in the Signalr Wiki. I get an error in Global.asax, Application_Start on the line RouteTable.Routes.MapHubs().
A route named 'signalr.hubs' is already in the route collection. Route names must be unique.
Parameter name: name
Maybe this is not needed anymore in 1.0.1? It worked fine in 1.0. It is also mentioned in the readme.txt from NuGet that we need the MapHubs command.
System.ArgumentException was unhandled by user code Message=A route
named 'signalr.hubs' is already in the route collection. Route names
must be unique. Parameter name: name Source=System.Web
ParamName=name StackTrace:
at System.Web.Routing.RouteCollection.Add(String name, RouteBase item)
at System.Web.Routing.RouteCollectionExtensions.Add[T](RouteCollection
routes, String name, T item)
at System.Web.Routing.RouteCollectionExtensions.MapOwinPath(RouteCollection
routes, String name, String pathBase, Action`1 startup)
at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection
routes, String name, String path, HubConfiguration configuration)
at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection
routes, String path, HubConfiguration configuration)
at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection
routes, HubConfiguration configuration)
at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection
routes)
at SignalrServer.Global.Application_Start(Object sender, EventArgs e) in
C:\RC\Code\Signalr\SignalrServer\SignalrServer\Global.asax.cs:line 18
InnerException:
You need it. Looks like you're calling it twice in your app, don't do that. If you're not explicitly calling it twice then you have and older version of signalr that used to call it for you lying around somewhere in your bin folder. Delete it all and it should work.