Re: file extension changes on PUT
Thierry, This work-around is perfect for my current needs, thanks. -Matt On Nov 19, 2009, at 4:29 AM, Thierry Boileau wrote: > Hello Matt, > > the current directory is based on a mapping between extensions and media > types (see the javadoc of the method MetadataService#addCommonExtensions). > At this time, the extensions "jpe", "jpg", "jpeg" are all mapped with > the media type "MediaType.IMAGE_JPEG", with a preference for the first > one. This can be updated by calling the #addExtension(String, Metadata, > boolean) method. > This mapping does clearly not define a bijection, which leads to your > reported errors, in case the served directory contains already files > with "unpreferred" extensions such as "jpg" and "jpeg". > I've entered an issue for this: > http://restlet.tigris.org/issues/show_bug.cgi?id=953. > > Best regards, > Thierry Boileau > >> I have found some behavior that I think is incorrect when a jpeg is >> PUT to a Directory. I wrote a test server in groovy and a client in >> curl to illustrate the problem, see below. In summary, when a jpeg >> image is PUT into a Directory resource with a URL like >> http://host:port/tmp.jpg, the file extension gets changed to .jpe. A >> subsequent retrieval of the same URL does work, but directory listings >> show the "wrong" file name. Similarly, and the reason this is a >> problem for me, other programs that run on the server need to deal >> with the files with the same name that users PUT as the resource >> name. In this case, I need users to be able to overwrite a file >> called tmp.jpg that already exists in the directory. Instead, I wind >> up with two files, tmp.jpg and tmp.jpe. When the user subsequently >> request http://host:port/tmp.jpg immediately after they perform a PUT, >> they get the original image back, not the one that they just PUT to >> the system to replace the original. >> >> I suspect this might happen with other media types that have multiple >> valid extensions. >> >> I am testing against 2.0m5 for jse. I tried to test this with a >> recent checkout from svn, but building yielded some gwt errors I don't >> know how to work around. >> >> Is this a configuration problem on my end? Or could this be a bug? >> >> Thanks for your time, >> Matt >> >> //Groovy test server, I can rewrite this is java if necessary. >> import org.restlet.*; >> import org.restlet.resource.Directory; >> import org.restlet.data.Protocol; >> >> class TestDirApp extends Application >> { >> @Override >> public Restlet createInboundRoot() >> { >>def dir = new Directory(getContext(), 'file:///tmp') >>dir.modifiable = true; >>//dir.negotiateContent = false; //NB have tried this both ways >>println("Negotiating: ${dir.isNegotiateContent()}"); >>dir.listingAllowed = true; >>return dir; >> } >> } >> >> def component = new Component(); >> Server http = component.servers.add(Protocol.HTTP, 8181); >> component.clients.add(Protocol.FILE); >> Context workingCtx = http.context; >> def app = new TestDirApp(); >> component.defaultHost.attach(app); >> component.start(); >> >> >> #curl client >> curl -i --request PUT --data-binary "@tmp.jpg" --header "Content-Type: >> image/jpeg" "http://localhost:8181/tmp.jpg"; >> HTTP/1.1 201 The request has been fulfilled and resulted in a new >> resource being created >> Content-Length: 0 >> Date: Tue, 17 Nov 2009 16:23:00 GMT >> Accept-Ranges: bytes >> Server: Restlet-Framework/2.0m5 >> Connection: close >> > > -- > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2419969 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2420123
Re: POST ignored in RESTlet 2.0Mx
Hi Dustin, 303 (see other) says, that the result is at the given location, and you have to get it with GET. So the behaviour is right. Use 301 (Moved Permanently) or 307 (Temporary redirect). See http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection best regards Stephan Dustin N. Jenkins schrieb: > I'm using Java 6, Tomcat 6.0.20, RESTlet 2.0M5 on a Linux platform. > > After my business operations in my POST call, I simply call > redirectSeeOther(). When I make POST calls to the Resource now, the log > records it as a POST call, but my @Get method is being called instead. > Does the redirectSeeOther() get cached somewhere or something? Normally > I'd see a POST followed by a GET in the log. Is this a bug in the > current 2.0 tree? The snapshot is doing the same thing. > > I've used wget and browser clients just to test this. > > Thanks, > Dustin > -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2420195
POST ignored in RESTlet 2.0Mx
I'm using Java 6, Tomcat 6.0.20, RESTlet 2.0M5 on a Linux platform. After my business operations in my POST call, I simply call redirectSeeOther(). When I make POST calls to the Resource now, the log records it as a POST call, but my @Get method is being called instead. Does the redirectSeeOther() get cached somewhere or something? Normally I'd see a POST followed by a GET in the log. Is this a bug in the current 2.0 tree? The snapshot is doing the same thing. I've used wget and browser clients just to test this. Thanks, Dustin -- Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca facsimile/télécopieur: (250) 363-0045 National Research Council Canada | 5071 West Saanich Rd, Victoria BC. V9E 2E7 Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria (C.-B) V9E 2E7 Government of Canada | Gouvernement du Canada -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2420119
Re: Case-insensitive version of Series.getValuesArray(...)
Hi Arjohn, >Should the case-sensitive variant be modified to call this method? Sure! Best regards, Thierry Boileau > Wow, that was quick! Thanks for the fix. > > Should the case-sensitive variant be modified to call this method? All > case-sensitive methods except getValuesArray are implemented that way. > > Arjohn > > >> Hello Arjohn, >> >> thanks for your report, the fix is now available in the svn repository. >> >> Best regards, >> Thierry Boileau >> >> >>> Hi Jerome, >>> >>> I've finally been able to test this new method. Unfortunately, it's >>> implementation is broken. Calling Series.getValuesArray(String name, >>> boolean ignoreCase) results in a ClassCastException. Looking into the >>> code, it looks like this method is casting a array of type E (e.g. >>> Parameter) to an array of String's. >>> >>> Arjohn >>> >>> >>> Jerome Louvel wrote: >>> >>> Hi Arjohn, Good point, I've just added such method in SVN 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 : Arjohn Kampman [mailto:arjohn.kamp...@aduna-software.com] Envoyé : lundi 4 mai 2009 15:41 À : discuss@restlet.tigris.org Objet : Case-insensitive version of Series.getValuesArray(...) Hi all, I've just started working with the restlet framework, so please excuse me if I'm overlooking something. In Restlet 1.1.4 the Series class offers various utility methods for getting parameter values, often with a variant allowing you to control the case-sensitivity. This variant is missing for getValuesArray(), however, which is what I'd like to use. Can this method be added? Regards, Arjohn Kampman -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=20565 27 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2261414 >>> >> -- >> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2420017 >> > > > -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2420050
Re: logging framework for restlet
Hi Jerome, Some feedback as promised: I am now setting the system property in the class that creates and starts the Component. Routing log request works like a charm in this setup. For users the prefer a simple war-file we're also offering an alternative using the ServerServlet wrapper. I don't know yet how to reroute the logging in this case. ServerServlet works on an Application so the Engine likely already has been initialized by the time the Application class is created. It's too late to set the system property then. Any suggestions? Arjohn Arjohn Kampman wrote: > Hi Jerome, > > Many thanks. I'll have a look at this as soon as possible and let you > know the results. > > Arjohn > > Jerome Louvel wrote: >> Hi Arjohn, >> >> I finally found time to work on my latest suggestion. I've just >> checked in >> SVN trunk a new org.restlet.engine.log.LoggerFacade class which relies on >> JULI by default. >> >> There is also a new "org.restlet.ext.slf4j" extension which provides a >> Slf4jLoggerFacade acting as an optimal bridge to SLF4J API (without extra >> creation of LogRecord instances). It can be set with a system property. >> >> See updated documentation on the wiki: >> http://wiki.restlet.org/docs_2.0/13-restlet/48-restlet/101-restlet.html >> >> Let me know how it works! >> >> Best regards, >> Jerome Louvel -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2420041
Re: Case-insensitive version of Series.getValuesArray(...)
Wow, that was quick! Thanks for the fix. Should the case-sensitive variant be modified to call this method? All case-sensitive methods except getValuesArray are implemented that way. Arjohn Thierry Boileau wrote: > Hello Arjohn, > > thanks for your report, the fix is now available in the svn repository. > > Best regards, > Thierry Boileau > >> Hi Jerome, >> >> I've finally been able to test this new method. Unfortunately, it's >> implementation is broken. Calling Series.getValuesArray(String name, >> boolean ignoreCase) results in a ClassCastException. Looking into the >> code, it looks like this method is casting a array of type E (e.g. >> Parameter) to an array of String's. >> >> Arjohn >> >> >> Jerome Louvel wrote: >> >>> Hi Arjohn, >>> >>> Good point, I've just added such method in SVN 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 : Arjohn Kampman [mailto:arjohn.kamp...@aduna-software.com] >>> Envoyé : lundi 4 mai 2009 15:41 >>> À : discuss@restlet.tigris.org >>> Objet : Case-insensitive version of Series.getValuesArray(...) >>> >>> Hi all, >>> >>> I've just started working with the restlet framework, so please excuse me if >>> I'm overlooking something. In Restlet 1.1.4 the Series class offers various >>> utility methods for getting parameter values, often with a variant allowing >>> you to control the case-sensitivity. This variant is missing for >>> getValuesArray(), however, which is what I'd like to use. Can this method be >>> added? >>> >>> Regards, >>> >>> Arjohn Kampman >>> >>> -- >>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=20565 >>> 27 >>> >>> -- >>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2261414 >>> >> >> > > -- > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2420017 -- Arjohn Kampman, Senior Software Engineer Aduna - Semantic Power www.aduna-software.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2420021
Re: Case-insensitive version of Series.getValuesArray(...)
Hello Arjohn, thanks for your report, the fix is now available in the svn repository. Best regards, Thierry Boileau > Hi Jerome, > > I've finally been able to test this new method. Unfortunately, it's > implementation is broken. Calling Series.getValuesArray(String name, > boolean ignoreCase) results in a ClassCastException. Looking into the > code, it looks like this method is casting a array of type E (e.g. > Parameter) to an array of String's. > > Arjohn > > > Jerome Louvel wrote: > >> Hi Arjohn, >> >> Good point, I've just added such method in SVN 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 : Arjohn Kampman [mailto:arjohn.kamp...@aduna-software.com] >> Envoyé : lundi 4 mai 2009 15:41 >> À : discuss@restlet.tigris.org >> Objet : Case-insensitive version of Series.getValuesArray(...) >> >> Hi all, >> >> I've just started working with the restlet framework, so please excuse me if >> I'm overlooking something. In Restlet 1.1.4 the Series class offers various >> utility methods for getting parameter values, often with a variant allowing >> you to control the case-sensitivity. This variant is missing for >> getValuesArray(), however, which is what I'd like to use. Can this method be >> added? >> >> Regards, >> >> Arjohn Kampman >> >> -- >> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=20565 >> 27 >> >> -- >> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2261414 >> > > > -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2420017
Re: Case-insensitive version of Series.getValuesArray(...)
Hi Jerome, I've finally been able to test this new method. Unfortunately, it's implementation is broken. Calling Series.getValuesArray(String name, boolean ignoreCase) results in a ClassCastException. Looking into the code, it looks like this method is casting a array of type E (e.g. Parameter) to an array of String's. Arjohn Jerome Louvel wrote: > Hi Arjohn, > > Good point, I've just added such method in SVN 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 : Arjohn Kampman [mailto:arjohn.kamp...@aduna-software.com] > Envoyé : lundi 4 mai 2009 15:41 > À : discuss@restlet.tigris.org > Objet : Case-insensitive version of Series.getValuesArray(...) > > Hi all, > > I've just started working with the restlet framework, so please excuse me if > I'm overlooking something. In Restlet 1.1.4 the Series class offers various > utility methods for getting parameter values, often with a variant allowing > you to control the case-sensitivity. This variant is missing for > getValuesArray(), however, which is what I'd like to use. Can this method be > added? > > Regards, > > Arjohn Kampman > > -- > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=20565 > 27 > > -- > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2261414 -- Arjohn Kampman, Senior Software Engineer Aduna - Semantic Power www.aduna-software.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2420013
Re: Jetty integration help
Hello Martin, One way is to put the jar of the desired connector before the others in the classpath. You can also set the list of servers connectors registered on the current Engine instance: Engine.getInstance().getRegisteredServers(). In order to use the Jetty connector, instantiate the server as follow: new org.restlet.ext.jetty.HttpServerHelper(null) and add it to the list. For the Simple one, instantiate the org.restlet.ext.simple.HttpServerHelper class. You can have a look at the BaseConnectorTestCase class of the org.restlet.test module. It illustrates how to test a particular pair of client/server connectors. Best regards, Thierry Boileau > Hi, > > If for any reason (let say for comparing performances) I want to have both > Jetty and Simple on my path, how should I force the selection of one server > among all avaialble server? > > Regards, > Martin > > -- > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2419982 > > -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2419986
RE: Re: Jetty integration help
Hi, If for any reason (let say for comparing performances) I want to have both Jetty and Simple on my path, how should I force the selection of one server among all avaialble server? Regards, Martin -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2419982
Re: file extension changes on PUT
Hello Matt, the current directory is based on a mapping between extensions and media types (see the javadoc of the method MetadataService#addCommonExtensions). At this time, the extensions "jpe", "jpg", "jpeg" are all mapped with the media type "MediaType.IMAGE_JPEG", with a preference for the first one. This can be updated by calling the #addExtension(String, Metadata, boolean) method. This mapping does clearly not define a bijection, which leads to your reported errors, in case the served directory contains already files with "unpreferred" extensions such as "jpg" and "jpeg". I've entered an issue for this: http://restlet.tigris.org/issues/show_bug.cgi?id=953. Best regards, Thierry Boileau > I have found some behavior that I think is incorrect when a jpeg is > PUT to a Directory. I wrote a test server in groovy and a client in > curl to illustrate the problem, see below. In summary, when a jpeg > image is PUT into a Directory resource with a URL like > http://host:port/tmp.jpg, the file extension gets changed to .jpe. A > subsequent retrieval of the same URL does work, but directory listings > show the "wrong" file name. Similarly, and the reason this is a > problem for me, other programs that run on the server need to deal > with the files with the same name that users PUT as the resource > name. In this case, I need users to be able to overwrite a file > called tmp.jpg that already exists in the directory. Instead, I wind > up with two files, tmp.jpg and tmp.jpe. When the user subsequently > request http://host:port/tmp.jpg immediately after they perform a PUT, > they get the original image back, not the one that they just PUT to > the system to replace the original. > > I suspect this might happen with other media types that have multiple > valid extensions. > > I am testing against 2.0m5 for jse. I tried to test this with a > recent checkout from svn, but building yielded some gwt errors I don't > know how to work around. > > Is this a configuration problem on my end? Or could this be a bug? > > Thanks for your time, > Matt > > //Groovy test server, I can rewrite this is java if necessary. > import org.restlet.*; > import org.restlet.resource.Directory; > import org.restlet.data.Protocol; > > class TestDirApp extends Application > { > @Override > public Restlet createInboundRoot() > { > def dir = new Directory(getContext(), 'file:///tmp') > dir.modifiable = true; > //dir.negotiateContent = false; //NB have tried this both ways > println("Negotiating: ${dir.isNegotiateContent()}"); > dir.listingAllowed = true; > return dir; > } > } > > def component = new Component(); > Server http = component.servers.add(Protocol.HTTP, 8181); > component.clients.add(Protocol.FILE); > Context workingCtx = http.context; > def app = new TestDirApp(); > component.defaultHost.attach(app); > component.start(); > > > #curl client > curl -i --request PUT --data-binary "@tmp.jpg" --header "Content-Type: > image/jpeg" "http://localhost:8181/tmp.jpg"; > HTTP/1.1 201 The request has been fulfilled and resulted in a new > resource being created > Content-Length: 0 > Date: Tue, 17 Nov 2009 16:23:00 GMT > Accept-Ranges: bytes > Server: Restlet-Framework/2.0m5 > Connection: close > -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2419969
Re: Atom example
Hello Martin, >I am still wondering why I can't have my full entry text content displayed in >Firefox when using the Atom Extention. This sounds like a feature of Firefox. Instead of displaying the full feed, it shows the excerpt taken from the summary. >By the way, is there an RSS access to this forum, because I sometime miss >some discussion and arrive really late, whereas with a reader, nothing's missed. Each discussion group provides rss and atom feeds. Here is the list of the available groups: "http://restlet.tigris.org/ds/viewForums.do"; (especially "discuss" and "code"). Best regards, Thierry Boileau > Hi all, > Considering example I provided in the post I'm answering on, I am still > wondering why I can't have my full entry text content displayed in Firefox > when using the Atom Extention. > > The provided code is just a simplification of the mail box example provided > with restlet 1.1 > > Here is a sample atom output (also attached). > > By the way, is there an RSS access to this forum, because I sometime miss > some discussion and arrive really late, whereas with a reader, nothing's > missed. > > > > > http://www.w3.org/2005/Atom";> > > aut...@email.bla > The Glad Author > > >http://restlet.org"; version="1.1.snapshot">Atom > extension for Restlet. > >Sword Unit's Mission Report >2009-11-16T06:27:36+0100 > > > aut...@email.bla > The Glad Author > > > non operational text > entry#1 > 2009-11-16T06:27:36+0100 > non operat... > Report #8802 > > > -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2419948