Timeout from ruby

2011-09-06 Thread ruben hernando
Hello

I had ruby on rails application, cosuming a restlet service in 1.2m1 version 
whith spring extension.

Yesterday I upgraded to 2.0 and now I had a problem.
If I make a petition using the web browser, it works fine, but when I do it 
from ruby, restlet gives the response after about 20 seconds.

When I debugged it, I saw that when I make the call from ruby, first of all, It 
calls my resource's constructor, but it only goes into @get method after 20 
seconds

could I miss some configuration when I changed the version of restlet?

regards

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


Re: ConcurrentModificationException from Resource

2010-02-24 Thread Ruben Hernando
the resource has just one Variant:

getVariants().add(new Variant(MediaType.APPLICATION_XML));


thanks, 
Rubén Hernando



Thierry Boileau thierry.boil...@noelios.com 
22/02/2010 17:25
Por favor, responda a
discuss discuss@restlet.tigris.org


Para
discuss@restlet.tigris.org
cc

Asunto
Re: ConcurrentModificationException from Resource






Hello Ruben,

could you tell us how you define the resource's list of variants?

Best regards,
Thierry Boileau

Hi,
We tried with different versions of restlet (1.1-M1, 1.2-M1, 1.1.8) and we 
are having the same problem.
we have a Resource. it make some access to a database.
when it has severall calls at same time, one or more of them fails and 
throw an exception. We think it happens before entering into the Resource 
class, so we think it can be a bug.
Here is the Stack trace

 GRAVE: Unhandled exception or error intercepted
java.util.ConcurrentModificationException
 at 
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
 at java.util.AbstractList$Itr.next(AbstractList.java:343)
 at 
com.noelios.restlet.Engine.getPreferredVariant(Engine.java:704)
 at 
org.restlet.data.ClientInfo.getPreferredVariant(ClientInfo.java:463)
 at 
org.restlet.resource.Resource.getPreferredVariant(Resource.java:270)
 at 
org.restlet.resource.Resource.handleGet(Resource.java:439)
 at org.restlet.Finder.handle(Finder.java:353)
 at org.restlet.Filter.doHandle(Filter.java:150)
 at org.restlet.Filter.handle(Filter.java:195)
 at org.restlet.Router.handle(Router.java:504)
 at org.restlet.Filter.doHandle(Filter.java:150)
 at org.restlet.Filter.handle(Filter.java:195)
 at org.restlet.Router.handle(Router.java:504)
 at org.restlet.Filter.doHandle(Filter.java:150)
 at org.restlet.Filter.handle(Filter.java:195)
 at org.restlet.Router.handle(Router.java:504)
 at org.restlet.Filter.doHandle(Filter.java:150)
 at 
com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:130)
 at org.restlet.Filter.handle(Filter.java:195)
 at org.restlet.Filter.doHandle(Filter.java:150)
 at org.restlet.Filter.handle(Filter.java:195)
 at 
com.noelios.restlet.ChainHelper.handle(ChainHelper.java:124)
 at org.restlet.Component.handle(Component.java:673)
 at org.restlet.Server.handle(Server.java:331)
 at 
com.noelios.restlet.ServerHelper.handle(ServerHelper.java:68)
 at 
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:147)
 at 
com.noelios.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:881)
 at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
 at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
 at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
 at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
 at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
 at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
 at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
 at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
 at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
 at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
 at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
 at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
 at 

ConcurrentModificationException from Resource

2010-02-19 Thread Ruben Hernando
Hi,
We tried with different versions of restlet (1.1-M1, 1.2-M1, 1.1.8) and we are 
having the same problem.
we have a Resource. it make some access to a database.
when it has severall calls at same time, one or more of them fails and throw an 
exception. We think it happens before entering into the Resource class, so we 
think it can be a bug.
Here is the Stack trace

 GRAVE: Unhandled exception or error intercepted
java.util.ConcurrentModificationException
at 
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at com.noelios.restlet.Engine.getPreferredVariant(Engine.java:704)
at org.restlet.data.ClientInfo.getPreferredVariant(ClientInfo.java:463)
at org.restlet.resource.Resource.getPreferredVariant(Resource.java:270)
at org.restlet.resource.Resource.handleGet(Resource.java:439)
at org.restlet.Finder.handle(Finder.java:353)
at org.restlet.Filter.doHandle(Filter.java:150)
at org.restlet.Filter.handle(Filter.java:195)
at org.restlet.Router.handle(Router.java:504)
at org.restlet.Filter.doHandle(Filter.java:150)
at org.restlet.Filter.handle(Filter.java:195)
at org.restlet.Router.handle(Router.java:504)
at org.restlet.Filter.doHandle(Filter.java:150)
at org.restlet.Filter.handle(Filter.java:195)
at org.restlet.Router.handle(Router.java:504)
at org.restlet.Filter.doHandle(Filter.java:150)
at com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:130)
at org.restlet.Filter.handle(Filter.java:195)
at org.restlet.Filter.doHandle(Filter.java:150)
at org.restlet.Filter.handle(Filter.java:195)
at com.noelios.restlet.ChainHelper.handle(ChainHelper.java:124)
at org.restlet.Component.handle(Component.java:673)
at org.restlet.Server.handle(Server.java:331)
at com.noelios.restlet.ServerHelper.handle(ServerHelper.java:68)
at 
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:147)
at 
com.noelios.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:881)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:619)


Regards
R.Hernando

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


Describe Restlet services

2009-12-17 Thread Ruben Hernando
Hi!

I'd like to make a description of a restlet web service using 'wsdl' or 
something similar.
I use Spring to attach all my resources to a SpringRouter, and I want to have a 
description of each one.
is there any tool or any way to do it?

thanks in advance

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


Request Session

2009-02-16 Thread Ruben Hernando
Hi!

I need some equivalent to the traditional HttpServletRequest.getSession(), 
because I'd have to insert some parameters into the session. 
org.restlet.Handler.getRequest() does'nt implement any getSession() 
method, so I need a way to do it.

thanks

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

RE: Default Routes

2009-01-28 Thread Ruben Hernando
did you check that requets to / are without parameters. If it's a 
webservice and you use a browser, it can add some default paremeter, which 
makes router to go to Special Resource.
I had a similar problem. check your log.

Regards,
Ruben




postmas...@tigris.org 
28/01/2009 22:52
Por favor, responda a
discuss discuss@restlet.tigris.org


Para
discuss@restlet.tigris.org
cc

Asunto
RE: Default Routes






Sorry, had a typo in my original post.  I tried:

router.attach(/, DefaultResource.class);
router.attach(/{year}, SpecialResource.class);

And all requests to / still go to the special resource.  This seems like 
a pretty standard configuration so I'm not sure why it's behaving this 
way.  Surely people use / all the time without problems, so am I 
forgetting to set something else?  Here's my entire code for createRoot():

Router router = new Router(getContext());
router.attach(/, DefaultResource.class);
router.attach(/{year}, SpecialResource.class);
return router;

Straight from the tutorial really.  Ive also tried setting the 
defaultMatchingMode to BEST, FIRST, and LAST, and all have the same 
behavior.

As for your suggestion with making param match alpha_num, is there a way 
to do this with restlets or would I just supply a regex?  In the latter 
case, how would the resource get the parameter since it's not named?

Thanks,

Mike

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

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

RE: Re: Attaching a org.restlet.Directory to SpringRouter.

2009-01-22 Thread Ruben Hernando
Hello Santosh

you have to create a bean component, and use it to get the context


bean id=component class=
org.restlet.ext.spring.SpringComponent
property name=server ref=httpServer / 
property name=defaultTarget ref=root /
property name=client
util:constant static-field=
org.restlet.data.Protocol.FILE /
/property
/bean

Don't forget to add Protocol.FILE to make the Directory work.
Regards
Ruben




santoshkumar.baba...@gmail.com 
22/01/2009 07:34
Por favor, responda a
discuss discuss@restlet.tigris.org


Para
discuss@restlet.tigris.org
cc

Asunto
RE: Re: Attaching a org.restlet.Directory to SpringRouter.






