If I am implementing:
public void acceptRepresentation( Representation rep ) {
// ...
}
Is using that rep exactly the same as if I had instead done:
Representation rep1 = getRequest().getEntity();
? Is the rep being passed to acceptRepresentation() just
I have a bit of code that processes a multipart/form-data form. I'm
sending a test request using curl, e.g.:
curl -v -F from=paul%40lucasmail.org http://localhost:8182/foo;
I have code that parses the form that starts off with:
final MediaType mediaType =
I've been seeing a lot of:
ERROR: 'Broken pipe'
Exception intercepted @ HttpServerConverter.commit
lately. What exactly does it mean? How can I print out the
exception? And possible how to debug this?
I'm using Restlet 1.0.9.
- Paul
On Aug 13, 2008, at 9:53 AM, Jerome Louvel wrote:
If the socket is broken or was closed by the client while the
response is
written, you won't be able to restore it. However, you can log the
fact
the you got this request from this client and wait for the client to
retry
its request.
OK,
On Aug 13, 2008, at 10:26 AM, Jerome Louvel wrote:
The closest you'll find in the Restlet API is the
org.restlet.service.ConnectorService class that has two callback
methods:
- beforeSend(Representation entity)
- afterSend(Representation entity)
Maybe we could introduce a new call-back
Suppose I have a service that takes some time to compute the response
to. Further suppose that a client connects but then disconnects
prematurely for whatever reason either before I start or while I am
returning a response. Is there any way to know if the client is
really still there
I wanted a simple way to get the values of request parameters into an
Object. I've implemented a DTO (Data Transfer Object) class that can
be used for this.
Suppose you want to implement a query request. You could do something
like:
public class QueryDTO extends DTO {
On Jul 4, 2008, at 3:57 AM, Jerome Louvel wrote:
What do you mean by launching 1/10 times?
I mean that the problem only manifests immediately after launch (if it
manifests at all). The problem never manifests if the software has
been running OK for a while (meaning it has been servicing
On Mar 23, 2008, at 10:50 AM, Jerome Louvel wrote:
Paul, the Series class address the lack of a structure maintaining a
list of
named entries. There is no reusable Parameter class (name, value
pair) in
the JDK. Only the Map.EntryK,V interface comes close to it. Having
just a
ListParameter
On Mar 22, 2008, at 4:21 AM, Stephan Koops wrote:
is it necessary to use the legacy datatype array?
Since when is an array a legacy datatype? (If this were C++ instead
of Java, that question would have more merit.)
I think never the Series deals with arrays. What about returning
On Mar 22, 2008, at 11:16 AM, Stephan Koops wrote:
Since we have java.util.List. Ok, sometime it is useful to ue
arrays, but IMO in the most cases the list is the better solution.
Typically you collect the result in a List, because you don't know
the result size. Than you perhaps convert
Sorry if this is a duplicate, but I never say my original message echo
to the list.
Begin forwarded message:
Date: March 19, 2008 4:19:32 PM PDT
To: discuss@restlet.tigris.org
Subject: Series.getValues()
This method, as written in Restlet 1.0.8, specifically this variant:
On Mar 10, 2008, at 1:45 AM, Thierry Boileau wrote:
I've tested this code below with both Restlet 1.1 (snapshot) and
Restlet 1.0.8 and it works.
Could you tell us more about your code?
I have my own classes derived from Directory and DirectoryResource. I
override
Does anybody use Restlet under Windows? I want my server's root URI
to be a directory like:
C:\Documents and Settings\pjl\My Documents\My Pictures\
That's held in a File variable. I convert that to a URI then to a
String like:
String rootURI = rootDir.toURI().toString();
On Mar 7, 2008, at 5:12 PM, cleverpig wrote:
public Restlet createRoot(){
final String
DIR_ROOT_URI=file:///E:/eclipse3.1RC3/workspace/RestletPractice/static_files/
;
Yes, I already know how to do the code. That's not my question. The
differences between your
Is there a guideline when one should extend Restlet vs. extens
Resource? My rationalization is that: if X represents some kind of
physical resource, the one should extend Resource; if X represents
some kind of service, e.g., a search service, then one should
extend Restlet.
Opinions?
-
I would like to be able to have code like:
try {
// ...
}
catch ( SomeException e ) {
response.setStatus( CLIENT_ERROR_BAD_REQUEST, e );
}
That is that you can pass a Throwable to setStatus() and that the
Status class have the additional
OK, fine: then simply add a constructor that takes a Throwable as
well as a getThrown() method. Status can stay immutable.
- Paul
On Jan 26, 2008, at 1:06 PM, Stephan Koops wrote:
Hello Paul,
if I understood you right, than you want to add method to the class
Status to save the
On Jan 21, 2008, at 1:32 PM, Jerome Louvel wrote:
1. How do I turn directory redirection off? Specifically, if the
request refers to a directory and the URI doesn't end in '/', it's
OK for the server to add the '/' internally for processing, but I
don't want it to issue a 303 response.
So I create a Router, create some Directory instances with a given
rootURI, and attach them to the router.
At some later time, I want to change what the rootURI is globally
while the server is running. In Directory, rootRef is private and
there's no setRootRef() method. Why not?
Also, it seems that isSuccess() is wrong. In reading RFC 2616, 1xx
and 3xx codes are not errors, so they should be considered success
codes, no?
- Paul
On Jan 16, 2008, at 10:09 AM, Paul J. Lucas wrote:
What if I want to make up my own Status codes? The isSuccess() and
is*Error
Sorry for not commenting earlier, but
Anyway, in thinking about this more, I don't think a filter should
have any knowledge of its next filter. When a request is received,
the engine should have a list of filters, i.e., the list itself
should be external to all the filters.
So,
Well, I just tried calling System.exit(0) and nothing happens: the
process doesn't exit. FYI: I'm using the Simple HTTP server. There
are a bunch of threads stuck in wait().
How can I shutdown the server and cause the process to exit?
- Paul
On Jan 9, 2008, at 11:43 PM, Paul J. Lucas
Well, if you want to post-process a request in error, you need to
distinguish that case from the case where you don't want to post-
process in error.
Another problem is that the current doHandle() calls next.handle()
and that doesn't return a boolean to indicate whether to do post-
gracefully?
- Paul
On Jan 10, 2008, at 5:31 AM, Kevin Conaway wrote:
Bug the Simple developers. I am absolutely astonished that they
don't provide a clean way to shut down their server.
On Jan 10, 2008 2:59 AM, Paul J. Lucas [EMAIL PROTECTED] wrote:
Well, I just tried calling System.exit
By the way, in the doHandle() method, if there isn't a next Restlet,
the method sets the response to CLIENT_ERROR_NOT_FOUND. Shouldn't
that be SERVER_ERROR_INTERNAL because the programmer goofed by not
setting a next Restlet?
- Paul
If I write my own filter and use its beforeHandler(), I would like,
upon some catastrophe, to abort the entire request and return some
client error code.
Unfortunately, it doesn't appear that the API for Filter allows
aborting a request. True?
This is another good case for using
When I start my server, I have:
component = new Component();
// ...
component.start();
To shutdown a server, I assume I do:
component.stop();
However, the process doesn't stop. Should I then simply do:
System.exit( 0 );
?
- Paul
On Dec 19, 2007, at 8:57 AM, Jerome Louvel wrote:
However, there appear to be three authors/contributors, so we would
need to get the agreement and JCA of all of them which complicates
things a bit.
Given the algorithm description in English, just write the code
yourself from scratch and
On Dec 19, 2007, at 11:13 AM, Rob Heittman wrote:
I have concerns about doing an independent implementation because
it would likely bear substantial resemblance to yours.
As long as you do a clean room implementation, i.e., you'd swear
under oath that you didn't look at the original code,
Is it possible to limit the number of threads that Restlet uses/spawns
in servicing requests?
- Paul
Has anybody done a Flickr client using Restlet? If so, details
appreciated. Or, failing that, being pointed in the right direction
on how to do it (what classes to derive from) would be good.
I've been looking at the Restlet code and the thing that strikes me
as wrong is that the core
On Dec 4, 2007, at 3:03 AM, Stian Soiland wrote:
On 12/3/07, Paul J. Lucas [EMAIL PROTECTED] wrote:
Funny, because java.io.FileNotFoundException is derived from
IOException. So clearly there's precedent.
Did you notice the io package name? :-) The exceptions here are
about resources
On Nov 30, 2007, at 6:05 AM, Lars Heuer wrote:
RESTClient is a Java platform client application to test RESTful
webservices. http://code.google.com/p/rest-client/
IMHO, command-line test tools are better because they're far more
easily automated. I just write Perl script wrappers around
On Nov 29, 2007, at 6:30 AM, Tim Peierls wrote:
However, I don't have a concrete proposal, and I don't see an easy
way to do this without breaking code for 1.1m1 users.
Personally, I'd prefer to break an API rather than have to live with
a hacked API forever. Since Restlet is currently a
On Nov 29, 2007, at 3:18 PM, Jerome Louvel wrote:
It could have methods starting with append like the StringBuilder
class,
and follow the Reference naming convention. For example it could have:
- appendScheme(String scheme)
- appendSchemeSpecificPart(String ssp)
- appendFragment(String
On Nov 29, 2007, at 4:32 PM, Rob Heittman wrote:
The warnings to the user (cough Checked Exceptions /cough) should
come in when you try to confess the builder into a URI, Reference,
or String and it doesn't contain enough pieces and parts to have
meaning.
If, as the implementor, you want
On Nov 29, 2007, at 4:52 PM, Tim Peierls wrote:
Abstractly, though, would you rather see ReferenceBuilderException
checked or unchecked in the following:
try {
Reference ref =
ReferenceBuilder.appendBar(myBar).appendFoo(myFoo);
// do something with ref
} catch
On Nov 28, 2007, at 1:31 PM, Jason Terhune wrote:
I haven't actually tried this, but couldn't you just overload the
toObject()
and toRepresentation() methods? Doesn't Java do the work of
choosing the
method with the most specific argument?
For example:
public class ConverterService
On Nov 26, 2007, at 2:33 AM, Jerome Louvel wrote:
Your suggestion regarding the map of ConverterService is
interesting. However, how would you handle the reverse conversion
(from Representation to Object) ?
Also using a map. For both conversion directions, you allow for the
possibility
The current architecture of ConverterService is such that if I want
to convert to/from an object of a given class, I subclass
ConverterService. Well, what if I want to convert to/from several
classes? In my subclass, I could do an:
if ( obj instanceof MyClass1 ) {
//
If Message.getEntityAsObject() exists, why doesn't
Reference.getQueryAsObject() exist? I want to turn a query (via a
Form) into an Object using a ConverterService. (I'm converting a
query into an Object now, but doing it my own way since the framework
apparently provides no right way of
On Nov 19, 2007, at 6:51 AM, Rob Heittman wrote:
Or maybe Paul can figure out a way to do it without the mess.
Right now, I'm still trying to get my head around all this. It's not
totally clear to me when things should be a Restlet or a Resource;
whether one should derive from Directory
On Nov 19, 2007, at 6:51 AM, Rob Heittman wrote:
In my noodling with DAV method support, COPY and MOVE are especially
challenging to implement. By extending Directory and friends, you
can model a COPY as a GET and a PUT, and a MOVE as a GET, DELETE,
and PUT, but this is messy, not atomic
On Nov 19, 2007, at 8:12 PM, Paul J. Lucas wrote:
I've figured out that to do this right, yes: you do need to extend
DirectoryResource. The problem with that is that Engine insists on
creating an instance of DirectoryResource and not an instance of
one's derived class. So that means one
On Nov 17, 2007, at 2:42 PM, Rob Heittman wrote:
It, and other full WebDAV stuff is targeted to land in Restlet 1.2.
When is 1.2 targeted to be released?
- Paul
I was playing around with trying to derive from Directory to
implement the WebDAV COPY and MOVE methods. (How feasible is that?)
One of the first things I did was to call setModifiable() based on
whether the directory is actually writable (File.canWrite()). This
worked fine.
I then
When a client specifies a URL like:
http://server/path/to/file
how do I convert that into a file URI:
file://localhost/path/to/root/path/to/file
?
The context is in trying to implement the Destination header for a
WebDAV COPY or MOVE method. The client specifies the
To get the value of an HTTP header, it seems as though I have to do:
Form f = (Form)request.getAttributes().get( ATTRIBUTE_HEADERS );
String value = f.getFirstValue( MyHeader );
That seems rather... cumbersome. Is there an easier way?
- Paul
On Nov 17, 2007, at 2:42 PM, Rob Heittman wrote:
The non-standard header mechanism is the way to go for Destination:
and Overwrite: and such for the moment.
By which you mean the way I've already shown in code? Or something
else?
- Paul
- Original Message -
From: Paul J. Lucas [EMAIL PROTECTED]
To: discuss@restlet.tigris.org
Sent: Thursday, November 15, 2007 1:05:56 PM (GMT-0500) America/
New_York
Subject: New user: guidance for server?
Hi -
I'm new to Restlet. I want to create a simple server that serves the
contents
51 matches
Mail list logo