exception while trying to convert json into object representation
hi, I'm using the Restlet SE Client in order to send a JSON into a @Put(json) annotated Resource method. The method takes a parameter (the target to which XStream is trying to convert the source json representation) I get the following exception on the server: WARNING: Exception or error caught in resource com.thoughtworks.xstream.converters.ConversionException: Cannot construct com.mysite.myapp.Item : access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect) : Cannot construct com.mysite.myapp.Item : access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect) Debugging information message : Cannot construct com.mysite.myapp.Item : access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect) cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException cause-message : Cannot construct com.funsoftmedia.balyan.dm.movie.Movie : access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect) class : com.mysite.myapp.Item required-type : com.mysite.myapp.Item line number : -1 --- at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:78) Please note that on the server I'm running the latest snapshot of the GAE edition. Any clue? Thanks, Chen. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2581875
Re: Re: Please help: Standalone RESTLET client works but the GWT RESTLET client doesn't
Hi, Now when I invoke the Restful web svc with POST request, I get an exception: org.restlet.client.resource.ResourceException: *Unsupported Media Type* * * The web service is running on localhost:8080 under tomcat and is designed using SPRING REST framework. Below is the client code from GWT App where I invoke the web service. User.java, UserResource.java and UserResourceProxy.java are attached. *// Submit button on the form - invokes a web service to store the user data * btSubmit.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { invokePostWebSvc(btSubmit,tbFName); // invokes the Restful web svc with a POST method request } }); private void *invokePostWebSvc*(final Button btSubmit, TextBox tbFName) { // Set up the contact resource UserResourceProxy userResource = GWT .create(UserResourceProxy.class); userResource.getClientResource().setReference( http://localhost:8080/webapp/rest/postWithStringResponseUser.xml;); userResource.getClientResource().getClientInfo() .getAcceptedMediaTypes().add( new PreferenceMediaType( MediaType.APPLICATION_JAVA_OBJECT_GWT)); Integer id = new Integer(tbFName.getText()); userResource.store(id, new ResultUser() { public void onFailure(Throwable caught) { System.out.println(Error in submission ); Log.debug(caught.getMessage(), caught); btSubmit.setText(caught.getMessage()); // GWT.log(caught.getMessage(), caught); // caught.printStackTrace(); } public void onSuccess(User v) { btSubmit.setText(v.getName()); System.out.println(Success = + v.getName() ); } }); } On Tue, Apr 13, 2010 at 2:43 PM, Thierry Boileau [via Restlet Discuss] ml-node+4894955-874754734-495...@n2.nabble.comml-node%2b4894955-874754734-495...@n2.nabble.com wrote: Hi deep, can you provide a sample app? Best regards, Thierry Boileau -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2580596 -- View message @ http://n2.nabble.com/Please-help-Standalone-RESTLET-client-works-but-the-GWT-RESTLET-client-doesn-t-tp4876360p4894955.html To start a new topic under Restlet Discuss, email ml-node+1400322-780992574-495...@n2.nabble.comml-node%2b1400322-780992574-495...@n2.nabble.com To unsubscribe from Restlet Discuss, click here (link removed) =. -- View this message in context: http://n2.nabble.com/Please-help-Standalone-RESTLET-client-works-but-the-GWT-RESTLET-client-doesn-t-tp4876360p4900627.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2581980
A Couple Restlet 2.0rc2 Documentation Comments
I've been attempting to upgrade my Restlet-based projects to the latest Restlet 2.0rc2 release. Things have been going well but I've had to resort to inspecting the code to figure out how to properly use the API as the javadoc seems to be insufficient. Here's a couple of things I found a bit too terse: 1. The new Finder API is a bit confusing as to when I should override find() versus create() (either one). Since find() calls the create() variant without the Class? extends ServerResource parameter the two methods are almost synonyms. I don't really know when I should use which one. I also don't quite know what the target class information is all about either. 2. I've moved my code to use the ServerResource class from the Resource class. In doing so it isn't clear from the API documentation that if I set response facets (e.g. the status) using the direct setter methods that they will remain as set. In fact, in certain cases, that seems to not be the case (e.g. get() without an entity will change a 200 to a 204). More information about the lifecycle would be really helpful. While I'm quite confortable searching through the code, I'm sure others are not. Maybe putting targeted how to code samples on the wiki would also be helpful as well as back pointers from the javadoc to the online documentation in the wiki? Anyway, so far things are working pretty well and I haven't run into any real issues yet. --Alex Milowski -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2582036
openid example
Hello Does anyone have a simple (or not so simple) openid authentication example? With openid4java or other client library. Thanks for your help. Best, Zsolt -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2582337
Re: Serving static files from jar: Spring config expert needed!
BTW when showing my Spring config I forgot to include the clap in the client list in my root component. It's presence is not helping the problem, but I wanted to give an accurate view of my spring config as it stands, in case anyone was willing to help me: bean id=rootRestletComponent class=org.restlet.ext.spring.SpringComponent property name=clientsList list valueclap/value /list /property property name=defaultTarget ref=virtualHost / /bean bean id=virtualHost class=org.restlet.ext.spring.SpringHost constructor-arg ref=rootRestletComponent / property name=attachments map entry key=/myapp ref bean=restletApplication / /entry /map /property /bean bean id=rootRestletComponentChildContext class=org.restlet.Context lookup-method name=createChildContext bean=rootRestletComponent.context / /bean !-- the spring version of the local clap reference Thierry helped me with in an earlier post -- bean id=localClapReference class=org.restlet.data.LocalReference factory-method=createClapReference constructor-arg util:constant static-field=org.restlet.data.LocalReference.CLAP_CLASS / /constructor-arg constructor-arg value=/my/package / /bean !-- spring version of the freemarker config Thierry helped me with. This works! -- bean id=freemarkerConfig class=freemarker.template.Configuration property name=localizedLookup value=false / property name=templateLoader bean class=org.restlet.ext.freemarker.ContextTemplateLoader constructor-arg ref=rootRestletComponentChildContext / constructor-arg ref=localClapReference / /bean /property /bean !-- define resources, injecting dependencies -- bean id=helloWorldResource class=my.package.HelloWorldResource scope=prototype / bean id=dashboardResource class=my.package.DashboardResource scope=prototype property name=freemarkerConfig ref=freemarkerConfig / /bean bean id=restletApplication class=org.restlet.Application constructor-arg ref=rootRestletComponentChildContext / property name=inboundRoot bean id=rootApplicationRouter class=org.restlet.ext.spring.SpringRouter constructor-arg ref=restletApplication / !-- use best match so that wildcard route at the end gets selected -- property name=routingMode util:constant static-field=org.restlet.routing.Router.MODE_BEST_MATCH / /property property name=attachments map !-- define uri routes to resources -- entry key=/hello bean class=org.restlet.ext.spring.SpringFinder lookup-method name=create bean=helloWorldResource / /bean /entry entry key=/dashboard bean class=org.restlet.ext.spring.SpringFinder lookup-method name=create bean=dashboardResource / /bean /entry !-- intended to match urls such as http://localhost/myapp/static/images/banner.gif -- entry key=/static bean id=directory class=org.restlet.resource.Directory constructor-arg ref=rootRestletComponentChildContext / constructor-arg ref=localClapReference / /bean /entry /map /property /bean /property /bean Also, I guess when using the spring config it is normal to get log messages such as these? 2010-04-14 13:15:41,743 FINE [org.restlet.engine.component.ComponentClientDispatcher] The connector has been instantiated without any protocol. [org.restlet.Connector.init(Connector.java:94)] 2010-04-14 13:15:41,759 FINE [org.restlet.engine.component.ComponentServerDispatcher] The connector has been instantiated without any protocol. [org.restlet.Connector.init(Connector.java:94)] 2010-04-14 13:15:41,821 FINE [org.restlet.engine.component.ChildClientDispatcher] The connector has been instantiated without any protocol. [org.restlet.Connector.init(Connector.java:94)] 2010-04-14 13:15:41,821 FINE [org.restlet.engine.component.ChildClientDispatcher] The connector has been instantiated without any protocol. [org.restlet.Connector.init(Connector.java:94)] -- View this message in context: http://n2.nabble.com/Server-side-includes-for-org-restlet-resource-Directory-tp4860119p4903264.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2582657
Re: Serving static files from jar: Spring config expert needed!
The problem seems to be that Spring instantiates the Directory before it invokes the setClientList() on the root component. So the context with which the Directory is constructed still has a null clientDispatcher. I worked around the problem by modifying my custom servlet to reset the context on the directory to a new child one, after Spring gets done wiring everything together. Hope this helps anyone else running into similar issues. Luckily in my case there was easy place to do some imperative programming. -- View this message in context: http://n2.nabble.com/Server-side-includes-for-org-restlet-resource-Directory-tp4860119p4903903.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2582774
JAAS and JBoss 5.1
Anyone integrated the JaasVerifier into a JBoss 5.1 environment? Looking for an example... otherwise I'll hack on it and post my findings here later. -- View this message in context: http://n2.nabble.com/JAAS-and-JBoss-5-1-tp4904649p4904649.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2582956