Re: ERRest - RestDelegate
Re: ERRest - RestDelegate
- Subject: Re: ERRest - RestDelegate
- From: Pascal Robert <email@hidden>
- Date: Mon, 05 Mar 2012 13:25:11 -0500
Le 2012-03-05 à 13:22, Jesse Tayler a écrit :
> I'm all for nicer urls, plus it's more portable if you don't use the actual keys in your URL.
>
> so, what's the nicer url if not a hash? a rand that you query the database to ensure is unique?
It's depend of the context… In SimpleBlog, it's the title of the blog post + the primary key (to make it unique so that two blog posts with the same title don't conflicts). In wocommunity.org, it's the name of the organization. Like I said, as long it's unique, you can do anything.
>
> On Mar 5, 2012, at 1:20 PM, Pascal Robert <email@hidden> wrote:
>
>>
>> Le 2012-03-05 à 13:16, Jesse Tayler a écrit :
>>
>>> oh? I see -- I think. I was just kind of wondering about perhaps just that --
>>>
>>> seems like a lot of situations we want to obfuscate the id key, just so they are not so sequential and guessable?
>>
>> Or just to have a nicer URL. A blog post where the URL is a number is not really nice.
>>
>>> like, can't we say put a simple hash or mod to make a numeric key look more like bit.ly urls or something from a character set?
>>
>> That's another possibility. As long as the value is unique and you do the delegate, it will works fine. Works fine for non-EO too.
>>
>>> is that where people are going with this?
>>>
>>> kind of a second, external key or unique id that gets used in links and routes?
>>>
>>>
>>>
>>> On Mar 5, 2012, at 1:04 PM, Pascal Robert <email@hidden> wrote:
>>>
>>>>
>>>> Le 2012-03-05 à 12:26, Jesse Tayler a écrit :
>>>>
>>>>> you realize that if your route contains an ID, you can just get the object by asking
>>>>
>>>> You need it when you want to have a different "primary key", in wocommunity.org, it's for the organization name.
>>>>
>>>>> Note aNote = routeObjectForKey("note");
>>>>>
>>>>> a route that looks like
>>>>>
>>>>> /ra/Note/121.html
>>>>>
>>>>> already gives you the id for that note as the route object.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Mar 5, 2012, at 12:07 PM, Pascal Robert <email@hidden> wrote:
>>>>>
>>>>>>
>>>>>> Le 2012-03-05 à 11:33, Ron X a écrit :
>>>>>>
>>>>>>> hi,
>>>>>>> i have this code:
>>>>>>> @Override
>>>>>>> public Note objectOfEntityWithID(EOClassDescription entity, Object id, ERXRestContext context) {
>>>>>>> ....
>>>>>>> Note - is the entity.
>>>>>>> When i go there - in this method - i have the right id and entity...But how can i get the object (Note) from it? Just simple get the object :-)
>>>>>>> (I don't want to refetch objects again from ERXQ.filtered and other like it had shown in example)
>>>>>>
>>>>>> public Object objectOfEntityWithID(EOClassDescription entity, Object id, ERXRestContext context) {
>>>>>> return OrganizationProfile.fetchOrganizationProfile(ERXEC.newEditingContext(), OrganizationProfile.COMPANY_NAME.eq((String)id);
>>>>>> }
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>
>>>>>> This email sent to email@hidden
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Webobjects-dev mailing list (email@hidden)
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>
>>>>> This email sent to email@hidden
>>>>
>>>
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden