RE: catching JSON parse errors

2013-04-30 Thread Jon Sawyer
So, I may be missing the obvious, but if the method's precondition is that it 
receives an int[], shouldn't you be doing input validation anyway?

if (userData instanceof int[]  ((int[]) userData.length  0) {
return userData;
}
else {
getResponse().setStatus(Status.BAD_REQUEST);
}


Or are you looking for an out-of-band solution for many such handlers? If the 
latter, you probably could implement your own derivation of Restlet Filter does 
the above check, and plumb your Filter derivative upstream from your Resource.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3054621


Re: Re: Communication Error (1001) - The connector failed to complete the communication with the server

2013-04-30 Thread Jerome Louvel
Hi David and Adam,

Thanks for the follow up and general comment on the list. I agree and also
suggest people to follow StackOverflow for general QA. We try to be
present over there as well, but this list will stay the place of more
personal conversations.

After the release of the 'Restlet in Action' book last September, the core
Restlet team (Thierry Boileau, Thierry Templier and myself) has been very
much involved in the development and launch of our new APISpark cloud
platform (aka Restlet as a Service): http://apispark.com/ As a result, we
had less bandwidth to timely reply in this list and move version 2.2
forward.

We also launched the new http://restlet.org web site which was a major
undertaking and still requires work on the content front.

There is an opportunity for community members to step up and contribute to
the project. I'd like to highlight Tim Peierls who has been very active in
this regard for months. We need other interested person to be involved as
well.

Best regards,
Jerome
--
http://restlet.org
http://twitter.com/#!/jlouvel





2013/4/30 Adam Mc a...@cs.miami.edu

 Hi David,

 Everything is working well now for me now and I like restlet, but there
 does not seem to be much activity on this list.

 I kind of feel the same way.  Restlet matches my needs pretty well, and
 thing have been going well so far.  But, it is too bad that their is not a
 bigger community and forum here.

 I wonder if in general StackOverFlow is a better place to post questions
 and comments?

 -Adam

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3054610


--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3054624

RE: Restlet with WebLogic 10 - long delay on first request

2013-04-30 Thread Sean Hogan
For others coming upon this thread, I disabled the long scan by (essentially) 
disabling the WAR protocol:

public class OverridenSpringServerServlet extends SpringServerServlet {

@Override
protected Client createWarClient(Context context, ServletConfig config) 
{
return new OverriddenWarClient(context, 
config.getServletContext());
}

/*
 * This custom Client does nothing, essentially stubbing out the 
ServletWarClient
 * that would normally be in its place.
 */
public class OverriddenWarClient extends Client {

public OverriddenWarClient(Context parentContext, ServletContext 
servletContext) {
super(parentContext.createChildContext(), (ListProtocol) 
null);
getProtocols().add(Protocol.WAR);
}

}

}

This is a bletcherous hack and won't help anyone who actually uses the WAR 
protocol, but I was desperate.

Sean

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3054649


RE: Re: Re: Communication Error (1001) - The connector failed to complete the communication with the server

2013-04-30 Thread Adam Mc
Jerome,

Thanks for your thoughts.  My comments were not a knock against the Restlet 
team.  We know you all are working at full steam!  I will continue to think how 
I may be able to help with community documentation.  

Thanks,
-Adam

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3054650


Re: Communication Error (1001) - The connector failed to complete the communication with the server

2013-04-30 Thread David Leangen
Hi Jerome,

Thank you for that information. Congratulations for the book, by the way. I 
found it very useful. APISpark looks very interesting, too. I look forward to 
getting my hands dirty with Restlet.


Regards,
=David


On 30 Apr 2013, at 10:48 PM, Adam Mc wrote:

 Jerome,
 
 Thanks for your thoughts.  My comments were not a knock against the Restlet 
 team.  We know you all are working at full steam!  I will continue to think 
 how I may be able to help with community documentation.  
 
 Thanks,
 -Adam
 
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3054650

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3054651


Re: catching JSON parse errors

2013-04-30 Thread Daniel Halperin
Hi Jon,

In method 1, there is a need for input validation, as you say... but when
there is input provided and there are parse errors, the handler simply gets
a *null* argument and is not able to catch the exception.

In method 2, the exception describes the parse error---which I want to feed
back to the submitter to debug JSON queries.

My question is, is there a way to plug into the JSON ObjectMapper
functionality that is automatically invoked in method 1 and catch the
errors?

Thanks,
Dan


On Mon, Apr 29, 2013 at 11:34 PM, Jon Sawyer j...@jsawyer.net wrote:

 So, I may be missing the obvious, but if the method's precondition is that
 it receives an int[], shouldn't you be doing input validation anyway?

 if (userData instanceof int[]  ((int[]) userData.length  0) {
 return userData;
 }
 else {
 getResponse().setStatus(Status.BAD_REQUEST);
 }


 Or are you looking for an out-of-band solution for many such handlers? If
 the latter, you probably could implement your own derivation of Restlet
 Filter does the above check, and plumb your Filter derivative upstream from
 your Resource.

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3054621


--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3054657