Re: Restelt Client Internal Connector Error (1002)

2015-03-11 Thread Fabian Mandelbaum
Another possible solution with such requests, which may take LONG to process, is to have the server return HTTP 202 (Accepted) as soon as it's ready to process the request, and the client knows its request will be processed later. Of course, you may also need another server resource to query the

Re: Restlet server concurrency issue: Server handle multiple requests sequentially

2014-09-26 Thread Fabian Mandelbaum
Hello, did you try adding one of the proven production-ready HTTP server connector jars on your class-path? for example Jetty. We use Restlet with Jetty HTTP(S) server connector in production without a problem and with many concurrent clients accessing our server/services. On Fri, Sep 26, 2014

Re: Re: HTTP - HTTPS redirect

2014-09-10 Thread Fabian Mandelbaum
And I guess an external redirection/URI-rewriting with Apache is not possible either? On Wed, Sep 10, 2014 at 7:20 AM, hshorter hshor...@btisystems.com wrote: Thanks for the reply. Unfortunately I can't change the path of the application as there are previous versions we have to interop with.

Re: HTTP - HTTPS redirect

2014-09-09 Thread Fabian Mandelbaum
Quick idea, sorry if I don't put little/any code (it may not even work, trying won't hurt much hopefully...): Have your whole app below a given URI 'base' path, say: yourapp/ Make the first resource in the routing chain a Filter that will take the Reference from the Request and a) change its

Re: API World competition support

2014-07-16 Thread Fabian Mandelbaum
Damn time zones!!! Congratulations! El jul 16, 2014 4:50 AM, Jerome Louvel jlou...@restlet.com escribió: Thanks Xavier and all, it seems we are now in the first position :) Stay tuned! Jerome On Tue, Jul 15, 2014 at 12:33 PM, Xavier Méhaut xavier.meh...@free.fr wrote: done :)

Re: Re: unsupported media type

2014-07-15 Thread Fabian Mandelbaum
Usually you just: return someRepresentation; // This should automatically set status to HTTP 200 (OK) or: setStatus(Status.SUCCESS_CREATED); // Set status to HTTP 201 return someRepresentation; where someRepresentation is the representation for the response you want to return for the PUT

RE: unsupported media type

2014-07-14 Thread Fabian Mandelbaum
@Put should be enough to tell Restlet to accept anything El jul 14, 2014 1:16 PM, Frank Kolnick reallyfr...@hotmail.com escribió: I have tried sending (PUT) with a content-type of text/plain (verified via Fiddler). On the server side, I have tried: @Put(text/plain) @Put(text) @Put(plain)

Re: unsupported media type

2014-07-14 Thread Fabian Mandelbaum
Euh... I'm sorry but then the problem must be somewhere else. I use @Put all the time, handling the different media types myself, and I only got HTTP 415 when my own-written code explicitly threw ResourceException(Status.CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE). can you please try this on your

Re: Restlet API evolution - Conversion between Throwable HTTP status+body

2014-06-06 Thread Fabian Mandelbaum
. Well, a) and c) (mostly c) is what I had in mind, so we agree :-) Thanks, My pleasure. Jerome -- http://restlet.com @jlouvel http://twitter.com/#!/jlouvel On Thu, Jun 5, 2014 at 3:52 PM, Fabian Mandelbaum fmandelb...@gmail.com wrote: I like the idea. Some comments: 1

Re: Restlet API evolution - Conversion between Throwable HTTP status+body

2014-06-05 Thread Fabian Mandelbaum
I like the idea. Some comments: 1) There's some statuses that do not allow for a response body, IIRC HTTP 204. How would you handle that? Compile-time error? Other checks? 2) If for any reason, my server resource class redefines one of those exceptions, how would this be handled? I'd expect the

Re: Shutdown via REST PUT request

2014-04-23 Thread Fabian Mandelbaum
I had to do System.exit(0) too to completely finish the thing, besides shutting down Restlet components and possibly other services, else Restlet itself is shut down, but the JVM that fired the app is not. I'm using Apache's Commons Daemon to 'daemonize' the application, and in the latest

Persisting credentials to be used with HTTP Digest authentication

2014-04-12 Thread Fabian Mandelbaum
Hello, I'm trying to switch from HTTP Basic (through an HTTPS channel) to HTTP Digest (keeping the HTTPS channel) authentication. I'm currently testing without HTTPS, and I was wondering how should my 'backend' store the user credentials. Currently I'm using an MD5 hash of the password, so I

Re: Authenticator for multiple authentication schemes