I need the Context object to instantiate org.restlet.Directory(or its 
subclass). Since component in my case is a servlet container(tomcat 6), 
how/where do I get the context required for creating a directory? 

Below is how my config looks-
WEB.XML:
servlet
servlet-nametest/servlet-name
 
servlet-classcom.noelios.restlet.ext.spring.RestletFrameworkServlet/servlet-class
load-on-startup1/load-on-startup
init-param
   param-nametargetRestletBeanName/param-name
   param-valuerestletRouter/param-value
/init-param
   /servlet
 
 servlet-mapping
servlet-nametest/servlet-name
url-pattern/*/url-pattern
 /servlet-mapping

TEST-SERVLET.XML:
bean name=restletRouter 
 class=org.restlet.ext.spring.SpringRouter 
 property name=attachments 
 map 
 entry key=/users 
 bean class=org.restlet.ext.spring.SpringFinder 
 lookup-method name=createResource 
bean=usersResource/ 
 /bean 
 /entry 
  entry key=/users/{userID} 
 bean class=org.restlet.ext.spring.SpringFinder 
 lookup-method name=createResource 
bean=userResource/ 
 /bean 
 /entry 
 !- As suggested --
 entry key=/images value-ref=directory/
 /map 
 /property
 bean id=directory class=...SpringDirectory
property name=componentref 
local=component//property
/bean
/bean

In the code above, I do not to know to get the component object, since my 
component is a sevlet container. What can be done?

Another thought is just to let webserver handle the static file requests 
since it runs in tomcat. What you think?

Regards
Santosh

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

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

Re: Attaching a org.restlet.Directory to SpringRouter.

2009-01-21 Thread Ruben Hernando
hi!

you have to attach a Directory:

bean id=root class=org.restlet.ext.spring.SpringRouter
property name=attachments 
map 
entry key=/test
bean class=
org.restlet.ext.spring.SpringFinder
lookup-method name=
createResource bean=testResource /
/bean
.
.
.
entry key=/images value-ref=directory 
/ 
/map 
/property 
/bean 

bean id=directory class=
informa.rest.spring.resources.SpringDirectory
property name=component
ref local=component/
!--util:property-path path=component.context 
/--
/property
/bean

springDirectory have to implement a restlet's Directory 


regards





santoshkumar.baba...@gmail.com 
21/01/2009 16:13
Por favor, responda a
discuss discuss@restlet.tigris.org


Para
discuss@restlet.tigris.org
cc

Asunto
Attaching a org.restlet.Directory to SpringRouter.






Hello,
I am building a rest styled web app using restlet. Its integrated with 
spring using RestletFrameworkServlet and routes requests using 
SpringRouter. I am not able to attach a web directory to the router.

I think if I fill up ?? in the following code, i would be through, Can 
some one help?

bean name=restletRouter 
 class=org.restlet.ext.spring.SpringRouter 
 property name=attachments 
 map 
 entry key=/images 
 ??
 /entry 
 entry key=/users 
 bean class=org.restlet.ext.spring.SpringFinder 
 lookup-method name=createResource 
bean=usersResource/ 
 /bean 
 /entry 
  entry key=/users/{userID} 
 bean class=org.restlet.ext.spring.SpringFinder 
 lookup-method name=createResource 
bean=userResource/ 
 /bean 
 /entry 
 /map 
 /property 
 /bean 


So far I have been able to resolve all the issues just by reading the 
community docs and emails :) and it has been a great support. Thank you 
for all that.

Regards
Santosh

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

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

RE: Re: Browse a Directory from a web application inside jboss

2009-01-19 Thread Ruben Hernando
hello!

 I think it maybe caused by the component because I am not calling 
component.start() method
I'm instantiating all components and resources from applicatonContext.xml 
in Spring. 
So, can you tell me a way to start my component from spring configuration?

thanks,
Ruben



Jerome Louvel jerome.lou...@noelios.com 
16/01/2009 16:41
Por favor, responda a
discuss discuss@restlet.tigris.org


Para
discuss@restlet.tigris.org
cc

Asunto
RE: Re: Browse a Directory from a web application inside jboss






Hi Ruben,

It must be an issue with your component, here is a sample that works:

import org.restlet.Application;
import org.restlet.Component;
import org.restlet.Directory;
import org.restlet.Restlet;
import org.restlet.data.Protocol;

public class SpringDirectory extends Application {

@Override
public Restlet createRoot() {
return new Directory(getContext(), file:///c:/templates/);
}

public static void main(String[] args) throws Exception {
// Create a new Restlet component
final Component component = new Component();
component.getServers().add(Protocol.HTTP, 9876);
component.getDefaultHost().attach(new SpringDirectory());
component.start();
}

}

Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
 

-Message d'origine-
De : Ruben Hernando [mailto:pr-rherna...@informa.es] 
Envoyé : vendredi 16 janvier 2009 12:22
À : discuss@restlet.tigris.org
Objet : RE: Re: Browse a Directory from a web application inside jboss

Hello,

I created the Directory in that way and it worked, but when I start my 
server whows an error whith the first file:

GRAVE: The informa.rest.spring.​resources.SpringDire​ctory class has no 
Restlet defined to process calls. Maybe it wasn't properly started.

And it doesn't serve the file (error 500). If I refresh the page in the 
browser it works.


public class SpringDirectory extends Application {

@Override
public Restlet createRoot() {
return new 
Directory(getCompone​nt().getContext().cr​eateChildContext(), 
file:///c:/templates/);
} 

I'm using 1.2-SNAPSHOT version.

Rubén Hernando

 This worked! Thanks for your time.
 Brian
 
 Michael Terrington wrote:
  Hi Brian,
  
  I've been adding the FILE client connector by creating a new component
  and feeding that to the restlet that requires it.  Like so:
  
   Component component = new Component();
   component.getClients().add(Protocol.FILE);
   Directory directory = new
  Directory(component.getContext().createChildContext(),
   file:///c:/);
   directory.setListingAllowed(true);
   router.attach(/files, directory);
  
  BTW the createChildContext() is in 1.1 so if you are using 1.0 just
  remove it.  There's also no need for the inner Application containing
  the Directory.
  
  Regards,
  Michael.
 
 -- 
 Brian E. Williams
 Senior Application Developer
 
 The Archer Group
 233 King Street
 Wilmington, DE 19801
 
 w: 302.429.9120 x225
 f: 302.429.8720
 
 http://www.archer-group.com

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


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

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

RE: Re: Browse a Directory from a web application inside jboss

2009-01-16 Thread Ruben Hernando
Hello,

I created the Directory in that way and it worked, but when I start my server 
whows an error whith the first file:

GRAVE: The informa.rest.spring.​resources.SpringDire​ctory class has no Restlet 
defined to process calls. Maybe it wasn't properly started.

And it doesn't serve the file (error 500). If I refresh the page in the browser 
it works.


public class SpringDirectory extends Application {

@Override
public Restlet createRoot() {
return new 
Directory(getCompone​nt().getContext().cr​eateChildContext(), 
file:///c:/templates/);
} 

I'm using 1.2-SNAPSHOT version.

Rubén Hernando

 This worked! Thanks for your time.
 Brian
 
 Michael Terrington wrote:
  Hi Brian,
  
  I've been adding the FILE client connector by creating a new component
  and feeding that to the restlet that requires it.  Like so:
  
  Component component = new Component();
  component.getClients().add(Protocol.FILE);
  Directory directory = new
  Directory(component.getContext().createChildContext(),
  file:///c:/);
  directory.setListingAllowed(true);
  router.attach(/files, directory);
  
  BTW the createChildContext() is in 1.1 so if you are using 1.0 just
  remove it.  There's also no need for the inner Application containing
  the Directory.
  
  Regards,
  Michael.
 
 -- 
 Brian E. Williams
 Senior Application Developer
 
 The Archer Group
 233 King Street
 Wilmington, DE 19801
 
 w: 302.429.9120 x225
 f: 302.429.8720
 
 http://www.archer-group.com

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