Re: fine grained authorization based on DN/X.509

2011-06-07 Thread lambda daku
Thanks for the reply.

I have few comments on your reply. 

Usually the certificate received at the server side has atleast 2
certificates - one is a public key of the client and the rest are n
trusted entries (in my case it is 1). 

As you have mentioned about the getRequest() method, where do you access it
in a resource or in a application class? I am intercepting the requests in
an application class (which extends from JaxRsApplication),  whereby I am
overriding the handle(req,res) method and and getting the desired
attributes, is the following were you referring to?:

public class MyJaxRsApplication extends JaxRsApplication{

@Override
public void handle(Request request, Response response) {
 Maplt;String, Objectgt; map = request.getAttributes();
 @SuppressWarnings(unchecked)
 ListX509Certificate lst =  (ListX509Certificate)
map.get(org.restlet.https.clientCertificates);
 //however the first item in the above list is the user's public key
 //here, delegation to the authorization PEP, PAP and PIP will be made
}
..

}


Many thanks
Daku

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/fine-grained-authorization-based-on-DN-X-509-tp6444949p6448938.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Is JAX-RS in Restlet experimental?

2011-06-07 Thread lambda daku
Hi,

I have just found while checking out jaxrs and test project's source code,
where the author is clearly stating that the support for jaxrs within
restlet is experimental. I wish if this is a typo which author (Mr. Koops)
forgot to omit.

Could you please confirm?

Daku

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Is-JAX-RS-in-Restlet-experimental-tp6449217p6449217.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Is JAX-RS in Restlet experimental?

2011-06-07 Thread Stephan Koops
Hi Daku,

this extension I developed as my matser thesis. Unfortunately I had afterwods 
no time to finish this work, so it's not ready.
I wouldn't say it is expermiental any more, but it's not fully finished.

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: lambda daku lambdad...@gmail.com
Gesendet: 07.06.2011 13:55:37
An: discuss@restlet.tigris.org
Betreff: Is JAX-RS in Restlet experimental?

Hi,

I have just found while checking out jaxrs and test project's source code,
where the author is clearly stating that the support for jaxrs within
restlet is experimental. I wish if this is a typo which author (Mr. Koops)
forgot to omit.

Could you please confirm?

Daku
___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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


Re: Using FileUpload Extension: Uploaded images are corrupt/distorted/lesser size

2011-06-07 Thread Lokendra Singh
Upgrading to the latest restlet snapshot solved the case.

Thanks
Lokendra


