Re: Long stream of IOExceptions from getEntityAsForm

2008-01-26 Thread John D. Mitchell
On Jan 25, 2008 6:33 PM, Mike Brzozowski [EMAIL PROTECTED] wrote:
 Hi,

 I'm running a Restlet (1.0.7) webserver and recently implemented an AJAXish 
 call
 using the Yahoo UI Connect library. It normally works but on some edge case I
 haven't found, it causes the server to spurt a literally endless stream of 
 these
 exceptions:

Hmm... I haven't seen that ever happen.

 Jan 25, 2008 6:01:45 PM com.noelios.restlet.util.FormReader addParameters
 WARNING: Unable to parse a form parameter. Skipping it.
 java.io.IOException: Stream closed
   at 
 simple.http.MonitoredInputStream.ensureOpen(MonitoredInputStream.java:184)
   at simple.http.MonitoredInputStream.read(MonitoredInputStream.java:83)

Are you using the Simple HTTP connector in production?  If so... Don't.

Use Jetty instead.

Take care,
John


RE: Problem with SpringHost

2008-01-26 Thread Jerome Louvel

Hi Simon,

Thanks for reporting this issue. I've renamed the setRoutes(Map) method in
setAttachments(Map). I've also added usage example to Javadocs.

Checked in SVN trunk.