2014-01-03 Thread Fabian Mandelbaum
. But before you try that, consider using CookieAuthenticatorhttp://restlet.org/learn/javadocs/2.2/jee/ext/org/restlet/ext/crypto/CookieAuthenticator.html-- much of the implementation is parameterized and/or overridable. On Thu, Jan 2, 2014 at 7:29 AM, Fabian Mandelbaum fmandelb...@gmail.comwrote

Re: Authenticator for multiple authentication schemes

2014-01-03 Thread Fabian Mandelbaum
operation. But before you try that, consider using CookieAuthenticatorhttp://restlet.org/learn/javadocs/2.2/jee/ext/org/restlet/ext/crypto/CookieAuthenticator.html-- much of the implementation is parameterized and/or overridable. On Thu, Jan 2, 2014 at 7:29 AM, Fabian Mandelbaum fmandelb

Authenticator for multiple authentication schemes

2014-01-02 Thread Fabian Mandelbaum
Hello there, our Restlet-based application needs to have users authenticated using both cookies and http basic (hopefully to be switched to digest soon) authentication (Actually it's either cookies or http auth, but see below for auth flow). We also use our own verifier storing credentials on JCR

Re: Re: Aw: RE: Batch calls?

2013-07-26 Thread Fabian Mandelbaum
Hello, what I don't understand is why you want to execute the DELETE request, can't you just delete the resource data using the data access layer of your application? Do the resources you want to delete live inside a different application? If all resources, the bulkdeleter and the ones to be

Re: Aw: RE: Batch calls?

2013-07-25 Thread Fabian Mandelbaum
Why not using a 'deleter' resource that will accept a list of resource URIs? POST /bulkdeleter [/uri/of/resource1, /uri/of/resource2, ...] Then, the handler for that resource will retrieve the data matching the URIs it got (in the above example, a simple JSON array of strings), and remove it

WebDAV method PROPFIND with Restlet's ClientResource

2013-07-22 Thread Fabian Mandelbaum
Hello, I'm (still, switch to 2.1.x is planned to be done soon) using Restlet 2.0.x I'm trying to execute WebDAV method PROPFIND with ClientResource against a Restlet ServerResource and am getting error 1001 in response. The same server with a client based on a DAV library works OK, and it also

Re: Serving static files using Directory and CLAP from a jar

2013-06-01 Thread Fabian Mandelbaum
Hello, I did not test your cases, and I always use full paths to files on my URLs for static resources inside jars, but... did you try to setup a redirector? so whenever you hit your resource at /stat or /stat/ you get redirected to /stat/index.html ? I know it's a hack, and not a fix... and it

Re: Wrong content-type with ByteArrayRepresentation

2013-03-25 Thread Fabian Mandelbaum
Hi Elad, I don't know if someone already answered this one, or if you already managed to fix this, but: Have you tried setting the correct image type, for example MediaType.IMAGE_JPEG, MediaType.IMAGE_GIF, MediaType.IMAGE_PNG, etc. Of course, this would require that you do know the image type

Re: Re: Re: Re: Location-ref not set in IE9

2013-03-02 Thread Fabian Mandelbaum
If it helps, I only use HTTP 204 response code for successful DELETE requests. For a POST I think HTTP 201 or 202 is more appropriate... but that's just the purist in me ;-) Cheers. On Thu, Feb 28, 2013 at 7:02 AM, Koen Maes k...@koma.be wrote: So it is a known issue in IE8/IE9 and supposedly

Re: mounting resources and final slash

2012-05-07 Thread Fabian Mandelbaum
Hello Daniel, you should mount (I prefer associate, but that's just me ;)) your resource, or preferably, another one, at /proxy/{some_resource_id} to be able to access resources at /proxy/resource_id_1, /proxy/resource_id_2, etc. This is because indeed /proxy/ and /proxy/anything are different

Specifying connector parameters for Jetty extension

2012-03-14 Thread Fabian Mandelbaum
Hello, in production we use the Jetty extension as the HTTP server engine. we'd like to be able to specify Jetty HTTP connector parameters, like the ones listed at http://wiki.eclipse.org/Jetty/Howto/Configure_Connectors Using restlet 2.0.x Is this possible? How? Thanks in advance. -- Fabián

Re: ClientResource.wrap Response Variants?

2011-11-22 Thread Fabian Mandelbaum
Hello. The correct way to restrict accepted media types for a client (read: in an HTTP request) is by means of the HTTP header Accept. Please take a look here: http://wiki.restlet.org/docs_2.0/130-restlet.html for Restlet mappings for HTTP headers (that page will tell you the property of which

Re: Multiple Server instances allowed without JVM_Bind error

2011-10-21 Thread Fabian Mandelbaum
Hello Paul, Java and the OS themselves should not allow you to bind to an already open port, and with Restlet 2.0.x series this is what I've seen here on my machine, a BindException thrown if I try to start my application bound to an already open port. The code to start the application is more

Re: PROPFIND response not working anymore with restlet 2.0.9, working, but with pbs with 2.0.6, was working OK with 2.0.1

2011-10-04 Thread Fabian Mandelbaum
Ok, we've found the solution to the problem. It was indeed a namespace issue, the following code excerpt works OK: public Representation propfind(Representation data) throws ResourceException { ListDavProperty reqDavProps = new ArrayListDavProperty(); if (data != null) {

Re: PROPFIND response not working anymore with restlet 2.0.9, working, but with pbs with 2.0.6, was working OK with 2.0.1

2011-09-28 Thread Fabian Mandelbaum
Hello Thierry, thanks for your answer. I forgot to tell you that I've already tried that, but in any way, I've tried differently now, by using DomRepresentation#setNamespaceAware (my test was with the W3C classes directly), and here's the result: 28/09/2011 07:50:55

PROPFIND response not working anymore with restlet 2.0.9, working, but with pbs with 2.0.6, was working OK with 2.0.1

2011-09-22 Thread Fabian Mandelbaum
Hello, I've updated restlet libs for my app to 2.0.9, and now PROPFIND (WebDAV) requests are not working anymore. Basically, a WebDAV request has (can have, but most do ;)) an XML entity body. My handler is doing this (code didn't change): @Override public Representation

Re: Method Not Allowed (405) for put and post...

2011-07-20 Thread Fabian Mandelbaum
Hello Brent, have you tried to annotate your handler with: @Put(txt) instead? On Mon, Jul 18, 2011 at 2:26 PM, Brent Cerrato brent.cerr...@s1.com wrote: My client resource looks like this:   Client client = new Client(new Context(), Protocol.HTTP);  

Re: Please HELP - I cant understand this concept

2011-06-19 Thread Fabian Mandelbaum
Usually GET requests do specify filtering parameters on the URL, that's fine and standard RESTful practice. IIRC, HTTP discourages sending an entity body with GET requests... I cannot remember right now, but it may be even disallowed. If (for example, for security reasons) you MUST avoid sending

Re: Re: Restlet 2 example using Freemarker

2011-05-30 Thread Fabian Mandelbaum
Hello Dennis, besides Thierry's suggestion, here you have the FreeMarkerUtil code: http://trac.calenco.com/browser/trunk/calenco-utils/src/main/java/com/calenco/utils/FreeMarkerUtils.java On Sun, May 29, 2011 at 4:55 PM, Dennis Lindeman denli...@ieee.org wrote: I am having a very difficult

Different deployment schemes for the same Restlet-based Application

2011-05-24 Thread Fabian Mandelbaum
Hello there, I'd like to have the same Restlet application deployed on different scenarios: 1) Standalone Java Application 2) Service/Daemon 3) Web Application Server (ex: Tomcat) contained Do I need to create three different projects? Or I just need to create three different executable sets?

Re: Adding custom HTTP methods

2011-05-22 Thread Fabian Mandelbaum
If the verbs of the HTTP standard (they are more than 4 BTW, please take a look at http://en.wikipedia.org/wiki/Http) together with the verbs of the WebDAV HTTP extension standard (take a look at http://en.wikipedia.org/wiki/Webdav) are not enough (they should be...) you can always do as

Broken Pipe with Jetty and Restlet 2.0.6 on cancelled requests

2011-05-18 Thread Fabian Mandelbaum
Hello list, I'm sorry to come back to this issue. There's a similar message by myself on the list for restlet 2.0.1: http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2683866 I've recently stumbled upon this again, and the broken pipes appear to be related to cancelled

Re: Re: Unable to get reference to XML passed in POST

2011-05-16 Thread Fabian Mandelbaum
Hello Soumik, are you 100% sure that the Content-Type (this is the correct spelling) HTTP header is set to application/xml (or any of its compatible types, for example text/xml)? You can use any of the http proxy tools out there (Charles comes to mind, but there's even addons for Firefox to

Re: Re: Re: HTTP Post in Restlet 2.0

2011-05-03 Thread Fabian Mandelbaum
You are welcomed. One thing I forgot: if you want to add an extra-level of robustness to your POST handler, you can add a check for null entities (POST 'nothing') and throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST) for example (HTTP 400), when the entity you receive is null: @Post

Re: Problem when accessing website with Java using HTTPS (not trusted certificate)

2011-05-03 Thread Fabian Mandelbaum
Hello Thierry, you may want to have a look at this http://blogs.sun.com/andreas/entry/no_more_unable_to_find Enjoy your reading On Tue, May 3, 2011 at 1:59 PM, Thierry Templier thierry.templ...@noelios.com wrote: Hello, I try to access a site using HTTP from a Restlet application. Since the

Re: HTTP Post in Restlet 2.0

2011-04-29 Thread Fabian Mandelbaum
Hello, in your ServerResource: getRequestAttributes().get(PARAM_NAME_HERE); On Fri, Apr 29, 2011 at 4:07 AM, aquestion10 archana.suleb...@proximic.com wrote: I have a simple html form with method = post and action=/myrestlet.The form has name and description textfields. I would like to read

Re: fine grained authorization

2011-04-16 Thread Fabian Mandelbaum
Till I figure out role stuff, I'm doing it myself, without relying on Restlet APIs. I have a base ServerResource class performing the security checks against storage (JCR in my case, but the concept is the same, applicable to any storage backend: DB, files, whatever), and all guarded resources

Examples of Tanuki wrapper usage with a Restlet application

2011-03-31 Thread Fabian Mandelbaum
Hello, I'd like to know if there's some examples (and where are them, of course) on using Tanuki's wrapper to 'control' (startup, shutdown) a Restlet application. I'm currently using a 'main' class which sets my Application instance, starts needed services, and starts the Application, together

Re: Re: HTTPS Server set up error at runtime

2011-03-22 Thread Fabian Mandelbaum
I don't know about explicit jars needed to support HTTPS (or SSL). In the libs/readme.txt file of the Restlet distribution you can find the dependencies list for all the distributed jars, plus the following statement at the beginning of that file: Below is a list of the dependencies between

Re: Different @Post: xml, json and java String

2011-03-22 Thread Fabian Mandelbaum
Hello Daniele, @Post(txt) should accept strings. Test it though ;-) On Tue, Mar 22, 2011 at 1:07 PM, Daniele Dellafiore ilde...@gmail.com wrote: Hi. I built a server resource with a    @Post    public void request(final String email) { } that works great with the restlet client.

Re: VelocityTemplate - Restlet 2.0 Question...

2011-03-19 Thread Fabian Mandelbaum
Hello Sandep, for some of my representations I use FreeMarker as the template engine. FreeMarker does automatic caching of the templates, probably Velocity has a similar feature. In any way, what I do is to use a single(ton) FreeMarkerUtils class that is the one loading the templates, and the

Re: Noob Question

2011-02-18 Thread Fabian Mandelbaum
Hello Jason, If the URI template has the name 'identifier', why does your ServerResource ask for 'name' instead?     String userId = (String) getRequest().getAttributes().get(name); That line should be: String userId = (String) getRequest().getAttributes().get(identifier); instead.

Re: Re: Is Multiple Get and Put annotations Possible?

2011-02-17 Thread Fabian Mandelbaum
Hello Hetal, you'd rather use two different resource classes here, because usually, in RESTful design, a collection of X is a different resource than X itself. So in your example, you can have the following resources/URI templates/server resource classes: A car: /cars/{car}, CarServerResource A

Re: RouteList.add() doesn't accept TemplateRoute, only the now deprecated Route

2011-02-09 Thread Fabian Mandelbaum
Hello Thierry, thanks a lot for your (as usual) prompt and accurate answer. I guess I can live with this small nuance until 2.1 is rock-solid and ready to become the new stable branch. My pleasure to be of help. a bientot. On Wed, Feb 9, 2011 at 8:40 AM, Thierry Boileau

RouteList.add() doesn't accept TemplateRoute, only the now deprecated Route

2011-02-08 Thread Fabian Mandelbaum
Hello there, I'm using Restlet 2.0.4 JSE, and am trying to modify my application routes dynamically, according to the presence or not of classes in the classpath (if an extension class is present, then I need that class to handle a given route, instead of the 'base' class). While on this quest,

Re: Re: Re: Re: Re: Need help understanding the correct FLOW

2011-02-02 Thread Fabian Mandelbaum
Good to hear that :-) Good luck with the rest of your project Randy! On Wed, Feb 2, 2011 at 3:30 PM, Randy Paries rtpar...@gmail.com wrote: Fabian thanks alot for all your help I now have that working. -- Fabián Mandelbaum IS Engineer

