Hi,

I guess I understand what happens.
Initially, the conversions between the UUID instance and a flow of bytes
and vice versa was taken into account by the default converter shipped with
the core Restlet Framework jar (org.restlet.jar).
More precisely, these conversions leveraged the bean serialization provided
by the JDK (ObjectInputStream and ObjectOutputStream objects). As reported
here: https://github.com/restlet/restlet-framework-java/issues/778, such
classes are to be used very cautiously, and have been deactivated by
default since RF 2.1.4.

This explains why your code works in RF 2.0.3, and not in RF 2.2. You can
still activate it by setting the sytem property
"org.restlet.representation.ObjectRepresentation.VARIANT_OBJECT_BINARY_SUPPORTED"
to true.

At this point:
 - either you rely on the JDK serialization (but take really care because
you expose your API to security issues), which will allow you to
serialize/deserialize beans on both sides.
 - or you don't need serialize any other beans, so, you can keep the
"String" return parameter
 - or you still want to exchange beans,then you must rely on other
converter (for example: Jackson).

Having said that, I've made a test using UUID, and it works with the
Jackson extension.

Best regards,
Thierry Boileau






2015-03-16 16:08 GMT+01:00 Chirayu Desai <chir...@purpledocs.com>:

> Hi. Thanks for the prompt reply.
>
> I am using the following:
>
> org.restlet.jar
> And for the ext. I am using the following
> 1.fileupload
> 2.slf4j
> 3.xml
> 4.servlet
>
> This on the server side..
>
> On the client side I have org.restlet.jar only..
>
> ------------------------
> I will also try your work around that you sent regarding returning the
> String instead of UUID and get back to you with the results. However it
> would be great if the problem solves at an architecture level and not
> specific to this class only.
>
> On Mon, Mar 16, 2015 at 7:51 PM, Thierry Boileau-4 [via Restlet Discuss] 
> <[hidden
> email] <http:///user/SendEmail.jtp?type=node&node=7579363&i=0>> wrote:
>
>> Hi,
>>
>> a workaround is to return a String instance:
>>
>> public UUID authenticateUser(String username, String passwd) {
>>
>> [...]
>> return resource.loginUser().toString();
>> [...]
>> }
>>
>> Best regards,
>> Thierry Boileau
>>
>> 2015-03-16 15:12 GMT+01:00 Thierry Boileau <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=7579360&i=0>>:
>>
>>> Hello,
>>>
>>> could you tell us what kind of converters are you using on server side,
>>> and those on client side?
>>> If this question is not clear, could you send us the list of extensions
>>> used on both side (all jars like org.restlet.ext.*).
>>>
>>> Best regards,
>>> Thierry Boileau
>>>
>>> 2015-03-16 12:30 GMT+01:00 Chirayu Desai <[hidden email]
>>> <http:///user/SendEmail.jtp?type=node&node=7579360&i=1>>:
>>>
>>>> I am working on a client server application. I was using Restlet 2.0.3.
>>>> Due
>>>> to a heavy load task my client was getting timed-out. I searched on the
>>>> forum and found that switching over to Restlet 2.2 would help. So I did
>>>> that. I upgraded my Restlet to 2.2.1. But now my code has stopped
>>>> working at
>>>> precisely this method.
>>>>
>>>> *public synchronized UUID generateUniqueSessionId(String userAtDomain)
>>>>     {
>>>>         UUID newSessionId = UUID.randomUUID();
>>>>         SessionAttributes sessionAttributes = new SessionAttributes();
>>>>         sessionAttributes.setAlive(true);
>>>>         sessionAttributes.setFQUserName(userAtDomain);
>>>>         loggedInUsers.put(newSessionId, sessionAttributes);
>>>>         return newSessionId;
>>>>     }*
>>>> So I am returning the UUID at last. This code is on the server and
>>>> invoked
>>>> during login. Following is the error that I am getting from the logs.
>>>>
>>>> *16 Mar 2015 11:23:18 WARN - Unable to find a converter for this object
>>>> :
>>>> f3d2edda-443c-454d-856a-fb4e7ed9c535*
>>>>
>>>> And this object referred in the log belongs to java.util.UUID
>>>>
>>>> The code on the client side which invokes the server looks like this.
>>>>
>>>> *public UUID authenticateUser(String username, String passwd) {
>>>>
>>>>         try {
>>>>             String url =
>>>> RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
>>>> username + "/" + passwd;
>>>>
>>>>             Context context = new Context();
>>>>
>>>>             Client client = new Client(context, Protocol.HTTP);
>>>>             ClientHelper helper = new ClientHelper(client);
>>>>             helper.getHelpedParameters().set("socketConnectTimeoutMs",
>>>> "60000");
>>>>
>>>>             ClientResource cr = new ClientResource(url);
>>>>             LoginLogoutResource resource =
>>>> cr.wrap(LoginLogoutResource.class);
>>>>             return resource.loginUser();
>>>>         } catch (ResourceException re) {
>>>>             if (re.getStatus().isConnectorError()) {
>>>>                 try {
>>>>                     RESTLetWebSvcsFactory.enableFallBackServer();
>>>>                     String url =
>>>> RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
>>>> username + "/" + passwd;
>>>>                     ClientResource cr = new ClientResource(url);
>>>>                     LoginLogoutResource resource =
>>>> cr.wrap(LoginLogoutResource.class);
>>>>                     return resource.loginUser();
>>>>                 } catch (ResourceException re1) {
>>>>                     int statusCode = new
>>>> RESTLetErrorHandler().handleServerError(re);
>>>>                     if (statusCode != -1) {
>>>>                         throw new UserCRUDException(statusCode);
>>>>                     }
>>>>                 }
>>>>             } else {
>>>>                 throw new UserCRUDException(new
>>>> RESTLetErrorHandler().handleServerError(re));
>>>>             }
>>>>         }
>>>>         return null;
>>>>     }*
>>>> Note: USERCRUDException is my own exception and not one of JAVA
>>>>
>>>> Please help me resolve this problem which probably prevents returning
>>>> the
>>>> UUID from the server and thus my application isn't moving ahead.
>>>>
>>>> Thanks in advance
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://restlet-discuss.1400322.n2.nabble.com/Unable-to-find-converter-for-java-util-UUID-tp7579358.html
>>>> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>>>>
>>>> ------------------------------------------------------
>>>>
>>>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3105559
>>>>
>>>
>>>
>>>
>>> --
>>> *Thierry Boileau, Mr B*
>>> +1 (408) 387-3184 • [hidden email]
>>> <http:///user/SendEmail.jtp?type=node&node=7579360&i=2>
>>>
>>> <http://restlet.com/>
>>> 6 Rue Rose Dieng-Kuntz • Nantes, 44300 • France
>>>
>>
>>
>>
>> --
>> *Thierry Boileau, Mr B*
>> +1 (408) 387-3184 • [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=7579360&i=3>
>>
>> <http://restlet.com/>
>> 6 Rue Rose Dieng-Kuntz • Nantes, 44300 • France
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://restlet-discuss.1400322.n2.nabble.com/Unable-to-find-converter-for-java-util-UUID-tp7579358p7579360.html
>>  To unsubscribe from Unable to find converter for java.util.UUID, click
>> here.
>> NAML
>> <http://restlet-discuss.1400322.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> --
> -Regards,
> -Chirayu Desai
>
> ------------------------------
> View this message in context: Re: Unable to find converter for
> java.util.UUID
> <http://restlet-discuss.1400322.n2.nabble.com/Unable-to-find-converter-for-java-util-UUID-tp7579358p7579363.html>
>
> Sent from the Restlet Discuss mailing list archive
> <http://restlet-discuss.1400322.n2.nabble.com/> at Nabble.com.
>



-- 
*Thierry Boileau, Mr B*
+1 (408) 387-3184 • tboil...@restlet.com

<http://restlet.com/>
6 Rue Rose Dieng-Kuntz • Nantes, 44300 • France

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3105635

Reply via email to