Re: OAuth Restlet

2011-04-13 Thread Lokendra Singh
Hi Martin,

Can you help with building the OAuth extension. I have built the OpenID
extension successfully.

I get the following error (I have added the maven-restlet repo to the
pom.xml):

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model
for org.restlet.dev:org.restlet.ext.oauth:jar:2.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 122,
column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they
threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support
building such malformed projects.
[WARNING]
[INFO]

[INFO]

[INFO] Building Restlet Extension - OAuth 2.1-SNAPSHOT
[INFO]

[INFO]

[INFO] BUILD FAILURE
[INFO]

[INFO] Total time: 0.584s
[INFO] Finished at: Wed Apr 13 12:27:41 IST 2011
[INFO] Final Memory: 4M/74M
[INFO]

[ERROR] Failed to execute goal on project org.restlet.ext.oauth: Could not
resolve dependencies for project
org.restlet.dev:org.restlet.ext.oauth:jar:2.1-SNAPSHOT: Failed to collect
dependencies for [org.restlet.jse:org.restlet:jar:2.1-SNAPSHOT (compile),
org.restlet.jse:org.restlet.ext.json:jar:2.1-SNAPSHOT (compile),
org.restlet.jse:org.restlet.ext.xml:jar:2.1-SNAPSHOT (compile),
org.restlet.dev:org.restlet.ext.openid:jar:2.1-SNAPSHOT (provided),
org.restlet.jse:org.restlet.ext.wadl:jar:2.1-SNAPSHOT (provided),
org.restlet.jse:org.restlet.ext.freemarker:jar:2.1-SNAPSHOT (provided),
junit:junit:jar:4.4 (compile)]: Failed to read artifact descriptor for
org.restlet.dev:org.restlet.ext.openid:jar:2.1-SNAPSHOT: Failure to find
org.restlet.dev:org.restlet.incubator:pom:2.1-SNAPSHOT in
http://maven.restlet.org ]

Regards
Lokendra


On Tue, Apr 12, 2011 at 1:51 PM, Lokendra Singh lsingh@gmail.comwrote:

 Hi,

 I was looking for OAuth support in Restlet.
 Can somebody tell me the status of the OAuth extension kept in incubator.
 Can it be used?

 Regards
 Lokendra


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

Re: Solution Design Crisis

2011-04-13 Thread Tamás Cservenák
Hi there,

we use Resltet in Nexus for 4 years now. I believe what you miss is that
security is usually orthogonal concern, usually handled outside BL.

Look into Apache Shiro (former Ki/JSecurity). We combine it together with
Restlet:

http://shiro.apache.org/

Specifically, among other cool things in Shiro, this is example of  Shiro
support for REST environments:

http://shiro.apache.org/static/current/apidocs/org/apache/shiro/web/filter/authz/HttpMethodPermissionFilter.html

Usually, at least in case of Nexus, the permission check happens way before
(in Servlet Filter) even the request enters Restlet. A better integration
would be nice (having Shiro based Guards or so), but having restlet in
Servlet Container + Shiro filter actually does it's job very well.

Hope helps,
~t~

On Tue, Apr 12, 2011 at 10:26 AM, tornat tor...@gmail.com wrote:

 Hi at all
 I'm Stefano from Italy (so...sorry for my  not so good english). I come
 from
 JSP-Relational DB and Java world (before 2007) and after some years of
 stop,
 I'm trying to develop a new platform for building collaborative
 journalistic
 stuffs (eg. article, newspapers and so on) using new technologies (REST,
 NOSQL, workflow engine). So the scenario  is quite simple:

 1) Different Kind of people  can access to platform (anonimous users,
 writers, readers, editors, administrators) and everyone of them can be, for
 example,  editor for one article and also only reader for another one)

 2)collaborative resources can have different kind of protection policy in
 example, some articles are private (manageable only by their owner),  other
 are manageable  by a dinamic group of users, and finally other are public
 (manageable by every autentichated user)

 So I've already buy restlet in action MEAP ebook (great job) for better
 understand  RESTLET powerful characteristics and after 6 chapter I'm in
 crisis on  secure issues (probably because of my servlet stateful
 background).

 I mean that in JSP world , after a login form , usually I use
 session.setParameter (user, User)  using a POJO User with some methods
 like public Boolean checkModification(Article ID) that return true if
 current user can modify resource with given ID,  and public Boolean
 checkView(Article ID) that  return true if current user can view resource.
 Obviusly those methods have business logic that check in some way
 permission
 grant (i. e. a SQL query on a RDBMS). In my opinion, in this way is avoid
 also the problem of cross injection  because the user  pojo is in memory in
 context session on server side.

 I'm sure (or better, I hope) that the same kind of security can be reached
 also with RESTLET frameworkbut I'm confused about this topic and about
 the better solution for my project.

 For other features i need to use Restlet as  Servlet  in Tomcat , so please
 ..can everyone  guide me in the choose of right secure architecture, to
 obtain content protection policy (like explained above)and also to avoid
 malicius injection, by using Tomcat and Restlet?

 I hope in your help...thanks in advance.
 Stefano



 --
 View this message in context:
 http://restlet-discuss.1400322.n2.nabble.com/Solution-Design-Crisis-tp6264270p6264270.html
 Sent from the Restlet Discuss mailing list archive at Nabble.com.

 --

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


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

Re: Problem with HttpClient extension (org.restlet.ext.httpclient) and unreleased connections during 404s

2011-04-13 Thread graphy
sir:
  in the server ,how to release the connetion ? I try to  release
server.release(), howerver ,it does't work ,returning 204 status  .But if I 
release the request ,if the access  counter not beyond the maxThreads
settings ,it will ok. Do I still release connetionion in this way?Hope to
head from you ,thanks

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Problem-with-HttpClient-extension-org-restlet-ext-httpclient-and-unreleased-connections-during-404s-tp5284804p6248679.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: GWT Restlet Spring timeout problem

2011-04-13 Thread Thierry Boileau
Hello Musa,

I wonder if your issue is linked with this one:
http://restlet.tigris.org/issues/show_bug.cgi?id=1247
Are you using the 2.0 version of the Restlet framework?

Best regards,
Thierry Boileau


Hi we are developing web based application on glassfishv3. We have 2
 application as a client (GWT + Servlets) and Service (Restlet + Spring +
 Hibernate).

 GWT call servlet and servlet connects to Service layer. One person getting
 one request is working well but when GUI start to get more requests or more
 peoples sign in and taking data from server, Servlet starts to waiting on
 service connection and at last taking error message below.

 Internal Connector Error (1002) - The calling thread timed out while
 waiting for a response to unblock it.

 I think , i am missing some point.

 This is my application-config.xml(Spring -restlet configuration part)















 This is my web.xml (part of spring-restlet configuration. not all file)


org.restlet.component
springrestComponent


contextConfigLocation
WEB-INF/application-config.xml


springrest
org.restlet.ext.spring.SpringServerServlet
1


springrest
/*


 And last, this code is using by the client side. (GWT + Servlets , servlet
 calls the service)

 Client client = new Client(Protocol.HTTP);

 MyObj myObj = new MyObj();
 myObj.setName(Sample);

 JaxbRepresentation jaxbRepresentationSendingMyObj = new
 JaxbRepresentation(MediaType.APPLICATION_XML, myObj);

 Request request = new Request(Method.GET, url,
 jaxbRepresentationSendingMyObj);
 Response response = client.handle(request);

 JaxbRepresentation returnJAXB = new
 JaxbRepresentation(response.getEntity(),
 MyObj.class);
 MyObj myObj = returnJAXB.getObject();

 This code is using by the server side. (Restlet + Spring + Hibernate)

 @Get
 public Representation getOperation(Representation representation) {

JaxbRepresentation jaxbRepresentation = new
 JaxbRepresentation(representation, MyObj.class);
MyObj myObj = new MyObj();

try {
myObj= jaxbRepresentation.getObject();

} catch (IOException e) {
e.printStackTrace();
}
/*
some business code
*/

return new JaxbRepresentation(MediaType.APPLICATION_XML, myObj);
 }

 Best Regards
 Musa YUVACI



 --
 View this message in context:
 http://restlet-discuss.1400322.n2.nabble.com/GWT-Restlet-Spring-timeout-problem-tp6249038p6249038.html
 Sent from the Restlet Discuss mailing list archive at Nabble.com.

 --

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


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

Re: GWT Restlet Spring timeout problem

2011-04-13 Thread Musa YUVACI
Hello Thierry,