Re: Re: Re: Re: Need help understanding the correct FLOW

2011-02-01 Thread Fabian Mandelbaum
Hello Randy. Even with HTTP Basic auth the provided credentials (user+pass) are encoded. They are not transmitted like this on the wire: user=the_user password=the_password but, rather, like this, in a standard HTTP header: Authorization Basic YWRtaW5AY2FsZW5jby5jb206MTExMTEx That YW...MTEx

Re: Re: Re: Need help understanding the correct FLOW

2011-01-29 Thread Fabian Mandelbaum
Hello Randy, you usually know the hash function to encrypt the secret to persist in encrypted in the DB. So, you just need to get the secret from the request, apply that hash/encryption function, and compare it with the already encrypted value you read from the DB, in the Verifier's verify()

Re: Re: Need help understanding the correct FLOW

2011-01-27 Thread Fabian Mandelbaum
Hello Randy, indeed your custom Verifier will have to query the DB on each request to, well, verify, the provided credentials are valid. You can also build an in-memory (provided the passwords are stored on the DB already encrypted, to tighten security a bit) credentials 'cache' which is

Re: Need help understanding the correct FLOW

2011-01-23 Thread Fabian Mandelbaum
Hello Randy, 'login' is always a hot topic on RESTful applications. The Restlet flow you mention is basically this: Client --- Request -- Guard -- Protected Server Resource it's the Guard (usually org.restlet.security.ChallengeAuthenticator) the one that authenticates the user, making sure the

