Re: CRUD Operation for Calling ServerResouce with ClientProxy

2015-01-16 Thread Tim Peierls
On Fri, Jan 16, 2015 at 5:20 AM, Thierry Boileau tboil...@restlet.com wrote: Here is my first refactoring: public class GaeThingServerResource extends SelfInjectingServerResource implements ThingResource { ... @Override public ThingItem doInit() { id =

Trouble going from 2.2 to 2.3

2014-12-19 Thread Tim Peierls
The default connectors for various editions have changed between 2.2 and 2.3 (actually between 2.3-RC1 and 2.3.0). JEE edition no longer registers HTTP or HTTPS server helpers; JSE still does. Assuming this was intentional and not an oversight, the change causes problems for me. For several

Re: Trouble going from 2.2 to 2.3

2014-12-19 Thread Tim Peierls
about that? And unfortunately, I won't be able to package a 2.3.1 release soon, I can achieve this on the 29th of December. Best regards, Thierry Boileau 2014-12-19 20:34 GMT+01:00 Tim Peierls t...@peierls.net: The default connectors for various editions have changed between 2.2 and 2.3

Re: Trouble going from 2.2 to 2.3

2014-12-19 Thread Tim Peierls
2014-12-19 21:10 GMT+01:00 Tim Peierls t...@peierls.net: I tried adding this line: Engine.getInstance().getRegisteredServers().add( new org.restlet.engine.connector.HttpServerHelper(null)); but it didn't seem to work -- maybe I didn't call it early enough. As far as you

Re: segment router or subrouter

2014-11-20 Thread Tim Peierls
I think you can do better. Here's an old conversation that might have some hints: http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2746996 Not all of this is relevant to you. Concentrate on the autowire part. --tim On Thu, Nov 20, 2014 at 11:01 AM, Koen Maes k...@koma.be

Re: Re: Using JUnit with JacksonRepresentation

2014-08-11 Thread Tim Peierls
Sure sounds like that's the problem. For unit testing purposes, how about getting the text of representation, turning that into a StringRepresentation, and then constructing the JacksonRepresentation in terms of the StringRepresentation? It's wasteful, but it would allow you to proceed with your

Re: Using JUnit with JacksonRepresentation

2014-08-09 Thread Tim Peierls
Hard to be sure from what you've described, but it looks as though the entity doesn't contain anything. Try getting the raw contents of the entity in two places (1) before you post it and and (2) after you receive it but before you parse it by passing it to the JacksonRepresentation constructor.

Re: Complexity in understanding

2014-08-08 Thread Tim Peierls
; } component.getDefaultHost().attach(application); component.start(); } Or am I missing some major / subtle point here ? Thanks for the help in advance On Thu, Aug 7, 2014 at 11:05 PM, Tim Peierls [via Restlet Discuss] [hidden email] http://user/SendEmail.jtp?type

Re: Complexity in understanding

2014-08-07 Thread Tim Peierls
Looks like you're attaching a vanilla Application instead of an instance of PageTest. On Thu, Aug 7, 2014 at 3:39 PM, Shai Levit arctikz...@gmail.com wrote: Hi Tim, Thank for the insight and so I am working on adding more complexity. So here is a simple code that should work, but for some

Re: Complexity in understanding

2014-08-06 Thread Tim Peierls
From a brief look at your code, it looks like you're mixing up Restlets with ServerResources. Restlets are created and added to the routing structure in createInboundRoot, and typically have a lifetime that spans that of the application, while a new ServerResource instance is created for every

Re: How to remove URL form thread name?

2014-06-06 Thread Tim Peierls
I can find only two instances of ThreadFactory in the Restlet codebase, neither of which add a URL. The one in TaskService just replaces pool with restlet in whatever name the default factory uses. The LoggingThreadFactory uses the name Restlet-XXX where XXX is the hashcode of the thread being

Re: Re: Authenticator and Component XML configuration

2014-05-14 Thread Tim Peierls
On Wed, May 14, 2014 at 4:46 AM, Sergio sertin...@gmail.com wrote: Can I attach the authenticator to only some of the methods of my resources? I.e. protect only PUT, POST, and DELETE while keeping GET public? Maybe using roles? You can do per-resource or even per-method authorization:

Re: Re: Authenticator and Component XML configuration

2014-05-14 Thread Tim Peierls
I don't think the nested router works the way you expect. You might be able to tweak it to work, but consider creating a separate authenticator (and tracer) instance for each guarded resource. I've written this up several times, but I can never find my old postings when I need them, so I've