No, my issue is a little bit different this
one(http://restlet.tigris.org/issues/show_bug.cgi?id=1247). I am using
restlet v2.0. My application client just sent six request to server(Client
and Service are running at the same glassfish v3). And i get the error. I
figured the problem was caused by the server. So that i seperated our client
and server. Now Client and Server are running different server. And they
works fine. But application speed is not so well when client and service run
different server. 

Best Regards
Musa YUVACI

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/GWT-Restlet-Spring-timeout-problem-tp6249038p6268769.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


getRequestAttributes() always is empty.

2011-04-13 Thread Musa YUVACI
Hi,

at the my application client side.I put param1 to request. 

request.getAttributes().put(param1, sample);

But at the server side. When i get this attribute from the request, it
returns null.

getRequest().getAttributes().get(param1)

How can i use the request attributes.

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/getRequestAttributes-always-is-empty-tp6268997p6268997.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Multi-tenant and multi-application in restlet + spring environment

2011-04-13 Thread Daniele Dellafiore
hi.

I've a multi-tenant restlet application that perform authentication and some
authorization towards cloud services. I'm going to make it work for multiple
applications at a time, each of them being multi tenant. Thus I have only
one authn/authz server instance.

The multi-tenancy now is achieved the simple way: the tenant parameter on
the URL percolate all through the services layer to the repository one as a
parameter. That's not that bad, in the end.
Now I want to add multi-app support without touching the code of the
Resources and the spring xml that loads everyghing: the restlet app, router,
the resources (using a SpringBeanRouter) and all the app services and spring
security stuff.

I'm thinking storing data on a different db (with it's own credentials) for
each hosted app.
Given that the class that write/read on mongo (MongoTemplate) is autowired
to different services, it will be a lot of work to change it. I can change
the MongoTemplate with a MongoTemplateFactory, but again I need thea  app
parameter to percolate till that level.

I think that given that the actual spring context works nice for a single
app, I should go in a direction where I can load as many spring context as
many host application my REST Resource is managing and inject the classes
from the right context when I init a Resource. What do you think?


Now, I only have a .properties file that defines the mongo host, db and so
on. Let's make it simple and try to figure out a scenario with a fixed
number of applications, two, so I can just have say two different properties
file app1.properties and app2.properties with appropriate mongo parameters.

What I want is that when a restlet Resource is loaded, the correct spring
bean is taken from the right ApplicationContext. Something like in a
BaseReource class that extends ServerResource and is extended by all the
other resources:

@Override
   protected void doInit() throws ResourceException {
  String app = (String) getRequestAttributes().get(app);
  ApplicationContext context = springContextFactory.get(app);
  inject(context, this);
  super.doInit();
   }

Now, I have no idea of how to achieve this, or if in any way this could
work, expecially with the SpringBeanRouter. Anyone here have some clue? Also
hey this solution make no sense is an answer that I'll consider of course
:)

In this scenario,

1. the springContextFactory is something I made up, that would take the app
parameter, use it to load a whole set of spring xml files with the
appropriate placeholder.
2. the restlet spring beans are more tricky. The server (host, port...) so
is the component defined as

  bean id=restletComponent class=org.restlet.ext.spring.SpringComponent
init-method=start destroy-method=stop
property name=server ref=server /
property name=defaultTarget ref=application /
  /bean

the ref=application there is my actual restlet application.
Now I thought I could have different target, one per hostet application, but
probably I do not need this.

I think that I just have to split the restlet app spring configuration from
the services layer and the rest of the stuff. Cause the restlet server,
component, application, router and resources are fine the way they are.
If in the doInit method of the BaseResource I can load dynamically the rest
of the spring context and perform a manual injection of the needed beans
inside the actual Resource. So all the component-application-beanRouter
stuff should work as normal, just every resource is loaded with the right
app spring context.
Probably I also have to change the mount path from

bean name=/accounts class=AccountsResource id=accounts
scope=prototype/

to

bean name={app}/accounts class=AccountsResource id=accounts
scope=prototype/

What do you think?
I know that most of the problem is more close to spring multi context
scenario, but being this basically a Restlet app I'd like to listen your
opinion, maybe I'm making some basic mistake.

Thanks for reading all of the long message.

-- 
Daniele Dellafiore
http://danieledellafiore.net

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

Re: Solution Design Crisis

2011-04-13 Thread tornat
Tamás thank you so mutch  for your quickly and complete response... I'm happy
about your usefull  shiro tip, that seems to be robust and mature
framework... i'm start to learn it right now...
Thanks for all.
Stefano

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Solution-Design-Crisis-tp6264270p6269344.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Multiple applications with serverservlet and v2.0

2011-04-13 Thread Chris Davis
Quick question is it possible to have multiple restlet applications with 
restlet  2.0 (e.g.1.1.9) when using the servlet extension and config in a 
web.xml file?

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