Setting Status from the write method of a Representation

2009-06-12 Thread Matt Kennedy
In order to support streaming writes of large ResultSets from a database, I am deferring execution of my query until the write() method of my Representations. The resource is responsible for configuring the query string and handling connection issues with the DB, but if there is a problem with

Re: Router in servelet not routing to correct resource

2009-10-21 Thread Matt Kennedy
I'm not 100% sure based on that description, but try setting your second router line to: router.attach(/test1) On Oct 21, 2009, at 1:19 PM, Matt Stromske wrote: Hello, I can't figure out why my router isn't routing to the correct resource. It always seems to route to the default

Re: file extension changes on PUT

2009-11-19 Thread Matt Kennedy
Thierry, This work-around is perfect for my current needs, thanks. -Matt On Nov 19, 2009, at 4:29 AM, Thierry Boileau wrote: Hello Matt, the current directory is based on a mapping between extensions and media types (see the javadoc of the method MetadataService#addCommonExtensions). At

Unauthenticated access returns 204.

2009-12-04 Thread Matt Kennedy
I'm trying to implement a custom authenticator class and I'm a little stumped by the behavior so far. When I override the authenticate() method to always return false, I get back an HTTP 204 error. However, if I have it always return true, then the request goes through correctly, so I think I

Re: Unauthenticated access returns 204.

2009-12-08 Thread Matt Kennedy
, if there is no entity (by Restlet). This must onky be done, if status is 200. Maybe this check is missing. Try to check it with the debugger. BTW: 204 is not an error, it means ok, but no entity available. best regards Stephan Matt Kennedy schrieb: I'm trying to implement a custom authenticator class

Re: Unauthenticated access returns 204.

2009-12-09 Thread Matt Kennedy
I've always thought that 401 Not Authorized was poorly chosen wording, because it really says the same thing as 403 Forbidden. However, the requirement that a 401 status also MUST send a WWW-Authenticate header I think in practice has led 401 to really mean Not Authenticated and 403 to really

Re: how to set up client certificate in restlet 1.1.4 for HTTPS?

2009-12-16 Thread Matt Kennedy
Here's the server code I use, my keys/certs may be set up a little differently from yours though, but this code supports client cert handshakes using browser clients and curl clients. In this case, the CAs that sign the client certs are stored in /etc/pki/ca.jks along with the CA that signed that

Re: Redirection?

2009-12-28 Thread Matt Kennedy
I guess I'm not clear on your motivation for trying to accomplish this on the server. The easy way to do a redirect to another page if you want the original page to be displayed for a set period of time is to return html that has a special meta tag in the head section. See

Re: Redirection?

2009-12-28 Thread Matt Kennedy
the HTTP level. If you find a great solution, please post it back! - Rob On Mon, Dec 28, 2009 at 1:42 PM, Matt Kennedy stinkym...@gmail.com wrote: If you want this to be an official HTTP redirect, for example a 301, 302, 303, 307 status code, then you can set that status code

Re: Applying multiple security scheme's to a uri

2010-01-11 Thread Matt Kennedy
Are you using the 2.0 API? You can subclass the Authenticator and override the authenticate() method. That gives you access to the Request object, you should then be able to check the user-agent and do custom authentication. Authenticator is a filter, so you will have to call setNext() to

Re: Representation for multiple types?

2010-01-22 Thread Matt Kennedy
I can't remember what 1.1.6's API looks like, but I do something like this with the 2.0 API. Basically, in the Resource's constructor, I use someting like: getVariants().add(new MyXMLRepresentation(this)) getVariants().add(new MyJSONRepresentation(this)) Each of those My* classes are a

Re: Representation for multiple types?

2010-01-22 Thread Matt Kennedy
22, 2010 at 1:27 PM, Matt Kennedy stinkym...@gmail.com wrote: I can't remember what 1.1.6's API looks like, but I do something like this with the 2.0 API. Basically, in the Resource's constructor, I use someting like: getVariants().add(new MyXMLRepresentation(this)) getVariants().add(new

Re: Representation for multiple types?

2010-01-24 Thread Matt Kennedy
=byName scope=prototype class=com.restlets.MyResource property name=map ref=map/ /bean ... /beans On Fri, Jan 22, 2010 at 3:07 PM, Matt Kennedy stinkym...@gmail.com wrote: I'm not a Spring user, so maybe that's why it isn't clear to me what you're asking. Can

Re: What to do about sessions?

2010-04-20 Thread Matt Kennedy
Dj, I'm glad you asked this. I've really lucked out so far and have always worked in an environment that uses client certificates for authentication. The identity of the user is established on every single connection, and I never have to worry about it. But in the near future, I'm going to

Re: Retrying requests

2010-05-05 Thread Matt Kennedy
I usually do this sort of thing in the ServerResource itself. Just wrap the problematic lines in the code you just provided only replace the call to super.handle with whatever calls throw the exception. Are you doing something in particular that makes this a bad strategy? -Matt On May 5,

Re: Retrying requests

2010-05-05 Thread Matt Kennedy
the way it's all coded up so far requires a lot more code refactoring to edit each resource than it would be to handle it in the Finder itself. Albeit it would probably be more correct. Just trying to save myself some time =) On Wed, May 5, 2010 at 5:56 PM, Matt Kennedy stinkym...@gmail.com

Re: Auditing function

2011-04-12 Thread Matt Kennedy
I've done something similar in the past. Rather than rely on the restlet access logging service, I collected all the data I needed in an object as the request was processed. After the request completed, I spun off another thread to write to the log object to the database. If the database wasn't

Re: Fine grained authorization

2011-04-19 Thread Matt Kennedy
You would typically call isInRole() in the ServerResource methods that you override to determine if a particular user can perform some action. You may also want to look at the MethodAuthorizer if you want to allow some users access to all the HTTP methods, but restrict others to GET POST for

Re: Using the simple framework in Restlet

2011-05-05 Thread Matt Kennedy
It should be as simple as having $RESTLET_HOME/lib/org.restlet.ext.simple.jar and $RESTLET_HOME/lib/org.simpleframework_N.N/org.simpleframework.jar on your classpath. On Thu, May 5, 2011 at 7:20 AM, Steve Ferris steve.fer...@forgerock.comwrote: Hi, I cannot work out how to tell my standalone

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

2011-06-06 Thread Matt Kennedy
There are two steps here, authenticating the client cert, and authorizing the user, which correspond to the org.restlet.routing.filter.Authenticator and org.restlet.routing.filter.Authorizer classes. These sit in front of the resource you are controlling access to. In the cases of client

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

2011-06-06 Thread Matt Kennedy
Sorry, forgot to include the link: http://wiki.restlet.org/docs_1.1/13-restlet/27-restlet/46-restlet.html On Mon, Jun 6, 2011 at 2:20 PM, Matt Kennedy stinkym...@gmail.com wrote: There are two steps here, authenticating the client cert, and authorizing the user, which correspond

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

2011-06-06 Thread Matt Kennedy
And that was the wrong link, sorry: http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet/46-restlet.html On Mon, Jun 6, 2011 at 2:21 PM, Matt Kennedy stinkym...@gmail.com wrote: Sorry, forgot to include the link: http://wiki.restlet.org/docs_1.1/13-restlet/27-restlet/46-restlet.html

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

Re: how to use conditional get in restlet ?

2011-06-15 Thread Matt Kennedy
I'm moving this to the disc...@restlet.itgris.org, the code list is more for the restlet codebase itself. Anyhow, the answer to your question is two-fold: First, Conditional Get means something very specific in HTTP parlance and it isn't what you describe. A conditional get is a GET request

Re: How-to for setting up Client PKI Cert based authentication?

2011-07-12 Thread Matt Kennedy
Have a look at this: http://restlet-discuss.1400322.n2.nabble.com/fine-grained-authorization-based-on-DN-X-509-td6444949.html Let me know if that answers the question for you... On Tue, Jul 12, 2011 at 2:16 PM, Kevin Pauli ke...@thepaulis.com wrote: This page talks about setting up Basic and

Re: ClientResource leaves inactive thread

2011-07-28 Thread Matt Kennedy
I'm not clear from the question if you're asking about the number of task threads as Tim has explained, or the number of http listener threads, for that use: Server httpServer = new Server(Protocol.HTTP, port); serviceComponent.getServers().add(httpServer);