Re: Transparent reverse proxying using org.restlet.routing.Redirector

2014-04-25 Thread Tim Peierls
Could this be addressed by turning off the DecoderService? There's no need to perform the decompression in the first place, is there? On Fri, Apr 25, 2014 at 8:13 AM, Arjohn Kampman arjohn.kamp...@vound-software.com wrote: Hi Jerome, others, We've figured out what is going wrong by

Re: Shutdown via REST PUT request

2014-04-23 Thread Tim Peierls
You can call Component.stop() asynchronously with a delay, so that the PUT handler has a chance to complete. (Although I think POST captures the intent better: You're POSTing a request to shut down the component.) It could be as simple as this: @Post public String postShutdown(final String

Re: Re: Re: Transparent reverse proxying using org.restlet.routing.Redirector

2014-04-18 Thread Tim Peierls
I don't have time to look at this, unfortunately. I have Basic auth working with outbound redirection. I *don't *change the way the headers are removed, but I do remove the challenge response. // From my Redirector subclass: @Override protected void outboundServerRedirect(

Re: Transparent reverse proxying using org.restlet.routing.Redirector

2014-04-17 Thread Tim Peierls
The code that does the header removal is here: https://github.com/restlet/restlet-framework-java/blob/2.2/modules/org.restlet/src/org/restlet/routing/Redirector.java#L405-L413 If you're confident that that's what you want, you can extend Redirector and override serverRedirect to do everything it

Re: Re: Transparent reverse proxying using org.restlet.routing.Redirector

2014-04-17 Thread Tim Peierls
I'm guessing you have to very selective about which headers you allow to remain. On Thu, Apr 17, 2014 at 3:08 PM, Primož Kokol primoz.ko...@gmail.comwrote: Tim, thanks for advice. That is actually one of the first things I've tried. After extending Redirector and overriding serverRedirect

Re: Re: Re: Dynamic Templates/Routing

2014-03-31 Thread Tim Peierls
Glad to hear it! Restlet isn't really doing much for you in this case, but at least this way you're in a perfect position to add new functionality or an alternative web API if the restrictions you currently operate under are ever lifted slightly. --tim On Mon, Mar 31, 2014 at 4:56 AM, Tim

Re: Re: Dynamic Templates/Routing

2014-03-28 Thread Tim Peierls
On Fri, Mar 28, 2014 at 9:48 AM, Tim t...@fathers.me.uk wrote: I'm wondering about your suggestion above, would I have to implement my own code to match the templates and extract the parameters or could I take advantage of the framework's ability to do that? You could take advantage of the

Re: Dynamic Templates/Routing

2014-03-27 Thread Tim Peierls
You don't need to use Restlet ServerResource for this. You can write a custom Restlet with an initialization method that reads and caches the mapping from path to procedure, and a handle(Request, Resource) method that extracts path and parameters from the request and uses the cached mapping to

Re: How to : use System.out or logger in Restlet

2014-03-19 Thread Tim Peierls
The code in createInboundRoot is called once at application startup, so any logging in it is only called once. It sounds like you're trying to get logging each time a request is handled. For that you need to instrument the Restlets themselves, either in their handle() methods or in more specific

Re: How to : Different validation check for different mappings but same filter

2014-03-12 Thread Tim Peierls
On Wed, Mar 12, 2014 at 3:18 AM, saurabh narayan singh cenasaur...@gmail.com wrote: I have multiple mappings in the restlet which are supposed to pass through the same filter and authenticator, but for the different mappings i have to use validationPresence(attribute) for different

Re: RESTLET - chaining a validator and filter, why does it surpasses the filter?

2014-03-11 Thread Tim Peierls
On Tue, Mar 11, 2014 at 3:29 AM, saurabh narayan singh cenasaur...@gmail.com wrote: I have a restlet in which i want to chain a validator and filter one after the other in the code. The code goes something like this @Override public synchronized Restlet createInboundRoot() { Router

Re: Re: Restlet, jackson and @JsonTypeInfo

2014-01-27 Thread Tim Peierls
What arguments are you passing to @JsonTypeInfo? On Mon, Jan 27, 2014 at 6:57 AM, Jon Finanger j...@finanger.no wrote: I'm trying to figure out how to get the android client to automatically convert the representation into the correct Objecttype without using mapper.convertValue(...) When

Re: Restlet, jackson and @JsonTypeInfo

2014-01-07 Thread Tim Peierls
One problem is that the generic type formal parameter T doesn't convey enough information for the annotation-based code to reconstruct the correct result type. Try creating a type that embeds the actual value of the type parameter, e.g., SiteDaoArrayList extends ArrayListSiteDAO (or

Re: Authenticator for multiple authentication schemes

2014-01-05 Thread Tim Peierls
stable project to the still unstable Restlet 2.2... BTW, Restlet ppl, any idea on when 2.2 will become 'final'? The roadmap page on the Restlet website states Q3 2013... and that's about 3 months ago now... Thanks. On Thu, Jan 2, 2014 at 3:32 PM, Tim Peierls t...@peierls.net wrote: Not sure

Re: Authenticator for multiple authentication schemes

2014-01-02 Thread Tim Peierls
It should be possible to chain two different Authenticator instances, with optional = true on the first, and multiAuthenticating = false on the second. If the first one succeeds, the second should see ClientInfo.isAuthenticated() == true and bypass its operation. If the first one fails, the second

Re: Authenticator for multiple authentication schemes

2014-01-02 Thread Tim Peierls
Not sure how much of this works in Restlet 2.1 -- I use CookieAuthenticator successfully with Restlet 2.2. On Thu, Jan 2, 2014 at 1:32 PM, Tim Peierls t...@peierls.net wrote: It should be possible to chain two different Authenticator instances, with optional = true on the first

Re: Restlet gets funding to accelerate APISpark growth!

2013-11-13 Thread Tim Peierls
Very exciting! On Wed, Nov 13, 2013 at 3:12 PM, Jerome Louvel jlou...@restlet.com wrote: Hi all, Finally, we can share those news: http://blog.restlet.com/2013/11/13/restlet-gets-funding-to-accelerate-apispark-growth/ From an open source point of view, this will give us extra resources

Re: Re: How to use CookieAuthenticator?

2013-07-12 Thread Tim Peierls
You can always have the Verifier treat cookies with creation times too far in the past as stale. A legitimate client will be able to provide the credentials again; an impostor with a stolen cookie won't. --tim On Fri, Jul 12, 2013 at 6:01 AM, Johanneke Lamberink jtlamber...@gmail.comwrote:

Re: Re: Re: How to use CookieAuthenticator?

2013-07-12 Thread Tim Peierls
You can override the formatCredentials and parseCredentials methods to store custom information in the (encrypted) cookie value. On Fri, Jul 12, 2013 at 9:12 AM, Johanneke Lamberink jtlamber...@gmail.comwrote: Thanks for the reply. Yes, treating old cookies as stale is what I do now. I was

Re: Re: Re: Re: How to use CookieAuthenticator?

2013-07-12 Thread Tim Peierls
On Fri, Jul 12, 2013 at 9:32 AM, Johanneke Lamberink jtlamber...@gmail.comwrote: But what would I put in there? Let's call it a sessionID, regardless of the actual content. The only way this will give the protection I need requires some sort of state on the server, doesn't it? You could

Re: Getting lot of Stream closed IOExceptions under heavy load

2013-07-08 Thread Tim Peierls
That's probably it, but also make sure that you aren't creating a new ObjectMapper for each representation. --tim On Mon, Jul 8, 2013 at 9:05 AM, Martin Odhelius modhel...@gmail.com wrote: I actually may have found what was causing this. I was using an JacksonRepresentation that used an

Re: Re: Re: Re: Dynamic Redirector

2013-04-28 Thread Tim Peierls
On Sun, Apr 28, 2013 at 11:42 AM, Grant gsing...@apache.org wrote: I haven't dug into this code, but I suspect you aren't manipulating References properly. I advise printing out the intermediate steps of your Reference computation to see where it goes wrong. That's just it, I don't think

Re: Re: Re: Re: Re: Dynamic Redirector

2013-04-28 Thread Tim Peierls
On Sun, Apr 28, 2013 at 12:58 PM, Grant gsing...@apache.org wrote: I am attaching my DynRedirector at: http://foo:port/a What's the code for this? It could be a Component level routing: VirtualHost host = component.getDefaultHost(); host.attach(/a, new DynRedirector(... args ...));

Re: Re: Dynamic Redirector

2013-04-27 Thread Tim Peierls
I don't understand what you mean by the handling of the {rr} template. The approach I suggested, overriding getTargetRef, ignores the template argument entirely. --tim On Sat, Apr 27, 2013 at 2:54 PM, Grant gsing...@apache.org wrote: Hmm, digging in on this a bit more, I'm not sure it fully

Re: Re: Re: Dynamic Redirector

2013-04-27 Thread Tim Peierls
I haven't dug into this code, but I suspect you aren't manipulating References properly. I advise printing out the intermediate steps of your Reference computation to see where it goes wrong. Also, the template argument to Redirector is ignored if you override getTargetRef. --tim On Sat, Apr

Re: Dynamic Redirector

2013-04-16 Thread Tim Peierls
Subclass Redirector, overriding getTargetRef(Request, Response) to return a Reference that you determine dynamically from the request and response parameters. --tim On Mon, Apr 15, 2013 at 10:06 PM, Grant gsing...@apache.org wrote: I have a front end API which I want to use to proxy/redirect

Re: CookieAuthenticator - Referencing to another URI after succesfull authentiaction (restlet 2.1.2)

2013-03-06 Thread Tim Peierls
It's possible that you're getting an older version of CookieAuthenticator that doesn't implement the targetUri feature. For details on how to add it yourself, see this discussion: http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3038041 On Wed, Mar 6, 2013 at 8:31 AM, Elad

Re: CookieAuthenticator - Referencing to another URI after succesfull authentiaction (restlet 2.1.2)

2013-03-06 Thread Tim Peierls
In particular, here is the commit that fixes the problem: https://github.com/restlet/restlet-framework-java/commit/e184e3586778ca3c799b456262f32bb0ac7d5706 On Wed, Mar 6, 2013 at 10:47 AM, Tim Peierls t...@peierls.net wrote: It's possible that you're getting an older version

Re: 2.2m1 which jars for json (or other formats)

2013-03-06 Thread Tim Peierls
I don't use jaxb, so my list is different. I do use the stuff in csv, smile, and xml, so I expect to need those jars. The one thing I didn't expect is the yaml jar, because I'm not using yaml directly, but it turns out that dependency is from another library. --tim On Wed, Mar 6, 2013 at 1:15

Re: Unable to setup a filter

2013-02-27 Thread Tim Peierls
Hard to tell without code. On Wed, Feb 27, 2013 at 6:16 AM, Julien Richard-Foy jul...@richard-foy.frwrote: Hi, I wrote a filter that adds some HTTP headers to all responses (using the `afterHandle` hook). The filter is created at startup (by Spring) and is put just between an

RE: Jackson extension performance question

2013-01-29 Thread Tim Peierls
You can have one ObjectMapper for all resources, and there is no need to use the Restlet Guice integration stuff. All you have to do is (somewhere) register a singleton LocalJacksonConverter with the Restlet Engine (and remove any existing JacksonConverter). See the method in my example

Re: Restlet web sites are down for maintenance

2013-01-28 Thread Tim Peierls
On Mon, Jan 28, 2013 at 9:39 AM, Jerome Louvel jlou...@restlet.com wrote: - Daisy wiki is being migrated to GitHub - we generate static HTML pages on http://restlet.org instead - easier to maintain via GitHub MarkDown files - easier to contribute via GitHub Pull Requests

Re: Restlet interfaces with generic types

2013-01-24 Thread Tim Peierls
I don't understand what you're trying to do, but the issue seems to be fixed. I've added a follow-up on the issue in GitHub. On Thu, Jan 24, 2013 at 10:06 AM, Konrad Güßbacher kgu...@mirapi.de wrote: Hi everyone, is there meanwhile a fit for this issue:

RE: Jackson extension performance question

2013-01-18 Thread Tim Peierls
It's much better to re-use a single ObjectMapper instance, or a small set of differently configured ObjectMapper instances. Here's an example of using dependency injection to provide a single ObjectMapper that is then re-used by JacksonRepresentations created by a JSON converter:

RE: Jackson extension performance question

2013-01-18 Thread Tim Peierls
Sorry, that link should be: http://tembrel.blogspot.com/2012/03/restlet-guice-extension-considered.html -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3044419

Re: Re: dependencies in 2.2-SNAPSHOT

2012-12-21 Thread Tim Peierls
Excellent, thanks! On Fri, Dec 21, 2012 at 8:58 AM, Thierry Boileau tboil...@restlet.comwrote: Hello Tim, thanks for reporting these issues. I've updated the libraries: - precised the stax2api version = 3.1.1 I've updated the servlet library - precised the available version of servlet

Re: Re: another CookieAuthenticator mystery

2012-12-21 Thread Tim Peierls
Sounds good, so if you haven't provided a login form, it more or less reverts to ChallengeAuthenticator's behavior? (Except the scheme won't be supported, so it won't actually work, but you'll have some clue as to what's going on.) --tim On Fri, Dec 21, 2012 at 11:57 AM, Thierry Boileau

Re: Re: another CookieAuthenticator mystery

2012-12-21 Thread Tim Peierls
I've fleshed this out, probably in too much detail: I have a Component made up of several cooperating Applications. There is a need for common authentication (MyAuthenticator extending CookieAuthenticator) across all applications. Rather than have each Application duplicate the login and logout

Re: Get all ServerResource objects and their routes from Applicaiton

2012-12-12 Thread Tim Peierls
Doesn't WadlApplication do something like this? On Tue, Dec 11, 2012 at 10:29 PM, Paul Morris pmor...@nmh.org wrote: I'm trying to figure out a way to at runtime get each ServerResource and its URI route from the org.restlet.Application API but can't seem to figure it out. Below is an

Re: expect/continue handshake

2012-12-12 Thread Tim Peierls
On Tue, Dec 11, 2012 at 5:21 PM, Ishaaq Chandy ish...@gmail.com wrote: Thanks for the reply Tim. That is a bit unfortunate that I can't use the annotation api for the client. I didn't say you couldn't, but you should expect to be breaking new ground if you do. The easiest way to do this

Re: expect/continue handshake

2012-12-12 Thread Tim Peierls
On Wed, Dec 12, 2012 at 11:34 AM, Tim Peierls t...@peierls.net wrote: What about the server? How do I hook into it in order to be able to either send a 100 or reject the request if it is unable to process it? I'd start here: http://www.restlet.org/documentation/2.1/jee/api/org/restlet

Re: expect/continue handshake

2012-12-12 Thread Tim Peierls
that in basic Restlet terms. --tim On Wed, Dec 12, 2012 at 2:20 PM, Tim Peierls t...@peierls.net wrote: On Wed, Dec 12, 2012 at 11:34 AM, Tim Peierls t...@peierls.net wrote: What about the server? How do I hook into it in order to be able to either send a 100 or reject the request

Re: expect/continue handshake

2012-12-11 Thread Tim Peierls
It might be easier to start by writing the client side of this using the classic Restlet APIs and not the annotation-based API, setting the Expect and Content-Length headers manually and checking the response for a 100 status. --tim On Mon, Dec 10, 2012 at 9:35 AM, Ishaaq Chandy ish...@gmail.com

Re: another CookieAuthenticator mystery

2012-12-10 Thread Tim Peierls
starting point. This is slightly brittle because of the possibility that other resources might use the redirect query name in queries, too, which would confuse this logic. Consider using a name other than the default targetUri if this worries you. --tim On Sun, Dec 9, 2012 at 4:44 PM, Tim Peierls t

Re: another CookieAuthenticator mystery

2012-12-09 Thread Tim Peierls
3, 2012 at 3:38 PM, Tim Peierls t...@peierls.net wrote: The class javadoc for CookieAuthenticator says: When the credentials are missing or stale, the challenge(Response, boolean)http://www.restlet.org/documentation/2.1/jee/ext/org/restlet/ext/crypto/CookieAuthenticator.html#challenge

dependencies in 2.2-SNAPSHOT

2012-12-03 Thread Tim Peierls
I wanted to try out 2.2-SNAPSHOT (from 2012-11-29) to see if recent changes had made CookieAuthenticator ready for prime time, but I ran into a few roadblocks: The Jackson extension lists org.codehaus.woodstox / stax2-api / 4.1.0 as a dependency in its pom, but I can't find that version anywhere.

another CookieAuthenticator mystery

2012-12-03 Thread Tim Peierls
The class javadoc for CookieAuthenticator says: When the credentials are missing or stale, the challenge(Response, boolean)http://www.restlet.org/documentation/2.1/jee/ext/org/restlet/ext/crypto/CookieAuthenticator.html#challenge(org.restlet.Response, boolean) method is invoked by the parent

Re: Re: Re: Params are null on server

2012-09-08 Thread Tim Peierls
On Fri, Sep 7, 2012 at 9:41 PM, William Ferguson william.fergu...@xandar.com.au wrote: This isn't a problem for me and I'm not trying to start some flame war over a particular implementation. I'm trying to contribute back after blowing 2 weeks trying to decipher what I would have expected to

Re: Re: Params are null on server

2012-09-07 Thread Tim Peierls
On Thu, Sep 6, 2012 at 6:13 PM, William Ferguson william.fergu...@xandar.com.au wrote: As Jerome hinted, it would be great if someone who had such expectations could think back to how those expectations arose and then offer tweaks to the docs/javadocs that would prevent others from making

Re: Re: POST and if-modified-since

2012-09-04 Thread Tim Peierls
I'm sure everyone agrees that conditional GET and PUT are essential tools. Restlet's support for these is one of the things that drew me to Restlet in the first place. But the original question was about conditional POST (if-modified-since header in POST request). What does it mean? Unless you

Re: Re: Re: POST and if-modified-since

2012-09-04 Thread Tim Peierls
On Tue, Sep 4, 2012 at 8:21 AM, Koen Maes k...@koma.be wrote: It is indeed a edge case where you have a POST and no get. By edge case, I was referring not to the practice of having POST-only resources (which isn't at all unusual) but to the presence of an If-Modified-Since header in a request

Re: maven artifact for org.restlet.ext.slf4j

2012-09-03 Thread Tim Peierls
, org.restlet.ext.slf4j.Slf4jLoggerFacade); On Sun, Sep 2, 2012 at 5:54 PM, Tim Peierls t...@peierls.net wrote: Code is here: https://github.com/restlet/restlet-framework-java/tree/master/modules/org.restlet.ext.slf4j J2EE maven artifacts here: http://maven.restlet.org/org/restlet/jee/org.restlet.ext.slf4j/ I use

Re: POST and if-modified-since

2012-09-03 Thread Tim Peierls
The getInfo(Variant) method -- or getInfo() if not using content negotiation -- is called to supply information to the conditional request handling machinery, and the default implementation is, as you observed, to do whatever GET would do, which in your case is to call the @Get handler. Override

Re: Re: error trapping with ServerResource

2012-09-02 Thread Tim Peierls
Why set the request entity rather than the response entity? On Sun, Sep 2, 2012 at 9:46 AM, Stephen More stephen.m...@gmail.com wrote: Server side code: String errorMessage = CompanyId required; org.restlet.Request r = this.getRequest(); r.setEntity( errorMessage,

Re: maven artifact for org.restlet.ext.slf4j

2012-09-02 Thread Tim Peierls
Code is here: https://github.com/restlet/restlet-framework-java/tree/master/modules/org.restlet.ext.slf4j J2EE maven artifacts here: http://maven.restlet.org/org/restlet/jee/org.restlet.ext.slf4j/ I use this in Ivy: dependency org=org.restlet.jee name=org.restlet.ext.slf4j rev=2.1-RC6 / and

Re: Re: Newbie Question -- implementing a simple say arithmetic interface

2012-08-21 Thread Tim Peierls
On Tue, Aug 21, 2012 at 2:46 PM, Bubba 42 bubba424...@gmail.com wrote: While I'm digging through this -- suppose I wanted to define the following API where (I know this is a bit RPC-ish): say I want to add number n0, n1, , nM ... I'd like to handle this via a URL scheme:

Re: Newbie Question -- implementing a simple say arithmetic interface

2012-08-20 Thread Tim Peierls
The trouble is that resource interfaces aren't general Java interfaces; they must be compatible with HTTP methods. You have two methods annotated with @Get(json), neither of which is a valid target for @Get. @Get should only annotate no-arg methods that return an object reference, @Post should

Re: Linking resources using headers?

2012-08-06 Thread Tim Peierls
The best way I know to manipulate the response object without giving up the simplicity of object-variant conversion is to override the Resource.toRepresentation method. An example of using this technique can be found in the (0-rated) first answer to this question:

Re: Parameters for annotated resources with interface?

2012-07-26 Thread Tim Peierls
Use a URI template when you attach the resource to the router router.attach(/account/{id}, AccountServerResource.class); and extract the id as an attribute in the server resource Get method implementation String idString = getRequestAttributes().get(id); if (idString == null) { ... }

Re: Re: Parameters for annotated resources with interface?

2012-07-26 Thread Tim Peierls
What I described is the only way to do it at the moment. The behavior you are looking for is not there. You could add an RFE issue, if there isn't one already. On the client side, build the URI from the same template: final Template ACCOUNT_TEMPLATE = new Template(/account/{id}); ...

Re: Unable to retrieve URI query and path from link

2012-07-25 Thread Tim Peierls
I've used the following code successfully to proxy images. Overriding getTargetRef involves more code, but it also gives you direct control over the redirection. (This code works, but I'd love to hear from experts whether there is a better way. Also, I'm not sure, but I think it interacts badly

Re: Restlet 2.1 to use jetty 8?

2012-07-22 Thread Tim Peierls
I think there's an issue for the Jackson upgrade. (I'm sure I've had a conversation with a Restlet team member about this, anyway.) --tim On Sun, Jul 22, 2012 at 1:59 PM, Tal Liron tal.li...@threecrickets.comwrote: I was about to do this myself, but thanks very much. :) :) Why not have 2.1

Re: Empty server response in 2.1 RC5

2012-07-11 Thread Tim Peierls
It should be mentioned in the migration guide, but it isn't a bug, it's a change in the method signature. --tim On Tue, Jul 10, 2012 at 10:41 PM, Robert Brewer rbre...@lava.net wrote: Ioannis Mavroukakis wrote: Hi Robert, you say most so that makes me assume some of them work. What are the

Re: Handling exceptions/errors when using Restlet for Client and Server....

2012-07-11 Thread Tim Peierls
I've updated the snippet in https://pastebin.com/3nzsjFi1 to demonstrate a potential workaround using a custom StatusService and special client-side handling. This example just deals with a StringRepresentation to pass a custom error status description, but the technique could be generalized to

Re: Handling exceptions/errors when using Restlet for Client and Server....

2012-07-11 Thread Tim Peierls
On Wed, Jul 11, 2012 at 8:04 PM, Richard Berger rich...@landisfamily.orgwrote: Do you think that this problem has persisted this long due to the lack of clients built with Restlet (vs. the much larger number of servers built with Restlet)? That's not really a fair question: You're leading

Re: Dynamic URI generation to Resource?

2012-06-30 Thread Tim Peierls
You can use the Template class to build URIs from patterns like the ones you use to attach resources to the router. To avoid having to maintain these patterns in several places, I register all the templates of an application as constants (using an enum) that I can use in attach statements and

Re: Re: Re: Restlet Method Call with multiple parameters?

2012-06-22 Thread Tim Peierls
This isn't currently supported in Restlet. You could make a feature request if you could nail down the behavior precisely. I don't see what's wrong with defining a type for a collection of entities with a location. It's a resource in your application, so having a class to represent it sounds like

Re: Restlet Method Call with multiple parameters?

2012-06-21 Thread Tim Peierls
Why do you explicitly clear the list of registered converters and explicitly add the Jackson and XML converters? On Thu, Jun 21, 2012 at 8:30 AM, Philipp E. ftw4r...@gmail.com wrote: I've been playing around with Restlet(2.1 rc5) in the last week to get an Android Client to communicate with a

Re: Re: Restlet Method Call with multiple parameters?

2012-06-21 Thread Tim Peierls
Ah, makes sense. But why would you expect to be able to send two parameters in a POST? --tim On Thu, Jun 21, 2012 at 11:32 AM, Philipp E. ftw4r...@gmail.com wrote: Hello Tim, this is a workaround for Android, information about it is available here:

Re: PathTemplates confusion

2012-06-08 Thread Tim Peierls
Default router mode is Router.MODE_FIRST_MATCH, so just move your avatar resource first. You're ruling out having a file_id of avatar, but presumably you're OK with that. --tim On Fri, Jun 8, 2012 at 2:49 PM, Rodrigo Duarte Sousa rodrigodso...@gmail.com wrote: Hi, I'm trying to implement

Re: File extensions content negotiation for POST

2012-05-05 Thread Tim Peierls
Hard to tell from this information. Are you using the application's metadata service or rolling your own code to deal with extensions? If so, does it work when you replace .tsv with ?media=tsv and .xls with ?media=xls ? Are you using annotations (@Get, @Post) or overriding standard methods

Re: Restlet in Action. Error in the listing 9.10.

2012-05-02 Thread Tim Peierls
I doubt that anyone is delaying a reply under the belief that it isn't important to you. You can't use the construction ListNews.class. (It's a limitation with Java, not Restlet.) The easiest way to work around this limitation is to make a non-generic subclass of ListNews, e.g., public class

Re: [Restlet Android] Object representation selection (application/x-java-serialized-object vs. application/json)

2012-04-25 Thread Tim Peierls
Another way to do it is to replace the built-in converter with my custom converter. See this message: http://restlet.tigris.org/ds/viewMessage.do?dsMessageId=2716118dsForumId=4447 There has been some activity regarding scoring. Here's a recent issue (which points back to an original older

Re: Content Range with Output Representation

2012-04-18 Thread Tim Peierls
Guava has a method to join a sequence of input streams into one input stream that might be useful here: http://docs.guava-libraries.googlecode.com/git-history/v12.0/javadoc/com/google/common/io/ByteStreams.html#join(java.lang.Iterable) It actually works in terms of an Iterable (or array) of

Re: Content Range with Output Representation

2012-04-18 Thread Tim Peierls
Sure, that'll work, too. However, a reason to prefer the Guava approach over SequenceInputStream is to preserve incremental iterability without having to implement tricky iteration logic: InputSupplierInputStream joinedInputs = ByteStreams.join( FluentIterable.from(urls).transform(

Re: Conditional GET doesn't properly handle content negotiation?

2012-04-12 Thread Tim Peierls
I think it's a bug. There was a change to the JacksonConverter recently in response to a similar-sounding report, but I don't know about the GwtConverter. (That JacksonConverter fix is probably in 2.1-RC4.) I remove or replace built-in converters with my own versions (that mostly override

Re: How send object from client to server

2012-04-10 Thread Tim Peierls
Does your server-side resource implement the AuthorizationResource interface? There are all sorts of things that could be going wrong besides this. I suggest that you start with the example in the Restlet wiki and adapt it to your needs. --tim On Tue, Apr 10, 2012 at 12:59 AM, Sultan Kosaev

Re: How send object from client to server

2012-04-10 Thread Tim Peierls
On Tue, Apr 10, 2012 at 9:37 AM, Sultan Kosaev s.u@mail.ru wrote: I don't understand. I modified your example on this page http://wiki.restlet.org/docs_2.1/13-restlet/21-restlet/318-restlet/303-restlet.html , but I can not send an object of Authentication class from client to server

Re: How send object from client to server

2012-04-10 Thread Tim Peierls
I'm probably misunderstanding your question, but here goes: You can't really send objects in Restlet, you can only send representations. The client resource proxy machinery makes it look as though you are sending an object by calling a method that looks like the target method on the server side,

Re: Get language code from the executing thread

2012-03-28 Thread Tim Peierls
You can -- that's what Request.getCurrent() gives you. Be careful not to over-use thread-local context, though, particularly if you use or intend to use asynchronous request handling (connectors for which are available in recent Restlet releases). I'm not sure what happens when you call

Re: Get language code from the executing thread

2012-03-27 Thread Tim Peierls
I'm assuming that by language code you mean the value of the Accepted-Languages header from the request. You can use Request.getCurrent() to get the, um, current request, from which you can retrieve the language(s). This works as long as you're in the same thread that is handling the request, or

Re: RoleAuthorizer.authorize

2012-03-25 Thread Tim Peierls
It would be tempting to think that this is related to the following bug: http://restlet.tigris.org/issues/show_bug.cgi?id=1245 But as it was fixed before 2.1-RC3 (and thus not transferred to GitHub issue tracking), I mention it only because you say you aren't sure that you're in sync

Re: Is there a way to get the response code from the annotated ClientResource?

2012-03-23 Thread Tim Peierls
On Fri, Mar 23, 2012 at 12:43 AM, Richard Berger rich...@landisfamily.orgwrote: Given code like the following... ClientResource commentClient = new ClientResource(...); CommentsResource commentsResource = commentClient.wrap(CommentsResource.class); commentsResource.postCommentForm(form);

Re: ConverterService behavior differs on GET and PUT

2012-03-21 Thread Tim Peierls
Wow, scoring converters is a delicate business! I understand a new approach is in the works, though. I replace the out-of-the-box Jackson and Freemarker converters with my own custom versions for other reasons, but a side benefit was that I can prevent scoring surprises like the one you

Converting Restlet Forms to POJOs automatically

2012-03-16 Thread Tim Peierls
I said I'd post something about this, so here it is: http://tembrel.blogspot.com/2012/03/converting-forms-in-restlet-to-pojos.html --tim -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2936800

Re: Mystery of @Post...

2012-03-15 Thread Tim Peierls
On Thu, Mar 15, 2012 at 1:00 AM, Richard Berger rich...@landisfamily.orgwrote: I am now only using the @Post(java) method to be able to use: ClientResource client4 = new ClientResource(someURL); CommentsResource commentsResource = client4.wrap(CommentsResource.class); Representation

Restlet Guice extension considered ... unnecessary

2012-03-15 Thread Tim Peierls
This is a little embarrassing: http://tembrel.blogspot.com/2012/03/restlet-guice-extension-considered.html --tim -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2936297

  1   2   3   4   >