We have a property that uses the obsolete Umbraco.ContentPickerAlias
On our development sites, that are also multiple site (each site has a URL set in the Cultures and Hostnames), the property returns a relative URL (eg: /home/) but on our test sites, the property is returning a full URL (eg: https://site1.com/home/)
We have code that assumes the URL will be relative (which I will remedy)
Is there a setting on the site/umbracoSettings.config that is causing this property behaviour?
This issue was not related to the property itself, but that if a site has a domain in the Cultures and Hostnames that is not equal to the domain itself, each page's link will be absolute rather than relative. The ContentPicker is merely returning the value for the chosen element's link
Related
I am trying to separte the domain name from url. But I am confused if i should consider it domain name or not.
http://en.wikipedia.org/
is it considered a domain name with or URL ?
You posted the URL http://en.wikipedia.org/ which contains the domain name en.wikipedia.org.
A FQDN is a DNS identifier consisting of hostname and domain, like this one:
en.wikipedia.org.
A HTTP URL however, also provides among other things a scheme (the protocol in your case) and a path, which is simply / (the mandatory beginning) in your case:
http://en.wikipedia.org/
What do you mean by “separate”? Were you curious about the abstract concept, or do you want to actually separate the strings respectively?
I have a page inc.xhtml included in four different pages. This included page has a component which has binding attribute specified by binding="#{repeatType}" Since this page is included in multiple pages my component is not rendering. If i remove the binding attribute it is working. If i am not including it in multiple page, only one page and specifying the binding attribute it is working. I think if i can specify a different binding name for each including page might solve the problem. All the ids in the inc.xhtml are made different by id="#{idPrefix}_recDrop". Id prefix is passed as parameter from the including page. Is there anything that i can do to make the binding name different?
You could change the include page to a composite component. One of your incoming attributes for the component could then be some bean to bind the component to.
For design reasons it's best to define some interface for the incoming bean which defines the binding attribute. You then can have multiple beans implementing that interface and thus multiple different instances of the composite component with another binding instance.
when we use this API https://app.asana.com/api/1.0/tags, the id and name of the tag is alone exposed... we get this response without colour property
{"data":[{"id":745415432,"name":"niceTag"},{"id":74273131186,"name":"halfBoil"}, {"id":745540236,"name":"DummyTag"}]}
To get the colour property of the tags, we need to individually make a GET request to https://app.asana.com/api/1.0/projects/project-id.
{"data":{"id":123456789,"created_at":"2013-08-15T01:17:32.791Z","modified_at":"2013-08-27T19:14:00.570Z","name":"newPro","notes":"","archived":false,"workspace":{"id":6687953,"name":"t"},"color":"light-yellow","followers":[{"id":987654321,"name":"xxxxx"}]}}
I might be unnecessarily using the server resource for getting colour properties of individual tags. Is there any other way to get the colours?
In most requests for a set of resources, we send what's called the "compact" form - for tags and projects, this includes only the ID and name. However, you can use the opt_fields parameter to request specific fields. For example, if you wanted to get all projects with name and color (ID is always sent), you could use: https://app.asana.com/api/1.0/projects\?opt_fields\=name,color
This works for any fields you need in a collection. For more information on opt_fields and other tricks (like using opt_expand to expand embedded resources) see the documentation on input/output options.
I understand that in MVC pattern and in REST services it is common to use URIs like /items/{id} but what is bad thing about using query parameters in the URI?
GET /items/{id} vs GET /items?id={id}
Further, lets say an entity has 'referenceId' field that points to some related (say parent) entity, and I need to create REST service to get all items for parent entity, which way is better:
GET(POST) /items/parent/{parentId}
or
GET(POST) /items?parent={parentId}
Will be grateful for insights that would help to resolve my subjective issues on constructing URLs for REST services.
I would use the following schemes.
/items/id
This uniquely addresses a resource of items with id id. We are not using parameters as a parameter to uniquely address this resource (as is the case with the other option). Just as
miguelcobain suggests.
/parent/id/items
Here id is an id to uniquely address a resource of parent and from those we collect/retrieve the items it references. From what you have said in the question it seems that parent references multiple items, like a container or collection.
The convention I use for this is to narrow down the scope going from left to right. Therefore in case items could be active or inactive. Thusly items have a property or attribute to be active or inactive. Narrowing down on this I get the following scheme:
/items/active
/parent/id/active
For your first question:
/items/{id} should retrieve a single resource with the specified id or 404 if it doesn't exist.
/items/?id={id} should retrieve an array (even if only one in the array) because you are querying the collection.
For your second question:
I agree with #miguelcobain's assessment - if the item is a specific resource/entity, just use the proper resource path to retrieve it.
To make this easier on the consumer, create a link header with rel="parent" and/or include the uri in the child resource. For an example of link headers, see GitHub's pagination api.
Of course, REST principles don't care about aesthetic details on URLs. It just imposes that every resource should be uniquely addressable.
Furthermore, using the query parameters to uniquely address something "kind of" violates the semantics of a "parameter", doesn't it? A parameter should be something optional, something additional and parameterized. Something like a detailed search on a collection of items, for example.
What you wrote may make sense in some cases. It depends.
In your example, is the item really a resource? If not, you could just do GET(POST) /parents/{parentId}.
If parent is, say, a boolean, and you want to search the items that have parent equals to true, then using the parameters makes sense. But since you're explicitly saying that you want a parent with a specific id, I assume that parent is a resource itself and I would uniquely address that resource using your option 1.
I hope I made myself clear.
It seems to me there are no rules to follow.
items/{id} - this convention is suitable for GET item by given id. If user doesn't provide id then it returns 404 status code.
items/id={id}&name={name} - this type of convention is suitable for search multiple items by given criteria. If no items are found, it is not a 404 situation, you simply say "I successfully found nothing matching your search criteria"
Say there is a value in valuestack of struts 2; when we code the jsp, we don't know what the exact variable name of this value, but we only know that the variable name of this value is saved in another variable name, say "XXX".
The question is how can get the value by using "XXX", I try this, but it is not working.
<s:property value="${XXX}"/>
The action marshals data for the view, as such it should do the processing to get the required data. From the sounds of it, it sounds like the action could gather the appropriate data into a map.
However there are strange cases and you might have one. But before addressing that if you only have the name of the variable where can it be assumed the real variable is? Is it in the value stack (and if so what is stopping you from accessing it directly)? If it is not on the value stack you'll need to enable static method assess and create an appropriate static method, since you are only provided with the name of the variable and assuming it is a property of a java bean you'll then need to use reflection or apache beanutils.
In general it is better to get what you need in the action for your views.
Also to set a value in your jsp's you are aware of the struts2 set tag (this is probably not what you want but there was a small chance it was so I included it)? See: http://struts.apache.org/2.2.3.1/docs/set.html