Re: Re: What is best way for ServerResource to get DB connection?

2011-01-02 Thread Fabian Mandelbaum
You are welcomed Anthony. Here you have some 'general' singleton coding that works 'everywhere' in Java: public class MySingleton { private static class MySingletonHolder { private static final MySingleton INSTANCE = new MySingleton(); } private MySingleton() { // You'll do all

Re: What is best way for ServerResource to get DB connection?

2011-01-01 Thread Fabian Mandelbaum
Hello Anthony, I use a single(ton) SessionManager of sorts which 'serves' the connections when asked, something like: DBSessionManager.getInstance().getSessionRO(); DBSessionManager.getInstance().getSessionRW(); and of course, the corresponding:

Re: DomRepresentation.getNode(someXpath) returns null

2010-12-30 Thread Fabian Mandelbaum
Hello, the post did come twice :-) It's possible that if you print stuff (read: use the stream) from the representation you get in the request body, for example for debug purposes, you'll loose the representation itself (you've already consumed it), so any method accessing it may return null.

Re: how to reuse ServerResource to store multiple resource and retrieve it?

2010-12-20 Thread Fabian Mandelbaum
You have to use URI templates for the routes, for example: router.attach(/contact/{id}, ContactServerResource.class); and in ContactServerResource you do something like this: String contactID = (String)getRequestAttributes().get(id); On Mon, Dec 20, 2010 at 1:32 AM, webp...@tigris.org wrote:

Re: Proper handling of / at the end of the requested URI

2010-12-16 Thread Fabian Mandelbaum
(or some other template pattern / regex way of achieving the same thing).  In general though, we think that a resource should generally only have one canonical path, and so serving it out at two similar paths is less desirable. Hope this helps, -Dave Fogel On Thu, Dec 9, 2010 at 12:54 PM, Fabian

Re: Maven indices not properly updated?

2010-12-14 Thread Fabian Mandelbaum
Hello Thierry, I've just sent it to you in a private message. Thank you. On Tue, Dec 14, 2010 at 12:46 PM, Thierry Boileau thierry.boil...@noelios.com wrote: Hello Fabian, could you send me your sample project, and log files? best regards, Thierry Boileau

Re: Proper handling of / at the end of the requested URI

2010-12-09 Thread Fabian Mandelbaum
similar paths is less desirable. Hope this helps, -Dave Fogel On Thu, Dec 9, 2010 at 12:54 PM, Fabian Mandelbaum fmandelb...@gmail.com wrote: Hello there, sorry if this has been asked a zillion times (kindly point me to the relevant answers if so) already. Whenever a WebDAV request

Re: ClientInfo.getPreferredMediaType and Internet Explorer

2010-11-30 Thread Fabian Mandelbaum
Oh, one more I forgot: Setup the tunnel service on your Application class for IE, like this for example: public class YourApplication extends Application { public YourApplication() { getTunnelService().setUserAgentTunnel(true); // To handle IE requests properly } } 2010/11/30 Fabián

Broken Pipe with Jetty and Restlet 2.0.1

2010-11-20 Thread Fabian Mandelbaum
Hello, from time to time, and apparently at random, we get this exception when performing a GET. All seems to work fine, but this is annoying and worrysome, to say the least. In due time, we'll switch to Restlet 2.0.3, but this has been showing up since we've used 2.0.x with Jetty. Any ideas?

Adding sessions to a REST(let) application

2010-11-19 Thread Fabian Mandelbaum
Hello there, We're currently facing a dillema with our REST application. Since we sell accounts for this application, we'd need a way to limit the concurrent number of users using an account. It happens that we sell one account and have many users use the authentication credentials of that

Re: Adding sessions to a REST(let) application

2010-11-19 Thread Fabian Mandelbaum
Hello Stephan, thanks for your answers, more questions between lines: On Fri, Nov 19, 2010 at 2:13 PM, Stephan Koops stephan.ko...@web.de wrote: Hi Fabian, We thought about having the client send a cookie (I'm cookie-ignorant) with each request, and have the resources check that cookie, which

Re: how to get String with space inside

2010-10-28 Thread Fabian Mandelbaum
Hello Nicho, you can use Reference.decode(String) to get the proper value without URL encoding chars in it. On Thu, Oct 28, 2010 at 10:53 AM, webp...@tigris.org wrote: I am trying to transfer a String with space character inside to server, but server side can not retrieve it properly. for

Re: Freemarkers templates loading

2010-10-22 Thread Fabian Mandelbaum
Hello David, why not packing all the FreeMarker templates inside a jar and deploy that jar on your app's classpath? You can then do something like this: Configuration fmConfig = new Configuration(); fmConfig.setTemplateLoader(new ClassTemplateLoader(getClass(),

Re: How to add header for http request

2010-10-22 Thread Fabian Mandelbaum
Hello KC, for standard HTTP headers, take a look at http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet/324-restlet/130-restlet.html for custom HTTP headers, you can use something like: /** * Set the value of a custom HTTP header * * @param header the custom HTTP header

Re: Re: get from browsers

2010-10-14 Thread Fabian Mandelbaum
Hello Shawn, glad to hear it worked. As for the explanation. Check the javadocs and the sources for the TunnelService stuff while keeping in mind the explanation I gave on my 1st answer. You can think of this setting like an Restlet internal rewriting of 'bad' HTTP headers for lazy/badly

Re: get from browsers

2010-10-13 Thread Fabian Mandelbaum
IE (all versions from IE6 to IE8 IIRC, not 100% sure about IE6), send the Accept: */* HTTP header, meaning basically that it will accept any format for the representation of the resource (even if it's a WEB browser, supposed to get mostly HTML pages). This sometimes triggers 'funny' or unexpected

Re: Content-Disposition

2010-10-09 Thread Fabian Mandelbaum
Hello, as for the Save as Dialog, you should do something like this: Disposition attachment = new Disposition(Disposition.TYPE_ATTACHMENT); attachment.setFilename(the file name here); representation.setDisposition(attachment); return representation; This will set the proper HTTP headers so the

Re: Re: Re: Re: PROPFIND doesn't work anymore after the switch from 2.0RC4 to 2.0.0

2010-10-04 Thread Fabian Mandelbaum
Hello Thierry, sadly I have to refloat this bug on Restlet 2.0.1. I'm using Restlet 2.0.1 SE and PROPFIND is not handled anymore. I've switched libs back to 2.0.0 ones (which have other problems, so I cannot use 'em as a 'fix') and PROPFIND is handled properly. I switch back to 2.0.1 libs and

Re: restlet

2010-09-24 Thread Fabian Mandelbaum
Hello, you can use something like this, assuming a POST request: @Post @Override public Representation post(Representation entity) throws ResourceException { if (entity.isCompatible(new Variant(MediaType.APPLICATION_XML)) || entity.isCompatible(new Variant(MediaType.TEXT_XML))) { final

Re: Restlet Framework 2.0.1released

2010-09-13 Thread Fabian Mandelbaum
Maybe this was triggered by the fix for my suggestion to actually include the 'description (error message) in the HTML default representation when ResourceException was thrown? On Thu, Sep 9, 2010 at 11:24 AM, Tal Liron tal.li...@threecrickets.com wrote: Just a quick note on changed behavior I

Re: Re: Re: Re: PROPFIND doesn't work anymore after the switch from 2.0RC4 to 2.0.0

2010-09-08 Thread Fabian Mandelbaum
Hello Thierry, Thanks for your answers. Is there a simple way on Restlet's side to enforce us, lazy developers, to pass such params (actually a Representation class) on annotated method handlers? What happens if I use the signature you propose with DomRepresentation as the entity parameter to

ResourceException description not present anywhere in 'default' HTML representation output

2010-09-07 Thread Fabian Mandelbaum
Hello list, I have a ServerResource that checks parameters in @Post/@Get/@WhateverMethod and does the following if required parameters are not set: throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, Required parameter XXX is missing or empty); This works fine, gives me the HTTP 400...

Re: Re: Re: PROPFIND doesn't work anymore after the switch from 2.0RC4 to 2.0.0

2010-09-01 Thread Fabian Mandelbaum
Bonsoir Thierry, no problem for answering late, I know it's holidays time over there (hope you enjoyed yours, if any). I tried with the proposed change and PROPFIND is properly handled now, it works. I've also added a debug log output like this (I had to use reqRep instead of rep as the param

Re: Use of ClientResource inside a server resource

2010-08-25 Thread Fabian Mandelbaum
Hello Xavier, yes, you can, there shouldn't be any problems with this, at least AFAIK. On Tue, Aug 24, 2010 at 6:09 AM, Xavier M. xavier.meh...@gmail.com wrote: Hello, I would like to know if we can use a ClientResource call inside a server resource, and if not, how to do this properly?

Re: Use of ClientResource inside a server resource

2010-08-25 Thread Fabian Mandelbaum
getClients().addProtocol(Protocol.HTTP) on the server side ... thanks regards Xavier 2010/8/25 Fabian Mandelbaum fmandelb...@gmail.com Hello Xavier, yes, you can, there shouldn't be any problems with this, at least AFAIK. On Tue, Aug 24, 2010 at 6:09 AM, Xavier M. xavier.meh...@gmail.com wrote

Re: Re: PROPFIND doesn't work anymore after the switch from 2.0RC4 to 2.0.0

2010-08-04 Thread Fabian Mandelbaum
Hello Thierry, I've made two tests, one with the following signature: @Propfind public Representation propfind(Variant variant) throws ResourceException It behaved like the original version, that is HTTP 405 (Method Not Allowed). The following test was with the signature you proposed, and now

Re: PROPFIND doesn't work anymore after the switch from 2.0RC4 to 2.0.0

2010-08-03 Thread Fabian Mandelbaum
Hello Thierry, the signature of the PROPFIND handler is this: @Propfind public Representation propfind() throws ResourceException I don't remember if I've tried (I'll do it later and inform here) with @Propfind public Representation propfind(Variant variant) throws ResourceException

Re: @Head annotation

2010-07-09 Thread Fabian Mandelbaum
have to set the entity headers, also in HEAD. best regards   Stephan Fabian Mandelbaum schrieb: Hello there, why doesn't Reslet (at least as of V2.0RC4) have an @Head annotation to handle HEAD requests? Currently HEAD requests are being handled by GET handlers (at least that's what's

@Head annotation

2010-07-08 Thread Fabian Mandelbaum
Hello there, why doesn't Reslet (at least as of V2.0RC4) have an @Head annotation to handle HEAD requests? Currently HEAD requests are being handled by GET handlers (at least that's what's happening with my annotated resources). Why is this so? Is there any reason why there's no @Head

Re: interface with two @get methods

2010-06-27 Thread Fabian Mandelbaum
Hello there, You are not modelling your resources in a correct way. I see two resources, minimum: ContactsResource (the list of all contacts) ContactResource (a given contact) ContactsResource is the one that will call ContactDao's findAll() ContactResource is the one that will call the other

Switching from internal HTTP connector to Jetty

2010-06-14 Thread Fabian Mandelbaum
Hello there, I'm using Restlet 2.0RC4 and I was wondering if to switch from internal HTTP connector to Jetty I'd just have to copy all jars inside the lib/org.eclipse.jetty_7.0 folder and the org.restlet.jetty.jar into my classpath lib, et voilà ! Thanks in advance for your prompt answer --

Re: Switching from internal HTTP connector to Jetty

2010-06-14 Thread Fabian Mandelbaum
Hello Laurent, yes, you did. Sorry for asking before reading... mea culpa on a slow, raining, fall Monday morning in Buenos Aires ;-) Thanks. On Mon, Jun 14, 2010 at 9:50 AM, Laurent Rustuel laurent.rust...@genesyslab.com wrote: Hello, Le 14/06/2010 14:23, Fabian Mandelbaum a écrit : Hello

Re: Restlet Framework 2.1 roadmap

2010-06-10 Thread Fabian Mandelbaum
Hello everyone, can I add WebDAV support? I've done some WebDAV work, and realized it may not be so simple to generalize the thing enough to make it part of Restlet. I'm willing to contribute my code, but it has lots of stuff specific to my system. Maybe we could work together on the

Re: Which tool to use to see request/responses ?

2010-05-28 Thread Fabian Mandelbaum
One such tool, which is made in Java, and it's not so expensive (USD 50 or so IIRC), is Charles Web Proxy. http://www.charlesproxy.com/ There's also the HTTPFox addon for Firefox, which is good enough if your client side is a web browser (which is not your case, but anyway...) I'm sure there's

Re: uri reorg question

2010-05-10 Thread Fabian Mandelbaum
Hello, I think you can make a simple ContentResource handling the following patterns: /{fileOrFolder} /{folder}/{file} which just tries to get those files (the ones coming out of the above URI patterns) and: stream the file back if they are present, return 404 plus an empty representation or a

Re: uri reorg question

2010-05-10 Thread Fabian Mandelbaum
Hello Peg, there is a way you can handle 'arbitrary' paths with a single rule match... (that is, to handle the / inside the variable's values), someone asked about this on this list not long ago IIRC... You are welcomed. Good luck! On Mon, May 10, 2010 at 10:01 AM, pegpeg gig...@yahoo.fr wrote:

Re: Re: FileUpload extension: multipart/form-data support broken in RC1/RC2

2010-04-07 Thread Fabian Mandelbaum
Ditto. On Tue, Apr 6, 2010 at 3:56 PM, TKM t...@jamfsoftware.com wrote: The snapshot with the revised file upload works nicely on my system.  thx for the fix. -- View this message in context:

Re: FileUpload extension: multipart/form-data support broken in RC1/RC2

2010-04-06 Thread Fabian Mandelbaum
Hello there, starting to break silence on my part a bit :-) When can I expect a snapshot build with this fix? Thanks in advance... On Tue, Apr 6, 2010 at 6:21 AM, Thierry Boileau thierry.boil...@noelios.com wrote: Hello Carsten, Thanks a lot for your report. The fix is available in the svn

Re: Re: FileUpload extension: multipart/form-data support broken in RC1/RC2

2010-04-06 Thread Fabian Mandelbaum
Thanks a lot! Testing my system with it :-) On Tue, Apr 6, 2010 at 11:52 AM, Thierry Boileau thierry.boil...@noelios.com wrote: Hello Fabian, after fixing some test cases, I've just updated the snapshot available from the download page: http://www.restlet.org/downloads/unstable Best

Re: How to invoke @GET method from client side

2010-03-12 Thread Fabian Mandelbaum
Hello Bhallamudi, For this magic to work, your client needs to include the HTTP header Accept in its requests to this resource. For example: GET /path/to/your/resource Accept: text/xml will invoke the method annotated with @Get(xml), while GET /path/to/your/resource Accept: application/json

Reliabily decoding different clients resource reference (different) URIs

2010-03-10 Thread Fabian Mandelbaum
Hello there, I'm having some problems (Restlet 2.0snapshot from mid-February 2010) with resource references encoding. Concretely, my app supports DAV access to some resources, I'm currently testing with XXE (an XML editor with a dav plugin) and with Microsoft XP's 'web folders' (dav-enabled

Re: Downloading Audio file using Restlet

2010-03-03 Thread Fabian Mandelbaum
Hello, to download any file (not just audio), what I do is something along the following lines (Restlet 2.0snapshot): Representation getFile() throws Exception { File theFileToDownload = retrieveFile(); // This can be a temp file, a file gotten from the filesystem, from DB, ... MediaType mt

Re: Downloading Audio file using Restlet

2010-03-03 Thread Fabian Mandelbaum
Ah, forgot to tell: this code is on the server side. I don't use Restlet for client-side code (yet ;)) 2010/3/3 Fabián Mandelbaum fmandelb...@gmail.com: Hello, to download any file (not just audio), what I do is something along the following lines (Restlet 2.0snapshot): -- Fabián

Redirected resources URIs

2010-02-22 Thread Fabian Mandelbaum
Hello there, one of the elements needed in a WebDAV response for the PROPFIND method is the href (full URI) of the resource in question. For example: d:hrefhttp://host:port/path/to/the/resource/d:href Now, if my Restlet application is 'behind' an URL redirect engine, for example Apache's

Re: Redirected resources URIs

2010-02-22 Thread Fabian Mandelbaum
Hello Thierry, I've just found again the Mapping HTTP semantics page and was reading it :-) The idea is to try to get the original host:port requested by the client, and if the redirection engine is before the Restlet application, the HTTP Host header for requests hitting the Restlet app are

Handling HEAD requests

2010-02-22 Thread Fabian Mandelbaum
Hello there, I've noticed (Restlet 2.0snapshot from 2010-02-19 IIRC) that there's no @Head annotation to handle HEAD requests. The method annotated with @Get is handling HEAD also. A priori this makes some sense because one expects to get the same answer for HEAD and GET, except that HEAD has

Re: handlePropfind() not being called when PROPFIND request is received (to add WebDAV support to a ServerResource)

2010-02-17 Thread Fabian Mandelbaum
Technologies ~ http://www.noelios.com -Message d'origine- De : Fabian Mandelbaum [mailto:fmandelb...@gmail.com] Envoyé : samedi 16 janvier 2010 15:52 À : discuss@restlet.tigris.org Objet : Re: handlePropfind() not being called when PROPFIND request is received (to add WebDAV support

Re: M7 and TunnelService fix still not working for IE7/8 (or so it seems)

2010-02-10 Thread Fabian Mandelbaum
Bonjour Thierry ! I've got the snapshot, deployed it, and still got problems. Let me explain: I get the HTML representation now, however there's a small catch. The HTML page contains AJAX code that makes some requests in the background to build parts of the page. One of such requests states

  1   2   >