Returning HTTP error 500 from the constructor of a Resource

2009-04-30 Thread Fabian Mandelbaum
Hello there, I'm starting to learn and use Restlets (1.1.x) and I have a question: I have a resource that I want to represent. For that representation I need some data stored in a DB (it's not a DB actually, but the concept is the same). So, following the pattern presented in the examples (1st

Re: Returning HTTP error 500 from the constructor of a Resource

2009-05-04 Thread Fabian Mandelbaum
Thanks! I guess this still holds true for Restlet 1.2.x, right? On Mon, May 4, 2009 at 8:41 AM, Thierry Boileau thierry.boil...@noelios.com wrote: Hello Fabian, your approach looks fine to me. best regards, Thierry Boileau Hello there, I'm starting to learn and use Restlets (1.1.x) and I

Re: Returning HTTP error 500 from the constructor of a Resource

2009-05-04 Thread Fabian Mandelbaum
OK. Thank you both for your answers! On Mon, May 4, 2009 at 11:54 AM, Thierry Boileau thierry.boil...@noelios.com wrote: Hello Fabian, the 1.2 release introduces the ServerResource class (and deprecates the Resource class). All your initialization code should be located in the doInit method

Possible bug in Restlet 1.2m2 (maybe solved in post 1.2m2?)

2009-05-25 Thread Fabian Mandelbaum
Hello, I have a resource which should only accept PUT requests (to modify its state; the resource is created with a POST to a 'parent' resource) If I implement it like this: public class MyResource extends ServerResource { @Override public void init() { // Perform initialization here

Re: Restlet 2.0 M3 released

2009-06-01 Thread Fabian Mandelbaum
Hello, please let me add that I've also noticed this application/octet-stream default behaviour, with a bit different implementation (both with 1.2m2 and with 2.0m3): @Get public Representation represent(Variant variant) throws ResourceException { // Build and return the representation

2.0m3 and content negotiation

2009-06-11 Thread Fabian Mandelbaum
Hello, what's the status of the content negotiation bug in 2.0m3? is this fixed in current snapshot? I'm still getting application/octet-stream for all media types other than xml with code like this: @Get public Representation represent() throws ResourceException { // Build and return

Accept header sent by the client not being taken into account (2.0 snapshot from July 9th, 2009)

2009-07-10 Thread Fabian Mandelbaum
Hello there, still with my content negotiation issues (which worked great and simple in restlet 1.1.x series, I've just checked the Variant's media type and acted according to its value, which just matched the client's expectations...) I've downloaded 2.0 snapshot from yesterday (July 9th, 2009)

Re: Accept header sent by the client not being taken into account (2.0 snapshot from July 9th, 2009)

2009-07-10 Thread Fabian Mandelbaum
Hello Thierry, thanks a lot for your ideas, first one worked, so I didn't event try the 2nd one. BTW, indeed I realized (after writing my mail, sorry) that I wasn't declaring the supported variants, like in Restlet 1.1.x I've opted for the first solution because in principle it should be less

Re: Wrong snapshot

2009-07-15 Thread Fabian Mandelbaum
Lars Heuer wrote: Hi Jerome, http://www.restlet.org/downloads/ delivers the wrong snapshot. When someone tries to download http://www.restlet.org/downloads/snapshot.zip a restlet-1.2-snapshot is delivered. According to the changes.txt the snapshot was created at 2009-05-16. Best regards,

Wiring restlets internally (2.0snapshot from 2009-07-09)

2009-07-15 Thread Fabian Mandelbaum
Ouf... I couldn't think of a good title for this mail (sorry). Here's the situation: I have the following URI routing (simplified resource class names for this example, both classes extend ServerResource): router.attach(/workspaces/{wksp}/releases, WRR.class);

Re: Wiring restlets internally (2.0snapshot from 2009-07-09)

2009-07-15 Thread Fabian Mandelbaum
to avoid duplicating into a separate function or class, and call it directly in both places -- but this choice may be too brittle or not possible for other reasons specific to the resources. On Wed, Jul 15, 2009 at 11:40 AM, Fabian Mandelbaum fmandelb...@gmail.com wrote: Is this the correct

Re: Wiring restlets internally (2.0snapshot from 2009-07-09)

2009-07-15 Thread Fabian Mandelbaum
-- but this choice may be too brittle or not possible for other reasons specific to the resources. On Wed, Jul 15, 2009 at 11:40 AM, Fabian Mandelbaum fmandelb...@gmail.com wrote: Is this the correct way to wire restlets internally? Is there any other (more elegant, more performant, just working, whatever

Re: Getting POST parameters out of request

2009-07-21 Thread Fabian Mandelbaum
Parameters as in URL?param1=value1param2=value2... ? If so, you need to do something like this on your resource's doInit() method: Form query = getRequest().getResourceRef().getQueryAsForm(); String value1 = query.getFirstValue(param1); String value2 = query.getFirstValue(param2); I hope to

Re: how to use Guard to protect confirmed URIs

2009-07-30 Thread Fabian Mandelbaum
For all it's worth, I've downloaded Restlet 1.1.5, coded a small test application with the following createRoot() method: @Override public synchronized Restlet createRoot() { Router router = new Router(getContext()); router.attach(/, RootFolderResource.class);

Keep fighting content issues with restlet 2.0-snapshot (from July 9th)

2009-08-05 Thread Fabian Mandelbaum
Hello there, here I am again with my content issues with restlet 2.0-snapshot (from 2009-07-09): The Content-Type header of the response is always set to */* (according to the HttpFox http traffic monitor), no matter which MediaType I pass to the representation constructor of the returned

Contributing a (small) patch

2009-08-12 Thread Fabian Mandelbaum
Hello, I have my 1st small contribution to make to Restlet, a patch to MetadataService to consider a common extension for a certain file type. Its absence was causing our application to throw a NullPointerException, for now we've 'fixed' by adding this file extension to the MetadataService at app

Patch for MetadataService to support XSL files with the more common extension .xsl

2009-08-13 Thread Fabian Mandelbaum
Hello, I've asked on this busy ML about the procedure to submit a (small) patch to MetadataService and got no answer so far. I suppose everyone is as busy as I am. So, I'm taking the liberty to post this message with the (small) patch attached. This patch was generated on MetadataService.java

Re: Patch for MetadataService to support XSL files with the more common extension .xsl

2009-08-14 Thread Fabian Mandelbaum
is described here: http://www.restlet.org/community/contribute In short, for a patch to be included, you would have to sign the JCA and get in touch with Jerome or Thierry. Best wishes, Bruno. Fabian Mandelbaum wrote: Hello, I've asked on this busy ML about the procedure to submit a (small

Re: Patch for MetadataService to support XSL files with the more common extension .xsl

2009-08-16 Thread Fabian Mandelbaum
...@manchester.ac.uk wrote: Hi Fabian, The procedure to contribute to Restlet is described here: http://www.restlet.org/community/contribute In short, for a patch to be included, you would have to sign the JCA and get in touch with Jerome or Thierry. Best wishes, Bruno. Fabian

Re: how to use Guard to protect confirmed URIs

2009-08-17 Thread Fabian Mandelbaum
- De : Fabian Mandelbaum [mailto:fmandelb...@gmail.com] Envoyé : vendredi 31 juillet 2009 01:58 À : discuss@restlet.tigris.org Objet : Re: how to use Guard to protect confirmed URIs For all it's worth, I've downloaded Restlet 1.1.5, coded a small test application with the following createRoot

Re: Keep fighting content issues with restlet 2.0-snapshot (from July 9th)

2009-08-17 Thread Fabian Mandelbaum
d'origine- De : Fabian Mandelbaum [mailto:fmandelb...@gmail.com] Envoyé : mercredi 5 août 2009 15:59 À : discuss@restlet.tigris.org Objet : Keep fighting content issues with restlet 2.0-snapshot (from July 9th) Hello there, here I am again with my content issues with restlet 2.0-snapshot

Re: Patch for MetadataService to support XSL files with the more common extension .xsl

2009-08-20 Thread Fabian Mandelbaum
trunk! Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : Fabian Mandelbaum [mailto:fmandelb...@gmail.com] Envoyé : dimanche 16 août 2009 17:23 À : discuss

Upgraded libs from 2.0M4 to 2.0M5 (JSE edition), now my app is broken

2009-09-29 Thread Fabian Mandelbaum
Hello there, I've just updated all Restlet jars used in my project from 2.0M4 to 2.0M5, made small modifs on some resources thanks to the Request/Response refactoring, and some deleted methods like ServerResource.getVariants().put(Method, ListVariant). Anyway, migrated my code to 2.0M5 in less

Re: Upgraded libs from 2.0M4 to 2.0M5 (JSE edition), now my app is broken

2009-09-29 Thread Fabian Mandelbaum
Hello Thierry, thanks for fixing this. I've changed createRoot to createInboundRoot and my code is now working fine. I'll review this (if I remember ;-)) at 2.0M6 time. I'll leave createInboundRoot because it's working as expected. De rien. cya. On Tue, Sep 29, 2009 at 11:28 AM, Thierry

Re: Retrieving Login in a resource

2009-10-19 Thread Fabian Mandelbaum
I guess he's using md5 on the client to avoid transmitting the password in clear (its md5 hash is transmitted instead). As a side effect, this approach may even remove the need for https with basic auth Maybe not the most secure idea but it would work... On Mon, Oct 19, 2009 at 8:23 AM, Jerome

Re: Retrieving Login in a resource

2009-10-19 Thread Fabian Mandelbaum
...@detailedbalance.net wrote: Hi Fabian, On Oct 19, 2009, at 6:14 AM, Fabian Mandelbaum wrote: I guess he's using md5 on the client to avoid transmitting the password in clear (its md5 hash is transmitted instead). As a side effect, this approach may even remove the need for https with basic auth

Re: Retrieving Login in a resource

2009-10-19 Thread Fabian Mandelbaum
Not harsh at all, and 100% clear. Whenever using HTTP Basic authentication, HTTPS is a need for a 'real-world' application. Thanks. On Mon, Oct 19, 2009 at 10:41 AM, Rhett Sutphin rh...@detailedbalance.net wrote: Hi Fabian, On Oct 19, 2009, at 7:28 AM, Fabian Mandelbaum wrote: Yes indeed

Re: Guard access

2009-10-19 Thread Fabian Mandelbaum
Hello Gonza, 1) I didn't try with individual users, but for groups of users, I use an AclAuthorizer (extends Authorizer), associated with the corresponding Guard, which queries an ACL (read and filled only once, from an XML file at system startup. For individual users, you may need to make this

Re: Retrieving Login in a resource

2009-10-21 Thread Fabian Mandelbaum
Laurent, you can always calculate the MD5 hash on the server side, before trying to match the password with the one read from the database. There's no need to calculate it on the client at all. On Tue, Oct 20, 2009 at 12:40 PM, Laurent Garrigues laur...@speedinfo.fr wrote: Hello Jerome, First,

Re: Enforcing HTTP accept header

2009-10-30 Thread Fabian Mandelbaum
I guess the correct syntax would be: @Put(xml) public void store(Document doc) { ... } Same goes for @Get annotation. You can get a list of supported out-of-the-box extensions here http://www.restlet.org/documentation/2.0/jse/api/org/restlet/service/MetadataService.html#addCommonExtensions()

Re: IE 8 HTML request not working

2009-12-02 Thread Fabian Mandelbaum
Yes, I have found the same behaviour, and not only with IE8, but with IE7 too. The problem seems to be that IE sends an Accept: */* HTTP header and Restlet's content negotiation logic is providing the default representation, in your case JSON (in mine XML), for the Resource. All the other major

Re: IE 8 HTML request not working

2009-12-04 Thread Fabian Mandelbaum
Hello there, I've enabled the TunnelService (Restlet 2.0M5, still didn't switch to M6) like this: public MyApp() { super(); getTunnelService().setUserAgentTunnel(true); } in the constructor of MyApp which extends Application, and IE (tested with IE7, don't know about the

Re: IE 8 HTML request not working

2009-12-04 Thread Fabian Mandelbaum
Hello Thierry, For IE8, the logs show: INFO: 2009-12-0412:43:27192.168.1.100 - - 9000 GET /workspaces - 401 312 - 14 http://192.168.1.10:9000Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2;

Resources cannot be found anymore after upgrading from 2.0M5 to 2.0M6

2009-12-12 Thread Fabian Mandelbaum
Hello there, I'm trying to upgrade restlet from 2.0M5 to 2.0M6, and found that I cannot access my resources anymore (HTTP 404 returned). The libs I've updated are: org.apache.httpclient.jar org.apache.httpcore.jar org.apache.commons.logging.jar org.restlet.ext.jaas.jar org.apache.httpmime.jar

RE: Re: Resources cannot be found anymore after upgrading from 2.0M5 to 2.0M6

2009-12-12 Thread Fabian Mandelbaum
12, 2009 at 1:19 PM, Fabian Mandelbaum fmandelb...@gmail.com wrote: Hello there, I'm trying to upgrade restlet from 2.0M5 to 2.0M6, and found that I cannot access my resources anymore (HTTP 404 returned). The libs I've updated are: org.apache.httpclient.jar org.apache.httpcore.jar

Re: Re: Resources cannot be found anymore after upgrading from 2.0M5 to 2.0M6

2009-12-13 Thread Fabian Mandelbaum
Hello Carsten, answering between lines: On Sun, Dec 13, 2009 at 4:18 AM, Carsten Lohmann c_lohm...@gmx.net wrote: Hello Fabian, which resource is supposed to match the http://localhost:9000/workspaces/W1 request? From looking at your source code, I guess that you intended this Route to

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

2010-01-16 Thread Fabian Mandelbaum
Hello there, I'm trying (fighting and learning, bah ;)) to add WebDAV support to a ServerResource. To test, I'm using the Nautilus/GNOME Connect to Server WebDAV client. I've seen that 1st an OPTIONS (HTTP) request is issued, then a PROPFIND (DAV) request is issued. My resource has options()

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

2010-01-16 Thread Fabian Mandelbaum
...@solertium.com wrote: I ran into similar trouble porting it myself, but that was many milestones ago ... Will retry with M6 and see if I get the same results as you! On Jan 16, 2010, at 8:17 AM, Fabian Mandelbaum fmandelb...@gmail.com wrote: Hello there, I'm trying (fighting and learning, bah

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

2010-01-16 Thread Fabian Mandelbaum
    - Thanks in advance On Sat, Jan 16, 2010 at 11:00 AM, Rob Heittman rob.heitt...@solertium.com wrote: I ran into similar trouble porting it myself, but that was many milestones ago ... Will retry with M6 and see if I get the same results as you! On Jan 16, 2010, at 8:17 AM, Fabian Mandelbaum

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

2010-01-16 Thread Fabian Mandelbaum
wrote: Is the workpsaces/workspaces typo below significant? On Jan 16, 2010, at 9:39 AM, Fabian Mandelbaum fmandelb...@gmail.com wrote: Hum... one more thing I've found out while testing, I've removed OPTIONS support from the RootFolderResource (serving the / URI) and now the error

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

2010-02-04 Thread Fabian Mandelbaum
Hello there, Restlet 2.0M7 included a TunnelService fix for UA 'relaxed' check (case insensitive matching), however this doesn't seem to have fixed much. Whenever IE states Accept: */* (which is the default in at least IE7 and IE8) I'm still getting the last-defined annotated representation back,

Delete temp file automatically after it's been downloaded

2010-02-08 Thread Fabian Mandelbaum
Hello there, some of my resources provide a FileRepresentation with a file to download, like this: File file = createTempFile(); Representation rep = new FileRepresentation(file, mt); Disposition disposition = new Disposition(Disposition.TYPE_ATTACHMENT); disposition.setFilename(file.getName());

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

2010-02-09 Thread Fabian Mandelbaum
Bonjour Thierry ! Ah... so the problem was somewhere else :-) My pleasure to contribute to the already excellent Restlet. Any hints on when will this fix be available? or should I try (my socio won't like it at all...) to deploy snapshot Restlet jars? On Tue, Feb 9, 2010 at 6:24 AM, Thierry

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

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

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: 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

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: 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

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: 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: 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: 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: 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

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: 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

@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: @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

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: 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: 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: 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

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: 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

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: 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: 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: 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: 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: 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: 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: 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

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

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?

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

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: 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-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: 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: 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: 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: 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: 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: 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: 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: 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: 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

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: 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

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: 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.

  1   2   >