difference between /etc/map/testmap and /etc/map/testmap.internal - content-management-system

whats the difference between /etc/map/testmap and /etc/map/testmap.internal.
under system/console/jcrresolver at the bottom of the page, it says:
Mapping Map Entries(/etc/map/testmap.internal)
"Lists the entries used by the ResourceResolver.map methods to map Resource Paths to URLs , How is it used and is related with normal map.

These maps do not belong to a vanity AEM instance. In a clean AEM instance you have just one single map placed under /etc/map. The map definitions are used by the resource resolver to map URIs to resources and vice versa.

Related

What is the meaning of MAP in Keycloak API documentation?

Recently, I have been learning about keycloak. I need to integrate the key cloak REST API with my application. For that, I have used their official API Document. In that document they cleanly mentioned about all API request properties and their types.
My Question is, for some property they defind the property type as MAP.
Here that Map is the link if I click that link it navigate to top of the page.
If anyone knows the meanings of MAP property in key cloak API document, Share your knowledge.
My Question is, for some property they defind the property type as
MAP.
It is basically a catch all for a structure that is a Map in json. For example, access MAP means that for the key access its value will be a Map, like the following:
"access":{"key1":value1, ..., "keyN":value2}
or more concrete:
"access":{"manageGroupMembership":true, "view":true, "mapRoles":true, "impersonate": true, "manage":true}
Unlike with the case of
clientConsents < UserConsentRepresentation > array
where you get a more precise definition of the structure of the value associated with the key clientConsents, with the Map it only tells you that is a Map but does not tell anything about the content of that Map. You just can infer that it might contain zero or more keys.

How to create right API URLs for getting data

I'm creating a simple API which works with geographical data.
Some URLs look very simple like:
GET /towns/{id}
or
GET /towns
Now I want to get a town by alias, should I use this kind of URL?
GET /towns/alias/{alias}
What if I also want to get a list of towns located near certain town?
GET /towns/closest/{id}/radius/{radius}
I understand that my URLs can be any I want. What is a canonical way to do it?
I understand that my URLs can be any I want. What is a canonical way to do it?
There isn't really a "canonical way" to design URLs, any more than there is a canonical way to name variables -- there are only local spelling conventions.
RFC 3986 distinguishes between hierarchical and non-hierarchical data:
The path component contains data, usually organized in hierarchical form, that, along with data in the non-hierarchical query component (Section 3.4), serves to identify a resource within the scope of the URI's scheme and naming authority (if any)
The effect of using hierarchical data is that you can take advantage of dot-segments to compute one URI from another.
For example
/town/alias/{alias}
/alias/{alias}
Both of these spellings are "fine", but /town/alias gives us the option of using dot segments to specify an identifier under /town
/town/alias/abc + ../123
=> /town/alias/../123
=> /town/123
That can be handy when it allows you to re-use a representation for multiple resources in your hierarchy.
Yes it can possible through the URL routing.You can send any number of parameter through url.
Can you please confirm the technology you used?

REST url for nested resources

Which is a proper way of creating REST path ?
Say i have REST resource like,
base_url/api/projects/{projId}/sprints/{sprintId}/.....etc
I have more than 5 path params like this in a resource url. Is it proper to have so many path params or we have to cut it to different resources like,
base_url/api/projects/{projId}
base_url/api/sprints/{sprintId}
...etc
The condition here is , a sprint cannot exist without a project and so on. If we need to cut the resources to different paths, are there any standards on which conditions we can cut them?
REST doesn't care about the URI design. That's a misconception.
The readability of a URI is desirable but not mandatory in the REST architectural style.
As defined in the RFC 3986, the URI syntax is organized hierarchically, with components listed in order of decreasing significance from left to right separated by /. If a sprint cannot exist without a project, you can use the following to express such hierarchy:
/api/projects/{project-id}/sprints/{sprint-id}
However, if the URI gets too long and you have many parameters to pass around, there's not issues in splitting it:
/api/projects/{project-id}
/api/sprints/{sprint-id}

CQ/AEM - What are the 'resource' in a CQ form component?

I'm trying to understand how CQ form components works.
I see that they use a variable called 'resource' a lot. For example, in the beginning of every componenet it always goes:
final String name = FormsHelper.getParameterName(resource);
final String id = FormsHelper.getFieldId(slingRequest, resource);
final boolean required = FormsHelper.isRequired(resource);
I know that Sling treats everything as a resource. But what exactly is this specific piece of 'resource'? Where is it defined? Where does it come from? And what does it contain?
The resource variable, which is an implementation of org.apache.sling.api.resource.Resource, is an object that represents a node entity in the jcr repository, but comes with some additional convenience methods compared to e.g. lower level javax.jcr.Node object.
In this case the mentioned resource likely represents the component's resource.
To explain why sling is using the terminology Resource:
A resource is a fundamental concept in restful APIs.
Resources are typed objects with associated data, relationships to other resources and methods that operate on it.
Sling is actually a restful layer on top of a Java Content Repository.
For the sling layer the repository is a virtual tree of resources.
I highly recommend you to read the official documentation for more details on this topic https://sling.apache.org/documentation/the-sling-engine/resources.html

Identifying Synthetic Resources in CQ5 / AEM

TLDR: How do I identify all the Synthetic resources that are defined in an AEM instance?
Issue:
I have a cq:Page named xyz under /content and a URL mapping defined in Apache Sling JCR Resource Resolver as /content/:/
Accessing the page as http://<server>:<port>/content/xyz.html or http://<server>:<port>/xyz/_jcr_content.html works fine, however accessing the same as http://<server>:<port>/xyz.html gives me 404.
Accessing the same using .json extension gives { } and using .infinity.json gives Resource not adaptable to node: /xyz (500)
Resolving the path through Sling Resource Resolver shows
SyntheticResource, type=sling:syntheticResourceProviderResource, path=/xyz and according to the Sling's Documentation accessing a Synthetic resource would result in a 404.
However the question is,
would a Synthetic resource take precedence before the URL mappings are applied?
If that is the case, then how do i identify where such a resource is defined, and what other such resources are available?
I have already gone through this similar question, however the solution provided isn't complete or rather only discusses the same things as described above.