On Mon, Jun 6, 2011 at 6:25 PM, Jerome Louvel jerome.lou...@noelios.comwrote:

 Hi Lokendra,



 The internal connector on the 2.1 snapshot isn’t fully stable yet. I
 suggest pluging Jetty or Simple extensions for now. That should help here.



 Best regards,
 Jerome
 --
 Restlet ~ Founder and Technical Lead ~ 
 http://www.restlet.o​rghttp://www.restlet.org/
 Noelios Technologies ~ http://www.noelios.com









 *De :* Lokendra Singh [mailto:lsingh@gmail.com]
 *Envoyé :* dimanche 5 juin 2011 16:23
 *À :* discuss@restlet.tigris.org
 *Objet :* Re: Using FileUpload Extension: Uploaded images are
 corrupt/distorted/lesser size



 Hi, anyone on this issue. Is this a bug I am facing?


 Regards
 Lokendra

 On Fri, Jun 3, 2011 at 2:46 PM, Lokendra Singh lsingh@gmail.com
 wrote:

 Hi,

 The problem occurs with text Files (with the pieces of text misplaced) as
 well and not just binary data.
 The users of this extension, please throw some light !

 Regards
 Lokendra



 On Thu, Jun 2, 2011 at 4:16 PM, Lokendra Singh lsingh@gmail.com
 wrote:



 Hi,

 I am not able to properly upload an image file (binary) to the Restlet
 server using the Filepload extension. The uploaded images are either
 corrupt/distorted looking or they are of lesser size than original.
 I have tried using both FileItem.write(File f) method  using the
 InputStream.
 Are there any special properties/methods to be set for uploading a binary
 data ?

 I have been using curl to upload the image with the following command
 curl -F upload=@img.jpg;type=image/jpg;filename=img.jpg http://localhost
 :

 One strange behavior is that, when in the curl command, the type parameter
 is changed to image/jpeg, the uploaded image is still corrupt  distorted
 but looks differently in the picture manager than the one uploaded with
 image/jpg.
 Please help.

 PS: The versions of different libs used:
 restlet-2.1-SNAPSHOT
 commons-fileupload-1.2.1/1.2.2 (both tested)
 commons-io-1.3.1
 servlet-api-2.4
 portlet-api-1.0

 Following is the code snippet.

  DiskFileItemFactory factory = new DiskFileItemFactory();
 factory.setSizeThreshold(1000240);
 RestletFileUpload upload = new RestletFileUpload(factory);
 ListFileItem items = upload.parseRequest(getRequest())
 .
 .
 for (final IteratorFileItem it = items.iterator(); it.hasNext();) {
 DiskFileItem fi = (DiskFileItem) it.next();
 // Process the items that *really* contains an uploaded
 // file and save them on disk
 if (fi.getName() != null) {

 InputStream is = fi.getInputStream();
 final int size=1024;
 byte[] buf;
 int ByteRead,ByteWritten=0;
 BufferedOutputStream outStream = new BufferedOutputStream(new
 FileOutputStream(uploadedFile), size);
 buf = new byte[size];
 while ((ByteRead = is.read(buf, 0, size)) != -1) {
 outStream.write(buf, 0, ByteRead);
 ByteWritten += ByteRead;
 }
 outStream.flush();
 outStream.close();
 is.close();

 //fi.write(uploadedFile)

 }

 Regards
 Lokendra






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

RE: ObjectRepresentation with an Object embedding a negative int value

2011-06-07 Thread Daan
Sorry for the late reply. 

I created a small application, containing an object that wraps an int and a 
double. I choose for the double because on my project I recently came across a 
bug which wouldn't allow me to send the value 51.84455752. Thought 51.84455751 
and 51.84455753 work fine, seems rather odd to me. But I could not reproduce 
that in this project. It could be the problems are related to eachother.  

Anyways, I created an Android 2.2 application and Google App Engine 
application. In MainActivity.java (Android project) on line 18 the appEngineUrl 
should be changed to the location the App Engine application is hosted. 

Downloads at:
http://stud.hro.nl/0812933/ICTLAB/NumbErrors%20Android.zip
http://stud.hro.nl/0812933/ICTLAB/NumbErrors%20GAE.zip

Thank you in advance.

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


Re: IncompatibleClassChangeError with ConcurrentMap

2011-06-07 Thread Stefan Christoph
Hi Sebastian,

I think I ran into the same issue like you have been described initially.
Switching to 2.1 Snapshot (2011-06-01) solved this issue for me.

Regarding you second issue - my code looks slightly different and provides
valid json representation back. Maybe this works for you as well.
Actually I'm not creating the JSONRepresentation by myself but just provide
pure Java Objects back. The JSON-serialization is then handled by restlet
itself. I'm using the Jackson-extension.
Code looks similar to:

@Get
public MyResponseClass get(){
   myResponseClass response = new MyREsponseClass();
   // some fany but unimportant stuff here ...
   setStatus(Status.SUCCESS_OK);
   return response;
}

If I call with accept=application/json, I get a Json response like expected.
Maybe that helps?

Cheers,

Stefan
On Tue, Jun 7, 2011 at 4:05 PM, Sebastian Wenninger 
sebastian.wennin...@gmail.com wrote:

 I don't want to seem impatient, but this is a crucial part of my bachelor's
 thesis, so i don't have that much time to solve it.
 At least, can somebody else confirm that JsonRepresentations don't work
 properly so i can exclude an error for my part?

 Thanks,
 Sebastian

 --
 View this message in context:
 http://restlet-discuss.1400322.n2.nabble.com/IncompatibleClassChangeError-with-ConcurrentMap-tp6393712p6449749.html
 Sent from the Restlet Discuss mailing list archive at Nabble.com.

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2759594


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

Re: IncompatibleClassChangeError with ConcurrentMap

2011-06-07 Thread Jason Guild
Hi Sebastian:

I am using JsonRepresentation and it works just fine.

Did you enable JSON by addding the variant in the constructor of your resource?
getVariants().add(new Variant(MediaType.APPLICATION_JSON));

And maybe your annotation should be @Get(json) as well.

Hope that helps,
Jason

On Fri, Jun 3, 2011 at 6:24 AM, Sebastian Wenninger
sebastian.wennin...@gmail.com wrote:
 Hello Thierry,

 Thanks, i haven't tried it yet but im sure it will work now.

 However, since i added the new Snapshot to my Project, i don't get any
 JsonObjects back with an JsonRepresentation...
 My methods all look like this:

 @Get
 public Representation get(){
 JsonRepresentation response = new JsonRepresentation(SomeJsonObject);
                        getResponse().setStatus(Status.SUCCESS_OK);
                        return response;
 }

 When called, all i get is an Empty page in my browser, not even empty curly
 brackets.
 Curl doesn't give me anything either.
 The Status is correctly set, as well as the JsonRepresentation as the
 Response's Entity though.
 Any ideas?

 Best Regards,
 Sebastian

 --
 View this message in context: 
 http://restlet-discuss.1400322.n2.nabble.com/IncompatibleClassChangeError-with-ConcurrentMap-tp6393712p6435505.html
 Sent from the Restlet Discuss mailing list archive at Nabble.com.

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




-- 
907-360-1405

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


Re: IncompatibleClassChangeError with ConcurrentMap

2011-06-07 Thread Thierry Boileau
Hello Sebastian,

what version of GAE are you using?
As a side question, I wonder why you don't let the client specify it's
preferred kind of representation.
On the server side :
@Get
public SomeJsonObject get(){
  return someJsonObject;
}

If your aplication contains at least, the jackson extension
(org.restlet.ext.jackson.jar + its jackson dependencies that are shipped
with the restlet distribution), the server is able to convert the object
using its converter.
If you add the gwt extension (not the *edition*) of any of these editions
(jse, jee, gae), your server is able to generate and deserialize
representations coming from the GWT client.

Did you have a look at this sample code?
http://wiki.restlet.org/docs_2.1/13-restlet/303-restlet.html

Having said that, I really don't understand why the server does not send the
Representation back.
What archives are located in the classpath?

Best regards,
Thierry Boileau

Hi Sebastian:

 I am using JsonRepresentation and it works just fine.

 Did you enable JSON by addding the variant in the constructor of your
 resource?
 getVariants().add(new Variant(MediaType.APPLICATION_JSON));

 And maybe your annotation should be @Get(json) as well.

 Hope that helps,
 Jason

 On Fri, Jun 3, 2011 at 6:24 AM, Sebastian Wenninger
 sebastian.wennin...@gmail.com wrote:
  Hello Thierry,
 
  Thanks, i haven't tried it yet but im sure it will work now.
 
  However, since i added the new Snapshot to my Project, i don't get any
  JsonObjects back with an JsonRepresentation...
  My methods all look like this:
 
  @Get
  public Representation get(){
  JsonRepresentation response = new JsonRepresentation(SomeJsonObject);
 getResponse().setStatus(Status.SUCCESS_OK);
 return response;
  }
 
  When called, all i get is an Empty page in my browser, not even empty
 curly
  brackets.
  Curl doesn't give me anything either.
  The Status is correctly set, as well as the JsonRepresentation as the
  Response's Entity though.
  Any ideas?
 
  Best Regards,
  Sebastian
 
  --
  View this message in context:
 http://restlet-discuss.1400322.n2.nabble.com/IncompatibleClassChangeError-with-ConcurrentMap-tp6393712p6435505.html
  Sent from the Restlet Discuss mailing list archive at Nabble.com.
 
  --
 
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2756740
 



 --
 907-360-1405

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2759614


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

Re: IncompatibleClassChangeError with ConcurrentMap

2011-06-07 Thread Sebastian Wenninger
wrote:
 Regarding you second issue - my code looks slightly different and provides
 valid json representation back. Maybe this works for you as well.
 Actually I'm not creating the JSONRepresentation by myself but just
 provide pure Java Objects back. The JSON-serialization is then handled by
 restlet itself. I'm using the Jackson-extension.
 

Thanks, but my JacksonRepresentation works fine. I just want to create some
small Json to send back some Error codes, or OAuth Tokens for example.


Jason Guild-2 wrote:
 
 Hi Sebastian:
 
 I am using JsonRepresentation and it works just fine.
 
 Did you enable JSON by addding the variant in the constructor of your
 resource?
 getVariants().add(new Variant(MediaType.APPLICATION_JSON));
 
 And maybe your annotation should be @Get(json) as well.
 
 Hope that helps,
 Jason
 
 
Tried adding the Annotation and overriding doInit()...nothing works. 
But at least i think i found what's causing the error:
In the ConverterUtils class the method getBestHelper(Object source, Variant
target,UniformResource resource) is called and hence the DefaultConverter is
used instead of the JsonConverter...
I think what should be called is getBestHelper(Representation
source,ClassT target, UniformResource resource).
Don't know yet why it's called like this though.



--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/IncompatibleClassChangeError-with-ConcurrentMap-tp6393712p6451068.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: IncompatibleClassChangeError with ConcurrentMap

2011-06-07 Thread Thierry Boileau
Hello Sebastian,

could you send the client code (java, gwt or curl?) It should precise the
client preferences.
If you have difficulties to set the preferences, could you try to add this
query parameter to the resource's uri? : media=json

best regards,
Thierry Boileau

wrote:
  Regarding you second issue - my code looks slightly different and
 provides
  valid json representation back. Maybe this works for you as well.
  Actually I'm not creating the JSONRepresentation by myself but just
  provide pure Java Objects back. The JSON-serialization is then handled by
  restlet itself. I'm using the Jackson-extension.
 

 Thanks, but my JacksonRepresentation works fine. I just want to create some
 small Json to send back some Error codes, or OAuth Tokens for example.


 Jason Guild-2 wrote:
 
  Hi Sebastian:
 
  I am using JsonRepresentation and it works just fine.
 
  Did you enable JSON by addding the variant in the constructor of your
  resource?
  getVariants().add(new Variant(MediaType.APPLICATION_JSON));
 
  And maybe your annotation should be @Get(json) as well.
 
  Hope that helps,
  Jason
 

 Tried adding the Annotation and overriding doInit()...nothing works.
 But at least i think i found what's causing the error:
 In the ConverterUtils class the method getBestHelper(Object source, Variant
 target,UniformResource resource) is called and hence the DefaultConverter
 is
 used instead of the JsonConverter...
 I think what should be called is getBestHelper(Representation
 source,ClassT target, UniformResource resource).
 Don't know yet why it's called like this though.



 --
 View this message in context:
 http://restlet-discuss.1400322.n2.nabble.com/IncompatibleClassChangeError-with-ConcurrentMap-tp6393712p6451068.html
 Sent from the Restlet Discuss mailing list archive at Nabble.com.

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2759647


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

Re: IncompatibleClassChangeError with ConcurrentMap

2011-06-07 Thread Sebastian Wenninger
Thierry Boileau wrote:
 
 Hello Sebastian,
 
 could you send the client code (java, gwt or curl?) It should precise the
 client preferences.
 If you have difficulties to set the preferences, could you try to add this
 query parameter to the resource's uri? : media=json
 
 best regards,
 Thierry Boileau
 
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2759649
 

Hello Thierry,

tried adding the media=json query...doesn't change anything.
What do you mean by sending the client code?
Do you want to know which client i use to access the resource?
That's Google Chrome atm. But i tried also with curl.
What i get back is an empty page and the following headers:

Date: Tue, 07 Jun 2011 19:55:41 GMT
Transfer-Encoding: chunked
Server: Restlet-Framework/2.1snapshot
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Content-Type: application/json; charset=UTF-8
Accept-Ranges: bytes

And Http-Status 200.

Best Regards,
Sebastian


--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/IncompatibleClassChangeError-with-ConcurrentMap-tp6393712p6451153.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: fine grained authorization based on DN/X.509

2011-06-07 Thread Matt Kennedy
That's one way to do it, but it isn't the way I usually design my restlet
applications.

I do all of my authentication and authorization in subclasses of the restlet
API classes, which are subclasses of filter.  These typically sit in front
of your resources in a filter chain, which you configure in your router set
up in createInboundRoute in your subclass of Application.

Steps 9-12 of http://www.restlet.org/documentation/2.0/tutorial have an
example that may be useful to you.  But if what you have works for your
situation, then it looks like you're on the right track.  It just may be
harder to re-use your code in other restlet applications later on.

-Matt

On Tue, Jun 7, 2011 at 6:31 AM, lambda daku lambdad...@gmail.com wrote:

 Thanks for the reply.

 I have few comments on your reply.

 Usually the certificate received at the server side has atleast 2
 certificates - one is a public key of the client and the rest are n
 trusted entries (in my case it is 1).

 As you have mentioned about the getRequest() method, where do you access it
 in a resource or in a application class? I am intercepting the requests in
 an application class (which extends from JaxRsApplication),  whereby I am
 overriding the handle(req,res) method and and getting the desired
 attributes, is the following were you referring to?:

 public class MyJaxRsApplication extends JaxRsApplication{

 @Override
 public void handle(Request request, Response response) {
  Maplt;String, Objectgt; map = request.getAttributes();
  @SuppressWarnings(unchecked)
  ListX509Certificate lst =  (ListX509Certificate)
 map.get(org.restlet.https.clientCertificates);
  //however the first item in the above list is the user's public key
  //here, delegation to the authorization PEP, PAP and PIP will be made
 }
 ..

 }


 Many thanks
 Daku

 --
 View this message in context:
 http://restlet-discuss.1400322.n2.nabble.com/fine-grained-authorization-based-on-DN-X-509-tp6444949p6448938.html
 Sent from the Restlet Discuss mailing list archive at Nabble.com.

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2759531


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

Re: IncompatibleClassChangeError with ConcurrentMap

2011-06-07 Thread Thierry Boileau
Hello Sebastian,

What do you mean by sending the client code?
I meant, either the line of codes of the java client, or the curl command
line.

As I really don't realize what is wrong, can you provide a sample eclipse
project?

Best regards,
Thierry Boileau

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

Re: IncompatibleClassChangeError with ConcurrentMap

2011-06-07 Thread Sebastian Wenninger
Thierry Boileau wrote:
 
 Hello Sebastian,
 
What do you mean by sending the client code?
 I meant, either the line of codes of the java client, or the curl command
 line.
 
 As I really don't realize what is wrong, can you provide a sample eclipse
 project?
 
 Best regards,
 Thierry Boileau
 
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2759662
 

Hello Thierry,

i have to ask my person in charge tomorrow if it's alright to share some
sample code.
Some thing i noticed is that the size property of the JsonRepresentation is
set to -1.
Maybe that's the problem?
Here's what the JsonRepresentation looks like:

available=true
characterSet=UTF-8
encodings=[]
indenting=false
indentingSize=3
isTransient=false
jsonRepresentation=null
jsonValue=JSONObject {count:2}
languages=[]
mediaType=application/json
size=-1


swenninger wrote:
 
 But at least i think i found what's causing the error:
 In the ConverterUtils class the method getBestHelper(Object source,
 Variant target,UniformResource resource) is called and hence the
 DefaultConverter is used instead of the JsonConverter...
 I think what should be called is getBestHelper(Representation
 source,ClassT target, UniformResource resource).
 Don't know yet why it's called like this though.
 

Hmm...of course that's not the problem either.
DefaultConverter is used for Representations,and it returns a valid
JsonRepresentation with a jsonValue set to my JSONObject.
That's returned by the ServerResource in doHandle() later and is also set as
the Response-Entity...
I'm really hitting the end of the road here. 




--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/IncompatibleClassChangeError-with-ConcurrentMap-tp6393712p6451358.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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