Best regards,
Jerome  

 -Message d'origine-
 De : Simon Olofsson [mailto:[EMAIL PROTECTED] 
 Envoyé : jeudi 24 janvier 2008 10:24
 À : discuss@restlet.tigris.org
 Objet : Problem with SpringHost
 
 Hi,
 
 I've been working with Restlet for some time now, and it's a great
 framework.
 
 But I've got one problem with the Spring Extension in 1.1 M1. 
 I want to
 use SpringHost and attach some Restlets to it. SpringHost has 
 the method
 setRoutes(MapString,Object routes). But when I configure this in my
 beans.xml:
   bean id=myID class=org.restlet.ext.spring.SpringHost
 property name=resourceDomain value=^myVHost.* /
 property name=routes
   map
 entry key=/
   bean class=MyRestlet /
 /entry
   /map
 /property
   /bean
 I get the following error:
 [...]java.lang.IllegalArgumentException: Cannot convert value of type
 [java.util.LinkedHashMap] to required type 
 [org.restlet.util.RouteList]
 for property 'routes'[...]
 It seems that Spring tries to call the method setRoutes(RouteList
 routes) from the Router class.
 
 When I create my own class MySpringHost (extends VirtualHost) and name
 the method setAttachments(MapString, Object routes) and then use:
   bean id=myID class=MySpringHost
 property name=resourceDomain value=^myVHost.* /
 property name=attachments
   map
 entry key=/
   bean class=MyRestlet /
 /entry
   /map
 /property
   /bean
 everything works fine.
 
 Is there any workaround or configuration option, other than 
 creating my
 own SpringHost and renaming the method?
 
 Thanks,
 Simon



RE: Restlets and Asynchronous Request Processing

2008-01-26 Thread Jerome Louvel

Hi all,

I've added Tim's comment to the Async RFE:
http://restlet.tigris.org/issues/show_bug.cgi?id=143

Best regards,
Jerome  

 -Message d'origine-
 De : Rob Heittman [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 25 janvier 2008 05:32
 À : discuss@restlet.tigris.org
 Objet : Re: Restlets and Asynchronous Request Processing
 
 
   It's probably best in that case for handle to return a 
 Future-like object that lets you wait for completion or 
 cancel. Then Restlets that implement asynchronous handle 
 could use a common default implementation of synchronous 
 handle like this ... 
   
 
 
 That's the general idea I had in mind ... glad you have the 
 same picture.  I don't want to lose the simple synchronous 
 version either.
 
 
 
   There need to be thread-safe versions of Request and 
 Response for any of this to work.
 
 
 I believe there need to be thread-safe versions of Request 
 and Response (full stop).  Given an architecture like Restlet 
 that allows considerable creativity in the client and server 
 connectors you plug in, I'd like to have some guarantees 
 about the concurency behavior of high level API objects, 
 regardless of how interesting the implementation of the 
 underlying call is. 
 
 
 
   I should probably put these and future comments in the 
 issue tracker, but for which issue, asynchronous 
 http://restlet.tigris.org/issues/show_bug.cgi?id=143  or 
 GWT http://restlet.tigris.org/issues/show_bug.cgi?id=127 ?
 
 
 The async RFE would be the best choice, IMO.  GWT is a 
 special case that effectively requires callbacks for 
 implementation reasons, which turns out to make a handy 
 testbed for some of these concepts, but the overall async 
 thinking should be driven by the async RFE. 
 
 - R
 
 
 



Status class should have a Throwable field

2008-01-26 Thread Paul J. Lucas

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


void setThrown( Throwable t );
Throwable getThrown();

The default implementation of the response that gets returned to the  
client will simply do an:


t.getMessage()

and include that as the textual error message.  However, if I  
implement my own StatusService, I have full access to the exception.   
In my case, I'd like to return an XML entity containing an XML-ized  
version of the exception's stack trace.


- Paul


Re: POST seems to throw a 500 error code

2008-01-26 Thread dev dev
1.1-SNAPSHOT  directly from the reslet maven repo.

Thanks Jerome for answering my questions.

On Jan 26, 2008 10:19 AM, Jerome Louvel [EMAIL PROTECTED] wrote:


 Hi again,

 A similar issue has been fixed in Restlet 1.0.7. Which version do you run?

 Best regards,
 Jerome

  -Message d'origine-
  De : dev dev [mailto:[EMAIL PROTECTED]
  Envoyé : vendredi 25 janvier 2008 09:06
  À : discuss@restlet.tigris.org
  Objet : Re: POST seems to throw a 500 error code
 
  Here is the exception.
 
  an 25, 2008 12:04:23 AM
  com.noelios.restlet.ext.simple.SimpleProtocolHandler handle
  INFO: Exception while consuming the Simple request's input stream
  java.io.IOException: Broken pipe
  at
  simple.http.MonitoredInputStream.destroy(MonitoredInputStream.
  java:198)
  at
  simple.http.MonitoredInputStream.read(MonitoredInputStream.java:92)
  at java.io.FilterInputStream.read(FilterInputStream.java :66)
  at
  com.noelios.restlet.ext.simple.SimpleProtocolHandler.handle(Si
  mpleProtocolHandler.java:77)
  at simple.http.Dispatcher.run(Dispatcher.java:83)
  at simple.util.process.Daemon.execute(Daemon.java:121)
  at simple.util.process.Daemon.run(Daemon.java:106)
 
 
 
  On Jan 24, 2008 11:52 PM, dev dev [EMAIL PROTECTED] wrote:
 
 
I just changed the following bookmark example code from
  PUT to POST and i get an 500 status code using Simple
  Connector. What did i do wrong here? It works fine if i
  change it back to use PUT instead of POST.
 
private static void addUser(String userName, String password,
String fullName, String email) {
Form form = new Form();
form.add(user[password], password);
form.add(user[full_name], fullName);
form.add (user[email], email);
 
Response resp = new
  Client(Protocol.HTTP).post(getUserUri(userName),
form.getWebRepresentation());
System.out.println(resp.getStatus());
}
 
Thanks
dev
 
 
 
 




Security Issues with Dynamic Loading of Applications?

2008-01-26 Thread Alex Milowski
Besides the obvious Java issues of dynamically loading code, are there any
restlet-specific considerations for why you dynamically load an
Application instance
from a jar file?

It seems to me that the Component instance in which the Application is
running is
protected from the Application instance.  As such, there isn't a way that the
dynamically loaded code could do something bad like call stop() on
the component
unless you made the component instance directly available in the environment
somehow (e.g. as an attribute on the context).

Am I correct?  Are there other issues to consider?

--Alex Milowski


Re: Status class should have a Throwable field

2008-01-26 Thread Stephan Koops

Hello Paul,

if I understood you right, than you want to add method to the class 
Status to save the exception in the status object. But the Status 
objects are immutable as all metadata. So this won't work.


best regards
  Stephan

Paul J. Lucas schrieb:

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


void setThrown( Throwable t );
Throwable getThrown();

The default implementation of the response that gets returned to the 
client will simply do an:


t.getMessage()

and include that as the textual error message.  However, if I 
implement my own StatusService, I have full access to the exception.  
In my case, I'd like to return an XML entity containing an XML-ized 
version of the exception's stack trace.


- Paul


Re: Status class should have a Throwable field

2008-01-26 Thread Paul J. Lucas
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 exception in the status object. But the Status  
objects are immutable as all metadata. So this won't work.


best regards
  Stephan


Jaxb representation (HELP!)

2008-01-26 Thread dev dev
Hi folks,

has anybody already used the JAXB XML binding framework with Restlet? Are
there any sample codes we can take a look at on how it's being used in
Restlet? Any performance issues we should seriously consider before using
JAXB?

Thanks in advance for all the help.

dev