Re: Batch calls?

2013-07-29 Thread Stephan Koops
Hi,

the bulk deleter is not restful. A URL should describe a thing, not an 
action.
But there is another solution: You could create a resource, that 
represents multiple customers:
/customers/1-22-65-75
1, 22, 65 und 75 are e.g. the primary keys in the database.

That Resource could be loaded (e.g. a link to the details) and it could 
be deleted.

DELETE /customer/1-22-65

best regards
Stephan

On Thu, Jul 25, 2013 at 7:30 PM, dbaq mailto:ic...@hotmail.fr>> wrote:

Hi Fabian,

This is almost what I want. Here is what I want :

POST /bulkdeleter
["/customer/1", "/customer/22", ...]

 From my /bulkdeleter  I want to execute DELETE /customer/1 and get
the response then I want to execute DELETE /customer/2 and get the
response.
Then I want to return from /bulkdeleter the list of responses
formatted in JSON (error or not)

How can I do that ?

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

Aw: RE: Batch calls?

2013-07-25 Thread Stephan Koops

Hi,

 
to allow big and easy scalability REST does support sessions or something like 
that.


It is the good way to authenticated the user every call. Maybe you could 
use HTTPS?


best regards

   Stephan

 

Gesendet: Donnerstag, 25. Juli 2013 
um 20:42 Uhr
Von: dbaq 
An: discuss@restlet.tigris.org, gonzajg 

Betreff: RE: Batch calls?

Hi folks,

we are in 2013 now, are we able to do something like the FB batch with 
restlet?

I have tried to do something like that:

Restlet dispatch = getContext().getClientDispatcher();
Request request = new Request(Method.GET, "customers");
request.setProtocol(Protocol.HTTP);
Response response = dispatch.handle(request);

but it fails, I don't want to authenticate my client every time, what's 
the good way to do that?

thanks

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3061308";
 
target="_blank">http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3061308




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


AW: Problem with delete method in my client application

2013-05-25 Thread Stephan Koops
Hi,

Your application design is not restful. You don't have to use the 
representation data to identify your business object. You identify your 
business object only with the URL.

The representation contains only the business object, not the information to 
locate it.
For that reason a delete request has on entity.

But this does not allow a NullPointerException :-). An IllegalArgumentException 
would be better.

Best regards
   Stephan

-- Urspr. Mitt. --
Betreff: Problem with delete method in my client application
Von: Sergio 
Datum: 25.05.2013 02:08

Hi all! I'm a newbie with Restlet and I have a problem. I created a service 
that works perfectly but my client application does not. It fails when I invoke 
the DELETE method. GET, POST and PUT works fine.

This is the code from my client application:

JSONObject object = new JSONObject();

object.put("name", "a name");

Request request = new Request(Method.DELETE, reference);

request.setEntity(new JsonRepresentation(object.toString()));

Client client = new Client(Protocol.HTTP);
Response response = client.handle(request);
String text = response.getEntity().getText();

The code from the ServerResource class:

public class MyResource extends ServerResource {

@Delete
public Representation deleteUser(Representation entity) {
try {
String jsonString = (new 
JsonRepresentation(entity)).getJsonObject().toString();
Map map = (Map) (new JSONParser()).parse(jsonString);

if(map.size() > 0) {
String message = dbc.deleteUser(map.get("name").toString());

return new StringRepresentation(message, MediaType.TEXT_PLAIN);
} else {

return new StringRepresentation("Unable to delete user", 
MediaType.TEXT_PLAIN);
}
} catch (Exception ex) {
return new StringRepresentation("ERROR: " + ex.getMessage(), 
MediaType.TEXT_PLAIN);
}
}
... }

POST and PUT methods start with the same code. I tested each method using 
Advanced Rest Client in Chrome and all of them works perfectly. It only fails 
in my client application. This is the exception:

java.lang.NullPointerException
at java.io.StringReader.(Unknown Source)
at org.json.JSONTokener.(JSONTokener.java:66)
at org.json.JSONObject.(JSONObject.java:402)
at 
org.restlet.ext.json.JsonRepresentation.getJsonObject(JsonRepresentation.java:199)
at service.MyResource.borrarUsuario(MyResource.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at 
org.restlet.resource.ServerResource.doHandle(ServerResource.java:503)
at 
org.restlet.resource.ServerResource.delete(ServerResource.java:208)
at 
org.restlet.resource.ServerResource.doHandle(ServerResource.java:594)
at 
org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:649)
at 
org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:348)
at 
org.restlet.resource.ServerResource.handle(ServerResource.java:952)
at org.restlet.resource.Finder.handle(Finder.java:246)
at org.restlet.routing.Filter.doHandle(Filter.java:159)
at org.restlet.routing.Filter.handle(Filter.java:206)
at org.restlet.routing.Router.doHandle(Router.java:431)
at org.restlet.routing.Router.handle(Router.java:648)
at org.restlet.routing.Filter.doHandle(Filter.java:159)
at org.restlet.routing.Filter.handle(Filter.java:206)
at org.restlet.routing.Filter.doHandle(Filter.java:159)
at org.restlet.routing.Filter.handle(Filter.java:206)
at org.restlet.routing.Filter.doHandle(Filter.java:159)
at 
org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)
at org.restlet.routing.Filter.handle(Filter.java:206)
at org.restlet.routing.Filter.doHandle(Filter.java:159)
at org.restlet.routing.Filter.handle(Filter.java:206)
at 
org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)
at 
org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:84)
at org.restlet.Application.handle(Application.java:381)
at org.restlet.routing.Filter.doHandle(Filter.java:159)
at org.restlet.routing.Filter.handle(Filter.java:206)
at org.restlet.routing.Router.doHandle(Router.java:431)
at org.restlet.routing.Router.handle(Router.java:648)
at org.restlet.routing.Filter.doHandle(Filter.java:159)
at org.restlet.routing.Filter.handle(Filter.java:206)
   

Aw: Re: UriBuilder encoding

2012-02-13 Thread Stephan Koops
Hi,it could be, that the 
UriBuilder does not respect some encoding settings.If it is a 
bug, you could create a patch.best 
regards   
Stephan  SMS schreiben mit WEB.DE 
FreeMail - einfach, schnell und   kostenguenstig. Jetzt 
gleich testen! http://f.web.de/?mc=021192";>http://f.web.de/?mc=021192


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


Re: How to implement role based authorization with the JAX-RS extension?

2011-12-05 Thread Stephan Koops
Hi Mark,

did you took a look to the interface SecurityContext, method isUserInRole()?

best regards
 Stephan

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


Re: Wrong media type is selected for the GET request with JAX-RS

2011-12-05 Thread Stephan Koops
Hi Mark,

> It is a bit more complex. Providers are wrapped with the 
> AbstractProviderWrapper, which assumes that if a provider is not annotated 
> with @Produces, then it produces */*. Similarly, if it is not annotated with 
> @Consumes, then it consumes */*.
That is as defined in the spec:

"Application classes can declare the supported request and response 
media types using the @Consumes and @Produces annotations respectively. 
[...] In the absence of either of these annotations, support for any 
media type (“*/*”) is assumed."

For details see 
http://download.oracle.com/otn-pub/jcp/jaxrs-1.1-mrel-eval-oth-JSpec/jax_rs-1_1-mrel-spec.pdf,
 
Chapter 3.5, page 15.
> By itself, ConverterProvider is OK. But it must not be wrapped with 
> AbstractProviderWrapper.
Why not?
> I really appreciate your work on the JAX-RS extension, it makes working with 
> Restlet a much more pleasant experience. But I guess you are currently not in 
> a position to fix bugs in it, are you?
I think I could, if it is not lost with the change to github, but shouldn't.
But I have to set up the environment, github plugin and so on, but I 
have not the time for this.

best regards
Stephan

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


Re: Wrong media type is selected for the GET request with JAX-RS

2011-12-01 Thread Stephan Koops
Hi,

than it is a bug in the ConverterProvider, which should check, if it 
could handle the class or object.

Am 01.12.2011 19:57, schrieb Mark Kharitonov:
> No, there is no bug in the algorithm defined by the spec. The bug is that 
> ConverterProvider reports */* as the media type it supports.
>
> Why is so? Because it is annotated with neither the @Consumes nor the 
> @Produces annotation and thus AbstractProviderWrapper thinks that it produces 
> */* and consumes */*.

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


Re: Restlet vs JAX-RS

2011-12-01 Thread Stephan Koops
Hi Tim,

ok, that I didn't know; I used Restlet before annotations come in.

best regards
 Stephan

Am 01.12.2011 19:03, schrieb Tim Peierls:
> On Thu, Dec 1, 2011 at 12:15 PM, Stephan Koops  <mailto:stephan.ko...@web.de>> wrote:
>
> what I forgot in my last email:
> In JAX-RS you are not required to call the serialisation /
> deserialisation logic. You implement the MessageBodyReader/Writer,
> give it to the ruintime environment, and they are called by the
> JAX-RS runtime. In Restlet you have to check the media type the
> client sent, decide which Deserialzer you have to use and call the
> deserialization. The same at the end: Check the accepted media
> types, decide and call the serialization. in JAX-RS you are not
> required to care about that, because the runtime will do it.
>
>
> Not sure what you mean. The Restlet ConverterService handles 
> serialiation/deserialization. You can write resource handler methods 
> like this:
>
> @Post public User addUser(User newUser) { ... }
>
> --tim

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

Re: Integrating a 3rd party Dependency Injection engine with JAX-RS extension.

2011-12-01 Thread Stephan Koops
Hi Mark,

you are right, there is room for improvement.
You could call it a bug or a feature request ...

best regards
    Stephan

-Ursprüngliche Nachricht-
Von: "Mark Kharitonov" 
Gesendet: 30.11.2011 22:33:28
An: discuss@restlet.tigris.org
Betreff: Integrating a 3rd party Dependency Injection engine with JAX-RS 
extension.

>I am using google guice and wish to integrate it with the JAX-RS extension. On 
>the surface, everything is simple and clean:
>
> final JaxRsApplication application = new 
> JaxRsApplication(component.getContext().createChildContext());
> application.setObjectFactory(new ObjectFactory() {
>
> @Override
> public  T getInstance(Class jaxRsClass) throws InstantiateException {
> return Injector.getInstance(jaxRsClass);
> }
> });
>
>True, when JAX-RS wishes to create an instance of a resource handler it 
>consults the object factory first, which is excellent. But, there are certain 
>validations that JAX-RS performs on the resource handler type and these 
>validations totally ignore the presence of an object factory. Observer the 
>following stack trace:
>
>WrapperUtil.findJaxRsConstructor(Class, String) line: 242
>PerRequestRootResourceClass(RootResourceClass).(Class, 
>ThreadLocalizedContext, JaxRsProviders, ExtensionBackwardMapping, Logger) 
>line: 141
>PerRequestRootResourceClass.(Class, ThreadLocalizedContext, 
>JaxRsProviders, ExtensionBackwardMapping, Logger) line: 82
>ResourceClasses.getPerRequestRootClassWrapper(Class) line: 276
>ResourceClasses.addRootClass(Class) line: 104
>JaxRsRestlet.addClass(Class) line: 283
>JaxRsApplication.add(Application) line: 149
>Program.main(String[]) line: 60
>
>What happens is that JAX-RS looks for the public constructors satisfying its 
>instance creation constraints. In my case, the resource handler class has a 
>single public non default constructor not annotated with any of the JAX-RS 
>attributes. Indeed, this constructor is invoked by the dependency injection 
>engine only (guice in my case) from the object factory.
>
>I think, that JAX-RS should not fail if it does not find any suitable 
>constructor and the object factory is registered. Seems like a bug?
___
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192

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


Re: Re: Wrong media type is selected for the GET request with JAX-RS

2011-12-01 Thread Stephan Koops
Hi Mark,

you are right. I forgot the generic providers. Then there is the bug in the 
runtime, which you showed. Or there is a bug in the algorithm defined by the 
spec. But that's implausible ...
Feel free to fix it and post a patch for it.

best regards
    Stephan

-Ursprüngliche Nachricht-
Von: "Mark Kharitonov" 
Gesendet: 30.11.2011 21:49:31
An: discuss@restlet.tigris.org
Betreff: RE: Re: Wrong media type is selected for the GET request with JAX-RS

>You are wrong. The framework suggests three message body writers without a 
>single bit of help from me:
> - org.restlet.ext.jax​rs.internal.provider​.JaxbProvider
> - org.restlet.ext.jaxr​s.internal.provider.​ConverterProvider
> - org.restlet.ext.jaxr​s.internal.provider.​JsonProvider
>
>Both JaxbProvider and ​JsonProvider have no problems converting 
>com.shunra.poc.User into the respective XML or JSON representation.

___
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192

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


Re: Re: Validating URL query parameters.

2011-12-01 Thread Stephan Koops
Hi,

> You can't operate on your resource until it exists :)

That's not fully true: You could create it with PUT. But you have to remeber, 
that you have not a generated primary key, if you need it. But maybe you could 
PUT to /users/ . But then it is possible that 
you override an existing user with the same short name.
It is the best, to create a user via the users resource.

best regards
    Stephan  https://img.ui-portal.de/p.gif"; width="1" height="1" border="0" alt="" 
/>SMS schreiben mit WEB.DE FreeMail - einfach, schnell 
und   kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192";>http://f.web.de/?mc=021192


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


Re: Re: Restlet vs JAX-RS

2011-12-01 Thread Stephan Koops
Hi,

what I forgot in my last email:
In JAX-RS you are not required to call the serialisation / deserialisation 
logic. You implement the MessageBodyReader/Writer, give it to the ruintime 
environment, and they are called by the JAX-RS runtime. In Restlet you have to 
check the media type the client sent, decide which Deserialzer you have to use 
and call the deserialization. The same at the end: Check the accepted media 
types, decide and call the serialization. in JAX-RS you are not required to 
care about that, because the runtime will do it.

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: Ivan 
Gesendet: 30.11.2011 23:37:44
An: discuss@restlet.tigris.org
Betreff: RE: Re: Restlet vs JAX-RS

>Say, user needs to build RESTful HTTP services. He can do it using either 
>frameworks with proprietary API (like Restlet, Restfulie) or frameworks 
>supporting JAX-RS API (like Jersey, Apache CXF and Restlet as well). I would 
>agree they are incomparable things but at then end they serve the same 
>purpose. So, selecting from your list the question is more about choosing 
>between JAX-RS annotations and the Restlet annotations. But I think (from my 
>limited Restlet knowledge) the difference is much more than just annotations.
___
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192

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


Re: Wrong media type is selected for the GET request with JAX-RS

2011-11-30 Thread Stephan Koops
I forgot: The algorithm to find the message body writer is specified by 
the JAX-RS specification.

Am 30.11.2011 09:42, schrieb Mark Kharitonov:
> I have more input on this issue. The problem lies in the 
> org.restlet.ext.jaxrs.internal.provider.ConverterProvider, which is amongst 
> the three media writer providers selected by the framework for my response.
>
> This particular provider contributes */* to the list of the supported media 
> types, which in turn is compatible with text/html and this is how text/html 
> is later selected as the response media type.
>
> What is this org.restlet.ext.jaxrs.internal.provider.ConverterProvider? What 
> purpose does it serve? How should I utilize it? Adding */* to the list of the 
> supported media types implies that this particular provider knows to write 
> any media type. How come?

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


Re: Wrong media type is selected for the GET request with JAX-RS

2011-11-30 Thread Stephan Koops
Hi,

I think that no providers knows, how to serialize a com.shunra.poc.User. 
You have to give a MessageBodyWriter for this. Or which one should do it?

best regards
Stephan

Am 30.11.2011 09:42, schrieb Mark Kharitonov:
> I have more input on this issue. The problem lies in the 
> org.restlet.ext.jaxrs.internal.provider.ConverterProvider, which is amongst 
> the three media writer providers selected by the framework for my response.
>
> This particular provider contributes */* to the list of the supported media 
> types, which in turn is compatible with text/html and this is how text/html 
> is later selected as the response media type.
>
> What is this org.restlet.ext.jaxrs.internal.provider.ConverterProvider? What 
> purpose does it serve? How should I utilize it? Adding */* to the list of the 
> supported media types implies that this particular provider knows to write 
> any media type. How come?
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2889245

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


Re: Restlet vs JAX-RS

2011-11-30 Thread Stephan Koops
Hi,

what I think is good is that you have no boilderplate code. You code 
only, what your logic should do.
And you have good builder classes for the responses.

best regards
 Stephan

Am 28.11.2011 11:59, schrieb Ivan:
> Hi all,
>
> Why would one (or why did you) nowadays select using Restlet API over 
> strictly JAX-RS API for Java server side development? What are the 
> main advantages of Restlet own API? Anything you could do with this 
> that cannot be done (or more difficult to do) with JAX-RS API?
>
> Cheers,
> Ivan

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


Re: JAX-RS on Tomcat

2011-11-18 Thread Stephan Koops
Hi Morgan,

I only looked some minutes in the code.
Do you tried http://localhost:8181/easy ?

best regards
Stephan

Am 15.11.2011 22:46, schrieb Morgan Taschuk:
> Hi all,
>
> I have an application running on Tomcat with a 'pure' Restlet web app, but 
> I'm having problems with the JAX-RS extension.
>
> I'm following the directions on the tutorial at 
> http://wiki.restlet.org/docs_2.0/13-restlet/28-restlet/57-restlet.html along 
> with the suggested web.xml in the first comment. The application works when I 
> run 'ExampleServer' starting a Jetty server on 8182, but does not work in 
> Tomcat 7.0.14 on Ubuntu 11.10. I can't see what's wrong with my web.xml.
>
> In package restlettest, I have four files: EasyRootResource, 
> ExampleApplication, ExampleServer, and MyJaxRsApplication. All of the code in 
> those classes is identical to the tutorial. Then I have my web.xml:
>
> 
>  xmlns="http://java.sun.com/xml/ns/j2ee";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
>  first steps servlet
> 
>  
>  org.restlet.ext.jaxrs.JaxRsApplication
>  restlettest.MyJaxRsApplication
>  
>
> 
>  
>  RestletServlet
>  org.restlet.ext.servlet.ServerServlet
>  
>
> 
>  
>  RestletServlet
>  /*
>  
> 
>
> When I drop it into my Tomcat instance, there are no error messages in any of 
> the log files. When I navigate to 
> http://localhost:8181/jaxrs-restlet-test-1.0-SNAPSHOT/easy (8181 is my Tomcat 
> instance), I get a 404 not found error.
>
> I've zipped my test project up and put it online at 
> http://dl.dropbox.com/u/4048178/jaxrs-restlet-test.zip . It's a maven 
> project, so you can build it yourself or you can use the war that was 
> compiled in the target directory.
>
> I would really appreciate any insight that you could provide with this.

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


RE: Re: JAX-RS and charsets in posts

2011-11-02 Thread Stephan Koops
I think FormReade is a general restlet class, not especially JAX-RS, right? 
Than it could be a general issue.

best regards
  Stephan

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


Re: Re: 2.0.3: re-deploying a JAXRS application without restarting the JVM

2011-09-29 Thread Stephan Koops
Hi Simon,

as I implemented the JAX-RS-extension three and a half years ago, the 
JaxRsRestlet was add-only, because all the things in a javax.ws.rs.Application 
are added to the Restlet-JAX-RS-Instance. So, if you remove, you have to see, 
what providers and so on you have to remove, and which you have to leave, 
because they are also added by another JAX-RS-Application. I've long time not 
looked into the code, so I can't tell something to setApplications().
You could implement a clear, but don't forget to readd the default providers 
and so on; there must be a method for it somewhere (in the JaxRsRestlet?).

I've no experience this OSGI, so I can't say something to Restlet and OSGI.

best regards
    Stephan

-Ursprüngliche Nachricht-
Von: "Simon Temple" 
Gesendet: 29.09.2011 17:44:02
An: discuss@restlet.tigris.org
Betreff: RE: Re: 2.0.3: re-deploying a JAXRS application without restarting the 
JVM

>Apologies for the multiple postings...
>
>IMHO, I think setApplications() should not "Add the given applications to the 
>available applications" I think it should *replace* the available applications 
>with those given.
>
>wdyt?
___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! https://produkte.web.de/mailcheck/

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


Re: Is Multiple Get and Put annotations Possible?

2011-09-29 Thread Stephan Koops
Hi Deep,

if you mean
@Get(...)
@Get(...)
public ...
{
}

That is not allowed from Java, so you can't compile it.

If you mean
@Get(...)
@Put(...)
public ...
{
}

Than it is nonsense from REST point of view.

For the documentation I can't help you.

bets regards
  Stephan

-Ursprüngliche Nachricht-
Von: "D G" 
Gesendet: 29.09.2011 14:16:35
An: discuss@restlet.tigris.org
Betreff: RE: Is Multiple Get and Put annotations Possible?

>I don't see a section called "Annotations Parameter". Am I missing some thing
>here ? Also, is there any tutorial or documentation with details @
>annotation in RestLet.
>
>Thanks,
>Deep
___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! https://produkte.web.de/mailcheck/

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


Re: 2.0.3: re-deploying a JAXRS application without restarting the JVM

2011-09-29 Thread Stephan Koops
Hi Simon,

AFAIK there is nothing implemented in the JAX-RS runtime to support this. I 
can't say anything about the hot deployment of Restlet. Do you tried to denbug 
it? I meen: Start in debug mode, try again and interrupt, if Restlet hangs.

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: "Simon Temple" 
Gesendet: 29.09.2011 12:20:17
An: discuss@restlet.tigris.org
Betreff: 2.0.3: re-deploying a JAXRS application without restarting the JVM

>I'm trying to all add classes to my JaxRs application at run-time but this 
>seems to hang Restlet - I can connect to the HTTP port but get no response.
>
>Is it possible to hot deploy JaxRS classes?
>
>I currently do something a bit like this to redeploy:
>
> comp.stop
> this.application.stop();
> comp.getDefaultHost().detach(this.application);
>
> this.application = new JaxRsApplication( comp.getContext( 
> ).createChildContext( ) );
> this.application.add( JaxRsApp.getInstance( ) );
> this.comp.getDefaultHost( ).attach( "/rest/", this.application );
> comp.start();
___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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


Re: Issue 897

2011-09-26 Thread Stephan Koops
Hi Ali,

maybe you could fix it and send a patch.

best regards
  Stephan

-Ursprüngliche Nachricht-
Von: "Ali Naddaf" 
Gesendet: 26.09.2011 00:51:37
An: discuss@restlet.tigris.org
Betreff: Issue 897

>Hello everyone.
>
>Is there any plan for addressing issue 897 
>(http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4375&viewType=browseAll&dsMessageId=2395912#messagefocus)?
> My project is running into this issue and although the issues target release 
>says 2.0, I don't see that as resolved yet. Any update on that would be 
>greatly appreciated.
>
>Thanks,
>Ali.


___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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


Re: JAX-RS simple binary file download

2011-08-26 Thread Stephan Koops
Hi Pete,

this should work.
Do you checked it with the debugger?

best regards
   Stephan


-Ursprüngliche Nachricht-
Von: "Peter Murray" 
Gesendet: 25.08.2011 16:22:33
An: discuss@restlet.tigris.org
Betreff: JAX-RS simple binary file download

>Greetings folks,
>
>I'm trying to implement a simple binary transfer of a file from client to 
>server using the JAX-RS extension for restlet. I have a method similar to this:
>
>@GET
>@Path("/download")
>@Produces("application/octet-stream")
>public InputStream download()
>{
> return new FileInputStream(myBinaryFile);
>}
>
>When I use a REST proxy client (or invoke the /download resource with a 
>debugging tool), I consistently get only the first few hundred bytes of the 
>file. The contents appear to be the legitimate contents of the file, but only 
>the first part of the file. The number of bytes is different each request.
>
>Is this a legitimate JAX-RS configuration? Has anyone successfully gotten this 
>to work?
>
>Cheers,
>
>pete
>
>--
>http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2829698


___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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


Re: Is JAX-RS in Restlet experimental?

2011-06-07 Thread Stephan Koops
Hi Daku,

this extension I developed as my matser thesis. Unfortunately I had afterwods 
no time to finish this work, so it's not ready.
I wouldn't say it is expermiental any more, but it's not fully finished.

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: "lambda daku" 
Gesendet: 07.06.2011 13:55:37
An: discuss@restlet.tigris.org
Betreff: Is JAX-RS in Restlet experimental?

>Hi,
>
>I have just found while checking out "jaxrs and test" project's source code,
>where the author is clearly stating that the support for jaxrs within
>restlet is "experimental". I wish if this is a typo which author (Mr. Koops)
>forgot to omit.
>
>Could you please confirm?
>
>Daku
___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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


Re: Issue with Range

2011-05-19 Thread Stephan Koops
Hi Thierry, hi Tom, hi committers,I've took a look into 
he sourcecode via tigris and browser directly, and found the following 
sourceif (index != -1) 
{
int startIndex = 
Integer.parseInt(value.substring(0, index));
int endIndex = 
Integer.parseInt(value.substring(index + 1, index1));
representation.setRange(new 
Range(startIndex, endIndex - startIndex + 1)); !
}The line marked with  
isrepresentation.setRange(new 
Range((long)startIndex, (long)endIndex - 
startIndex + 1));because the Range constructor parameters are declared as 
long. So please 
change Integer.parseInttolong.parseLongtwo 
times. Tom will thank you very much. :-)(I have no up to date workspace, 
so that I have to fully set up a new one).best 
regards   Stephan-Ursprüngliche 
Nachricht-Von: "Stephan Koops" 
<stephan.ko...@web.de>Gesendet: 19.05.2011 17:45:04An: 
discuss@restlet.tigris.orgBetreff: Re: Issue with Range>Hello 
Tom,>>>3980273410 is the size of the file that i'm trying to 
transfer. actually its>>the index of the last byte of the file. all 
of my variables are declared as>>long -- the catalina stack trace 
shows:>>>> 
at>>java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)>>
 at java.lang.Integer.parseInt(Integer.java:461)>> at 
java.lang.Integer.parseInt(Integer.java:499)>> at 
org.restlet.engine.http.header.RangeReader.update(RangeReader.java:65)>>This
 StackTrace shows, that it is an int here (parseInt() ). You have to look in 
the source code, what happens here (I haven't the current code here), which 
value is parsed. Maybe you could have luck, that parseInt is a bug and should 
be parseLong. Class org.restlet.data.Range has long 
attributes.>>best regards>    
Stephan>>___>Schon
 gehört? WEB.DE hat einen genialen Phishing-Filter in die>Toolbar 
eingebaut! 
http://produkte.web.de/go/toolbar>>-->http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2741411  ;https://img.ui-portal.de/p.gif"; width="1" height="1" border="0" alt="" 
/>Schon gehört? WEB.DE hat einen genialen Phishing-Filter 
in die   Toolbar eingebaut! http://produkte.web.de/go/toolbar";>http://produkte.web.de/go/toolbar


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


Re: Issue with Range

2011-05-19 Thread Stephan Koops
Hello Tom,

>3980273410 is the size of the file that i'm trying to transfer. actually its
>the index of the last byte of the file. all of my variables are declared as
>long -- the catalina stack trace shows:
>
> at
>java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> at java.lang.Integer.parseInt(Integer.java:461)
> at java.lang.Integer.parseInt(Integer.java:499)
> at org.restlet.engine.http.header.RangeReader.update(RangeReader.java:65)

This StackTrace shows, that it is an int here (parseInt() ). You have to look 
in the source code, what happens here (I haven't the current code here), which 
value is parsed. Maybe you could have luck, that parseInt is a bug and should 
be parseLong. Class org.restlet.data.Range has long attributes.

best regards
    Stephan

___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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


Re: Issue with Range

2011-05-19 Thread Stephan Koops
Hi Tom,

the value 3.980.273.410 is too big for an int, which works from -2.147.483.648 
until 2.147.483.647.
Where does this value comes from? Could you reduce the number of this value? If 
not, than I think the only solution is to change the type of the variable from 
int to long. If this is also not possibe, than you have bad luck :-( .

best regards
    Stephan

-Ursprüngliche Nachricht-
Von: TKM 
Betreff: Issue with Range

>I'm using Directory to share files, but i would also like to allow aborted
>transfers to restart. Both server and client are Restlet implementations
>that rely on streams for the transfer. I added Range to the ClientResource
>and started to get the message: Internal Connector Error (1002) - For input
>string: "3980273410". When i look at catalina.log, i see
>java.lang.NumberFormatException: For input string: "3980273410". So, i'm
>guessing that i can't use -1 as the Range size? so the following is goofy?
>
>ClientResource resource = new ClientResource(restRequest);
>resource.getRanges().add(new Range(range, Range.SIZE_MAX));
___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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


Re: Re: Re: access GET body parameters

2011-05-13 Thread Stephan Koops
Hi,

for authentication you could use HTTP authentrication.
Se  http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet/46-restlet.html

Best regards
    Stephan


-Ursprüngliche Nachricht-
Von: kocisky 
Gesendet: 13.05.2011 22:01:35
An: discuss@restlet.tigris.org, "Stephan Koops" 
Betreff: RE: Re: Re: access GET body parameters

>so i would do something like that:
>
>1) client authentication -> POST (of credentials) -> to server
>2) client request data -> GET of rest resource -> server (if authenticate 
>return data else error)
>
>is this a common approach?
>thanks !!!
>kocisky
___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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


Re: Re: access GET body parameters

2011-05-13 Thread Stephan Koops
Hi kocisky,

you could use POST ior mabye PUT. There you could send a body.

best regards
    Stephan

-Ursprüngliche Nachricht-
Von: kocisky 
Gesendet: 13.05.2011 21:19:27
An: discuss@restlet.tigris.org, "Stephan Koops" 
Betreff: RE: Re: access GET body parameters

>Hi Stephan,
>
>thank you for your reply, sorry for my newbie question!
>so if i understood well there is no way to have a request/response challenge 
>with the data (parameters and response data) protected in the body, right ?
>
>do you see a different framework/solution that i might be interested in?
>
>thanks!!
>Kocisky
___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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


Re: access GET body parameters

2011-05-12 Thread Stephan Koops
Hi kocisky,

in HTTP it is not allowed to send data in a GET body, so it is not allowed in 
Restlet.

The reason is, that the result of a GET request is defined by the header 
parameters, so that you could cache them and so on.
For details see the dissertation of Roy Fielding: 
http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: kocisky 
Gesendet: 12.05.2011 14:50:52
An: discuss@restlet.tigris.org
Betreff: access GET body parameters

>Hi,
>
>i would like to access the body of the GET request from a restlet 2.0
>resource. This for a few reasons:
>
>- i would like to send parameters (in a JSON format) in the GET request,
>lets say for example "return the full object that has these fields/values
>... "
>
>- i would like to protect the parameters of the URL request using https, and
>if i specify them as url parameters i cant protect them.
>
>- i would like to avoid very long urls.
>
>i was also reading:
>http://stackoverflow.com/questions/978061/http-get-with-request-body
>
>could you suggest me an approach? do you see a better solution?
>thanks !!!
>kocisky
>
>--
>View this message in context: 
>http://restlet-discuss.1400322.n2.nabble.com/access-GET-body-parameters-tp6355657p6355657.html
>Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
>--
>http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2735012
___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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


Re: Using the Jetty connector

2011-03-10 Thread Stephan Koops
Hi John,

the exception says, that port, where your server should listen is, 
already in use. There is another process blocking one of the ports 8182 
or 8183. Is it a pervious started version of your code?

best regards
Stephan

> 2011-03-09 17:30:29.439:INFO::jetty-7.3.1.v20110307
> 2011-03-09 17:30:29.440:WARN::FAILED
> SelectChannelConnector@0.0.0.0:8182: java.net.BindException: Address
> already in use
> 2011-03-09 17:30:29.440:WARN::FAILED
> org.restlet.ext.jetty.JettyServerHelper$WrappedServer@716c9867:
> java.net.BindException: Address already in use
> Mar 9, 2011 5:30:29 PM org.restlet.Restlet handle
> WARNING: Unable to start the Restlet
> java.net.BindException: Address already in use
>   at sun.nio.ch.Net.bind(Native Method)
>   at 
> sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:137)
>   at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:77)
>   at 
> org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:170)
>   at 
> org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:356)
>   at 
> org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:248)
>   at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
>   at org.eclipse.jetty.server.Server.doStart(Server.java:269)
>   at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
>   at 
> org.restlet.ext.jetty.JettyServerHelper.start(JettyServerHelper.java:395)
>   at org.restlet.Server.start(Server.java:585)
>   at org.restlet.Restlet.handle(Restlet.java:227)
>   at org.restlet.Server.handle(Server.java:485)
>   at org.restlet.engine.ServerHelper.handle(ServerHelper.java:71)
>   at 
> org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:150)
>   at 
> org.restlet.ext.jetty.JettyServerHelper$WrappedServer.handle(JettyServerHelper.java:167)
>   at 
> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:581)
>   at 
> org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1040)
>   at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:592)
>   at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
>   at 
> org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
>   at 
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:526)
>   at 
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:41)
>   at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:528)
>   at java.lang.Thread.run(Thread.java:636)

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


Re: Request to servlet : parameter key/value

2011-01-10 Thread Stephan Koops
Hi Hubert,

> Representation rep =*new JsonRepresentation(myJsonObject)*;
> rep.setMediaType(MediaType.APPLICATION_WWW_FORM);
> Request request = new Request(Method.POST, 
> "http://127.0.0.1:8080/myServlet",rep);
> Response response = client.handle(request);
>
> But the servlet*receive a JSONObject*  :
> {"param1":"value1",}
You send a JSON-Object, and you get one. The computer does always what 
you ask him to do ... ;-)

I think you should send a form, but I don't know, ho to do this now.

good luck
Stephan

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

Re: What replaces GetEntityAsForm?

2010-12-22 Thread Stephan Koops
Hi Beefnugget,

I thinks the must be something like

new Form(request.getEntity());

I'm not sure

Am 22.12.2010 21:23, schrieb Beefnugget:
> The javadoc for 2.0 says:
>
> getEntityAsForm
>
> @Deprecated
> public Form getEntityAsForm()
> Deprecated. Will be removed in future release 2.1.
> Returns the entity as a form. This method can be called several times and
> will always return the same form instance. Note that if the entity is large
> this method can result in important memory consumption.
> Returns:
> The entity as a form.
>
> So what is the proper way to read form POST data now in version 2.1?

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


Re: Restlet DigestAuthenticator hashed local secret

2010-12-06 Thread Stephan Koops
Hi Finbarr,

> The problem is that my LocalVerifier class will return passwords from the 
> database that have been hashed as I do not want my users' passwords to exist 
> in the db in plain text. How can I set up the DigestAuthenticator to hash the 
> secret provided by the client request before it digests and compares? (Or am 
> I going about all of this in the wrong way?)
That is definitve the right way, but I can't tell you, how to do it.

best regards
 Stephan

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


Re: JAX RS + Tomcat (Servlet Container)

2010-11-25 Thread Stephan Koops
Hi Torsten,

this is a point for improvement. The JAX-RS extension have to be 
imporved to read "Servlet compatible", but we must not forget to be 
compatible with non Servlet connectors. And the JAX-RS extension should 
have no dependency to the Servlet API.

Could you create a patch for this? Please file a bug on the issue tracker.

best regards
Stephan

Am 24.11.2010 20:43, schrieb webp...@tigris.org:
> Hi,
>
> we are using the Restlet Framework 2.0.3 with a Servlet Adapter in a Tomcat 
> which forwards the requests to a JaxRsApplication.
>
> Using a standalone application the POST method worked fine, parameters have 
> been extracted as expected.
>
> However running it inside the problem the POST parameters of the http servlet 
> request had not been extracted by the JaxRsApplication.
>
> After debugging it we figured that the JaxRsApplication reads the parameters 
> from the input stream. Due to some servlet filters run before actually 
> calling the JaxRsApplication at some point request.getParameterMap() and then 
> the Tomcat reads the input stream into those parameters. Now JaxRs is trying 
> to read the parameters again from the input stream, which is just not 
> possible, because it has been already read.
>
> Is there any way to avoid this behavior, for example let the JaxRs read the 
> parameters from the request.getParameter functions instead of exploring the 
> input stream?
>
> What other options are left to use Restlet with JaxRs extension in a servlet 
> container?
>
> Thank you in advance,
> Torsten

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


Re: Adding "sessions" to a REST(let) application

2010-11-19 Thread Stephan Koops
Hi Fabian,
It could be renewed with every request send to the server. This is the
>> same as with sessions.
> So, the cookie has to be "refreshed" (so to speak) on each request?
If you want to save a new cookie, than yes. Because you have to renew 
the expiration timestamp you have to send a new  timestamp.
> Should I also store cookie-user state somewhere?
I think to count the users you have to do this, but I'm not sure. Then 
you have to implement sessions, than you could also use Servlet sessions
You should put this in a filter (independently if for servlet or for 
Restlet), so that your application stays free of it.
> So, the architecture would be like this:
>
> Client --- Request -->  Servlet API authentication "frontend" ---
> Request --->  REST Statleless core
Yes.
> I'd have to sort of change my Guard for something using the Servlet
> API? Can I integrate that into my existing Guard (I already have
> guarded resources)?
There I can't tel you much. I think there is something in Restlet to 
read authentication data from e.g. Servlet API, but I'm not sure. Take a 
look to the server connector main class.

best regards
Stephan

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


Re: Adding "sessions" to a REST(let) application

2010-11-19 Thread Stephan Koops
Hi Fabian,
> We thought about having the client send a cookie (I'm cookie-ignorant)
> with each request, and have the resources check that cookie, which
> would 'expire' after a given ammount of time, or when the user
> explicitly states so (there's a Logout button on our UI, which just
> works on IE and FF for now, using a REST-based "logout" technique:
> basically it sends bogus authentication credentials invalidating the
> browser's cached ones). Cookies seem to be accepted as a RESTful way
> of exchanging such "state" information.
>
> This of course, posses another issue, how does the user renew the
> cookie when the session is nearing expiration? Is this handled
> automatically? As I've mentionned above, I'm cookie-ignorant, forgive
> me if I ask nonsense.
It could be renewed with every request send to the server. This is the 
same as with sessions.
> Now, REST principles state that the server must not store any
> application state (for example, user sessions), so this seems to
> contradict our (commercially-motivated, agreed) needs.
You could handle this via Servlet API. Than your Restlet application 
stays stateless, and you have your session to chek.

best regards
 Stephan

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


Re: Jax-RS POST MediaType.MULTIPART_FORM_DATA Problem

2010-11-15 Thread Stephan Koops
Hi Simon,

I think, this is an open issue. I helped myself with a workaround like 
you have done. Maybe you could directly request a Form. I'm not sure. 
With the form I called the JAX-RS method that was originally planed (as 
your example in the first email). So you are very close to the right 
JAX-RS way.
Someone needs to fix this.

Thanks for the patch for issue 913.

best regards
   Stephan

Am 12.11.2010 19:13, schrieb Simon Temple:
> I tried adding breakpoints to the internal providers:
>
> org.restlet.ext.jaxrs.internal.provider.MultipartProvider
> org.restlet.ext.jaxrs.internal.provider.FileUploadProvider
>
> They don't get called.
>
> When ParameterList$FormParamGetter.getParamValue() is called to get the form 
> values it returns null.
>
> The entity Representation is: InputRepresentation and creating a Form( 
> entity) yields this:
>
> [(--180e37a65aa7
> Content-Disposition: form-data; name,"myField"
>
> hello
> --180e37a65aa7--
> )]
>
> Help!!
>
> please ;-)

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


Re: setStatus() 500 error with newline in description

2010-11-11 Thread Stephan Koops
Hi Frank,

the HTTP status line allows only one line. See e.g. 
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Server_response 
. This is not a Restlet restriction, this is a HTTP restriction.

best regards
Stephan

Am 10.11.2010 21:52, schrieb webp...@tigris.org:
> Hi All,
>
> I am trying to use setStatus with a newline in the description. This is a 
> snipper of the server code with the error:
>
> public String acceptGet(String in) throws Exception {
>  Status SERVER_ERROR_INTERNAL = new Status(530);  
>  getResponse().setStatus(SERVER_ERROR_INTERNAL, "This is 
> Get\nis\n\nBroken");
>
>  return "Get\nIs\nBroken\n";
> }
>
>
> This is the if statement in my client code example that is catching the 500 
> error:
>
> if (conn.getResponseCode() != 200) {
>  System.out.println(conn.getResponseCode());
>  System.out.println(conn.getResponseMessage());
>  System.exit(0);
> }
>
> When I point my client to the url this is the message I get:
> 530
> This is Get
>
> Everything after first newline gets chopped off.  Is it possible to have a 
> newline inside of the status description or was it designed purposely to only 
> allow 1 line?
>
> Thanks,
> Frank
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2680823

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


Re: Matching ";" in paths.

2010-10-27 Thread Stephan Koops
Hi Karel,

it is not possible in the JAX-RS extension, because this is the special 
meaning of ";".
you could encode the ";" to "%3A. See 
http://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters
 
for more details.

best regards
Stephan

Am 27.10.2010 12:30, schrieb Karel Vervaeke:
> Hi, is there a way to match colons in a path?
> Jax-rs' MatrixParams is sitting in my way I'm afraid
>
> My uris look like this: http://localhost/foo/a;b/bar
>
> My attempts so far look like this:
>
> @Path("foo/{params}/bar")
> public String fooBarTest1(@PathParam("params") String params) {
>   // doesn't work, params = "a" and the matrix params contain { b: null }
> }
>
> @Path("foo/{params:.+}/bar")
> public String fooBarTest2(@PathParam("params") String params) {
>   // same result
> }
>
> I was hoping there was a way to tell restlet / jax-rs that the ;
> character has no special meaning
>
> Any hints?
> Regards,
> Karel

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


Re: Does restlet support Marshalling and Unmarshalling?

2010-10-26 Thread Stephan Koops
Yes,

to XML, JSON, HTML and many others.

If you want to no more, you have to give more details.

best regards
Stephan

Am 26.10.2010 16:51, schrieb gato:
> Does restlet support Marshalling and Unmarshalling?
>
> thanks for the answers

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


Re: GuardedExample without using deprecated API

2010-10-09 Thread Stephan Koops
Hi Romain,

I don't if I answered to this question:

>  Now it is working but I am wondering about the RoleChecker. My 
> RoleChecker is like this :
>
>  @SuppressWarnings("deprecation")
>  private static final class RestletRoleChecker implements RoleChecker {
>
>  public boolean isInRole(Principal principal, String role) {
>  throw new RuntimeException("[isInRole] was called. We don't know 
> why this class is needed.");
>  }
>  }
It was the first design, it isn't needed anymore. I didn't remove it 
yet. If it does nothing, it should be removed.
> and why :
>
>  application.setGuard(guard); //not deprecated
>
> doesn't work instead.
This I can't tell you without have a look in it. Please file a bug.
> Because application.setAuthentication is deprecated, how can I use 
> ClientInfo.getRoles() instead ?
You should use the JAX-RS way with interface SecurityContext.

best regards
Stephan

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


Re: Resource paths with Restlet and Jax Rs

2010-10-04 Thread Stephan Koops
Hi Matthias,

> I guess you meant with "parameter" a @QueryParam annotated variable? I tried 
> so and added something like this:
>
> public String createBlog(@DefaultValue("me") @QueryParam("alias") String 
> alias) {...}
No, not @QueryParam. Query parameter are detected from the URL.
A possibility is @FormParam.
> The reason might be that the parameters are not parsed correctly. I followed 
> you hint and debugged everything. And I guess there is something wrong within 
> the Restlet/Jax-R. The parameter I send with my request are just put in front 
> of HTTP method. So the resource cannot be found. With the following link you 
> can see a screenshot from the debugger window. The highlighted line might be 
> a bug in the framework?! http://matthias.wilkau-hasslau.net/restlet_post.png 
> So you can see that the parameter "m" with its value "blogId" is set in front 
> of the POST. Is this supposed to be like that?
Yes, you are right, that looks not good. What are the data sou send?
> Can you reproduce it or do you have a running version of a Restlet 
> application with Jax-Rs resources that you could send me? So, if the mistake 
> is on my side I could figure it out by my own?
Sorry, not here. Take a look into the project org.restlet.test, package 
org.restlet.test.jaxrs.resources . There are a lot of example resources. 
Their should also be one with post.

Good luck
Stephan

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


Re: Resource paths with Restlet and Jax Rs

2010-10-01 Thread Stephan Koops
Hi Matthias,

Maybe the reason is, that their is no parameter in createBlog() to put 
the data in.

Do you stepped thru the code with the debugger? Start at 
JaxRsApplication.handleRequest(..)

best regards
 Stephan

Am 01.10.2010 15:13, schrieb webp...@tigris.org:
> Hi Stephan,
>
> sorry for bothering you that often but I just do not get it running. I just 
> will exlain my problem a bit more in detail. While sending GET request 
> everything concerning a simple GET request works. But sending a request with 
> any other method I always get the 405 status code, even I do just  a normal 
> POST request with a normal POST parameter. Let me explain it with a small 
> example.
>
> My Jax-Rs resource looks like:
> ...
> import javax.ws.rs.POST;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> import javax.ws.rs.core.UriInfo;
>
> @Path("blogs")
> public class BlogResource extends {
>...
>@POST
>public String createBlog(@Context UriInfo info) {
>  
>  return "{\"result\":\"ok\"}"
>}
>...
> }
>
>
> My HTML file looks like:
>
> REST Web test client
>  
>  http://localhost:8182/blogs/blogs"; 
> target="right" method="POST">
>  
>  
>  
>  
> 
>
> So it should call the POST method with a POST parameter tags=me. But the 
> server just returns a 405. And when I enable the method tunneling the server 
> logs just that POST is called with a POST parameter method=DELETE but that 
> the POST request is not allowed and returns a 405.
>
> To sum it up, I am not able to process a POST request either with nor without 
> a parameter. Do I have to allow POST somehow?
>
>> Hi Matthias,
>>> as I read parts of your master thesis I found the extension issue and that 
>>> it was done on purpose. So I could have found it by my own. Sorry for 
>>> bothering you with this.
>>> But I got another issue, sending parameter with a POST request. When I send 
>>> parameter with a POST request I just get an "405 - Method not allowed". I 
>>> searched the internet and found that you have to enable the different 
>>> methods woth allowPost(). But to do so you have to use Restlet resources 
>>> from the Restlet version 1.1. But I don't use Restlet 1.1 (did not found 
>>> such a method for 2.1) and I don't have use Restlet resources at all.
>>>
>>> Do I have to enable the POST methods somehow? (sending a POST request 
>>> without POST parameter works)
>> In the JAX-RS extension not.
>> allowPost() is for pure Restlet 1.x.
>>
>> Do you have the problems with post, if you add parameters for the tunnel
>> filter? Maybe the tunnel filter only works on GET requests.
>>
>> best regards
>>  Stephan

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


Re: Exception in Applet running in Eclipse

2010-10-01 Thread Stephan Koops
Hi Darin,

do you connect to the same server, where the applet was loaded from? You 
have to use the same name.
Otherwise it is not alowed for security reasons (in Applets)

best regards
 Stephan

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


Re: JaxRs routing bug

2010-09-27 Thread Stephan Koops
Hi Sriram,

Am 27.09.2010 21:03, schrieb Sriram C:
> I have defined a JaxRs resource (Restlet 2.0 RC4)
Do you tried the newest version? Maybe it solves the problem. Otherwise 
please file a bug on http://jira.restlet.org/ . Please also note the 
workaround with the order of the methods.
I can't say when I have time to wolve it. You could also add a patch.

Thanks for reporting

best regards
 Stephan

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


Re: Resource paths with Restlet and Jax Rs

2010-09-27 Thread Stephan Koops
Hi Matthias,
> as I read parts of your master thesis I found the extension issue and that it 
> was done on purpose. So I could have found it by my own. Sorry for bothering 
> you with this.
> But I got another issue, sending parameter with a POST request. When I send 
> parameter with a POST request I just get an "405 - Method not allowed". I 
> searched the internet and found that you have to enable the different methods 
> woth allowPost(). But to do so you have to use Restlet resources from the 
> Restlet version 1.1. But I don't use Restlet 1.1 (did not found such a method 
> for 2.1) and I don't have use Restlet resources at all.
>
> Do I have to enable the POST methods somehow? (sending a POST request without 
> POST parameter works)
In the JAX-RS extension not.
allowPost() is for pure Restlet 1.x.

Do you have the problems with post, if you add parameters for the tunnel 
filter? Maybe the tunnel filter only works on GET requests.

best regards
Stephan

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


Re: Security and GAE

2010-09-23 Thread Stephan Koops
Hi Giannis,
> I added org.restlet.ext.freemarker.jar to the Referenced Libraries but the 
> problem persists
>
> What's wrong?
You have also to add the org.freemarker.jar (or how it is named) to the 
classpath.

best regards
Stephan

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


Re: Resource paths with Restlet and Jax Rs

2010-09-23 Thread Stephan Koops
Hi nameless,

You are right, there is a lack for POST, DELETE and PUT.
IMO for DELETE it is meaningless (from view of HTTP / REST) to send an 
extension, because you don't want to delete one Representation (the 
json, xml, ... one), but the full resource. For PUT and POST it could 
mean the data you send or the data you get. Especially for PUT I think, 
the extension should specify the data you send, because that is PUT.

You could also try to use the tunneling via URl parameter. Maybe that 
works better for you.

I have no experience with Restlet in combination with Spring, also not 
with Restlet-JAX-RS and Spring.

best regards
Stephan

> Thanks a lot for your help. It took me a while to figure it out how I can use 
> the tunneling and the extension this way I want to. It is working for the GET 
> requests as expected. But I got some other questions/ issues.
>
> I just enabled the tunnel for my JaxRsApplication class and added the mime 
> types to the resource methodes within the @Produces annotation. But now I 
> discovered that it is not possible to do a POST request using the mime type 
> extension (json, xml...) I guess this is because POST is not intentend to 
> send data back to the client only http status codes. So I commented out the 
> @Produces for the POST and it was working.
>
> The problem is that the jax-rs application will be included in a spring 
> project that only allows requests with certain extensions like json, xml... 
> So is there a way to get around this?
>
> The other thing is that I would like to send response data back to the client 
> with the POST (DELETE, PUT) request to save resources on the (mobile) client 
> side. Is there a way to do this?
>
>
> Thanks in advance for the help.
>
> Is also searched this mailing list but did not found anything hope I did not 
> missed it somehow.
Am 21.09.2010 11:36, schrieb webp...@tigris.org:
> A note to the post before. I went on with trying a bit more and I figured out 
> that it sends data back to the client but only in the case when I don't use 
> any extensions.
> As soon as I use an extension on the POST call it prints me an 404 because it 
> tries to request /blogs.json instead of filtering the extension and call 
> /blogs
>
> Might this be a bug or did I miss a setting?
>
> I do the POST call with a HTML form and I use Restlet 2.1 (tried 2.0 before)
> Using GET this way it is working.
>
> Thanks for you help.

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


Re: Restlets in both https and http at the same time

2010-08-30 Thread Stephan Koops
I think you only have to ensure that connectors for both protocols are available, add the protocoll to your server, and everythink should work fine.best regards   Stephan


Von: "Xavier Méhaut" Gesendet: 30.08.2010 09:30:12An: discuss@restlet.tigris.orgBetreff: Restlets in both https and http at the same timeHello,I would like to know if it is possible to have at the same time both HTTPS and HTTP access to the same restlets?The use case is the following :my restlet server (not into a servlet container) must be access locally and remotely ; I would like locally to access it in HTTP, and remotely in HTTPS... regardsXavier
  Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!     Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02


Re: Resource paths with Restlet and Jax Rs

2010-08-27 Thread Stephan Koops
Hi how ever your name is,

the best way is to remove the extension, and set the accept-header of 
HTTP in the request, and the methods return an object, which will be 
serialized by two JAX-RS MessageBodyWriters, annotated with @Produces. 
For JSON it is already included.
If you can't or don't want to use a MessageBodyWriter, you could put 
@Produces also on the resource methods. Than you have a resource method 
for bson and one for json.
If it is not possible, to use the HTTP accept-header, you could create a 
filter which matches the extension to the accept header. I think I can 
send you code for it tomorrow.

best regards
   Stephan

webp...@tigris.org schrieb:
> Hello,
>
> I set up a small standalone server as JaxRsApplication like in the "JAX-RS 
> extension" example on the website.
>
> My resources are annotated with Jax-Rs Annotations. Every Resource should 
> have the same entry point. So I was thinking to put @Path("") on each 
> resource class and the specified resource path to the dedicated methods. When 
> I add these resources to the application class I get a warning that more than 
> one resource uses the same root path. The main problem is that I want to add 
> a type extention to the URI. My URIs should look like this:
>
> www.sample.com/blogs.json
> www.sample.com/blogs/3.json
> www.sample.com/notes.json
> www.sample.com/notes/3.json
>
> So my class definition looks like
>
> @Path("")
> public class Blog{
>   @GET
>   @Path("/blogs.{extension: [bj]son}")
>   public String getBlogs(...){
> ...
>   }
>
>   @GET
>   @Path("/blogs/{blogId}.{extension: [bj]son}")
>   public String getBlog(...){
> ...
>   }
> }
>
> @Path("")
> public class Note{
>   @GET
>   @Path("/notes.{extension: [bj]son}")
>   public String getNotes(...){
> ...
>   }
>
>   @GET
>   @Path("/notes/{noteId}.{extension: [bj]son}")
>   public String getNote(...){
> ...
>   }
> }
>
> Is there a way to get around this?
>
> Thanks a lot in advance.
>

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


Re: Resource paths with Restlet and Jax Rs

2010-08-27 Thread Stephan Koops
Hi,

sorry, I've made a little mistake. You don't need a new class to do content 
negotiation by extension. Just enabled the tunnel filter on the 
JaxRsApplication and ensure, that also bson is a known extension.

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: Stephan Koops 
Gesendet: 25.08.2010 21:20:10
An: discuss 
Betreff: Re: Resource paths with Restlet and Jax Rs

>Hi how ever your name is,
>
>the best way is to remove the extension, and set the accept-header of 
>HTTP in the request, and the methods return an object, which will be 
>serialized by two JAX-RS MessageBodyWriters, annotated with @Produces. 
>For JSON it is already included.
>If you can't or don't want to use a MessageBodyWriter, you could put 
>@Produces also on the resource methods. Than you have a resource method 
>for bson and one for json.
>If it is not possible, to use the HTTP accept-header, you could create a 
>filter which matches the extension to the accept header. I think I can 
>send you code for it tomorrow.
>
>best regards
>   Stephan
>
>webp...@tigris.org schrieb:
>> Hello,
>>
>> I set up a small standalone server as JaxRsApplication like in the "JAX-RS 
>> extension" example on the website.
>>
>> My resources are annotated with Jax-Rs Annotations. Every Resource should 
>> have the same entry point. So I was thinking to put @Path("") on each 
>> resource class and the specified resource path to the dedicated methods. 
>> When I add these resources to the application class I get a warning that 
>> more than one resource uses the same root path. The main problem is that I 
>> want to add a type extention to the URI. My URIs should look like this:
>>
>> www.sample.com/blogs.json
>> www.sample.com/blogs/3.json
>> www.sample.com/notes.json
>> www.sample.com/notes/3.json
>>
>> So my class definition looks like
>>
>> @Path("")
>> public class Blog{
>>   @GET
>>   @Path("/blogs.{extension: [bj]son}")
>>   public String getBlogs(...){
>> ...
>>   }
>>
>>   @GET
>>   @Path("/blogs/{blogId}.{extension: [bj]son}")
>>   public String getBlog(...){
>> ...
>>   }
>> }
>>
>> @Path("")
>> public class Note{
>>   @GET
>>   @Path("/notes.{extension: [bj]son}")
>>   public String getNotes(...){
>> ...
>>   }
>>
>>   @GET
>>   @Path("/notes/{noteId}.{extension: [bj]son}")
>>   public String getNote(...){
>> ...
>>   }
>> }
>>
>> Is there a way to get around this?
>>
>> Thanks a lot in advance.
>>   
>
___
WEB.DE DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für 
nur 19,99 ¿/mtl.!* http://web.de/DSL-Doppel-Flatrate/

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


Re: Pass List Object to Server !

2010-07-09 Thread Stephan Koops
Hi Thangavel,

to serialize an object, you just need the following:
Representation entity = new ObjectRepresentation(yourObject);

To deserialize, you just need:
ObjectRepresentation objRepr = new 
ObjectRepresentation(representation);  // representation is from the 
request / response
Object yourObj = objRepr.getObject();

How to get the representation you found on 
http://www.restlet.org/documentation/ .

best regards
   Stephan

thangavel.loganat...@gmail.com schrieb:
> Thanks for your reply, If you have any samples please can you share with me...
>
> > There is an ObjectRepresentation or something like that. That's not the 
> > best REST style (because it is only useable with Java), but should do 
> > what you want.
>   
>> > I have list object in my server, How to pass list object
>> > from server to client and get that list in client side..
>> >
>> > Any help and suggestions welcome plz..

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


Re: @Head annotation

2010-07-09 Thread Stephan Koops
Hi Fabian,

because GET and HEAD have a very near semantic, it is the same. The only 
difference is, that you are not required to send the entity body.
If you want to optimize, than you could get the method from the request, 
and than decide, if you have to read the full entity boy, for example. 
Don't forget, that you have to set the entity headers, also in HEAD.

best regards
   Stephan

Fabian Mandelbaum schrieb:
> Hello there,
>
> why doesn't Reslet (at least as of V2.0RC4) have an @Head annotation
> to handle HEAD requests?
>
> Currently HEAD requests are being handled by GET handlers (at least
> that's what's happening with my annotated resources). Why is this so?
> Is there any reason why there's no @Head annotation?
>
> I'd need such annotation and wanted to hear about this before going on
> and implementing the @Head annotation myself modelled based on @Get.
> Thanks in advance

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


Re: Pass List Object to Server !

2010-07-07 Thread Stephan Koops
Hi Thangavel,

There is an ObjectRepresentation or something like that. That's not the 
best REST style (because it is only useable with Java), but should do 
what you want.

best regards
   Stephan

SelvaGold schrieb:
> Hi Techies ,
>
>I have list object in my server, How to pass list object from
> server to client and get that list in client side..
>
> Any help and suggestions welcome plz..

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


Re: JAXRS, Transactional Resources managed by Spring

2010-06-29 Thread Stephan Koops
Hi Sriram,

my answers was valid for the number of instances that are not cleaned 
up. Unfortunately I can't tell you anything about this in the Restlet 
context.

best regards
Stephan

Sriram C schrieb:
> Stephan,
> Thanks for your reply. Whats the best way to resolve this issue? I have a
> decent sized app running on JAXRS, Spring, Restlet stack on Tomcat that
> needs to be restarted every other day or so to get past this issue. I am
> very willing to help develop the solution and validating test-cases. Any
> pointers on a good starting point would be very helpful towards this goal.
>
> Sriram
>

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


Re: JAX-RS and charsets in posts

2010-06-29 Thread Stephan Koops
Hi Jeroen
> I was actually about to report this issue too. Let me know if you 
> haven't got the time, then I'll look into the issue report/patch.
> Note that restlet has a utility class BioUtils which has methods to 
> convert a stream to a string.
This would be cool !

best regards
Stephan

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


Re: JAX-RS problem selecting best method when multiple resource methods match

2010-06-29 Thread Stephan Koops
Hi Jeroen,

>I noticed that the restlet jax-rs implementation has difficulties 
>selecting the best resource method when multiple methods (in the same 
>resource) match a given URI.
>
>An example will clarify:
>
>@Path("foo")
>public class FooResource {
>
> @GET
> @Path(value = "{id}")
> public String getFooId(@PathParam(value = "id") Long id) {
> return "foo"+id;
> }
>
> @GET
> @Path(value = "bar")
> public String getFooBar() {
> return "foobar";
> }
>}
>
>GET foo/5=>  "foo5"
>GET foo/bar => 404 Not Found
>
>Reason:
>The algorithm finds in both cases that resource FooResource is the best 
>matching resource. During this research, it even knows that getFooId is 
>the best matching method in the first request, and getFooBar is the best 
>in the second request.
>But once the resource is chosen, another part of the algorithm looks for 
>the best matching resource method, but seems to be disregarding the 
>amount of literal characters and capturing groups in the matching uri 
>templates.
>Then both methods are considered equally good, and the first one is 
>chosen in both requests, yielding the error in the latter.
>
>This looks like a bug to me. Should I create an issue ?

Yes, please.
It would be cool, if you also could apply a patch, or give detailed notes, 
where the bug occurs.

best regards
Stephan
___
GRATIS für alle WEB.DE Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

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


Re: JAX-RS and charsets in posts

2010-06-26 Thread Stephan Koops
Hi Alistair,
> I've been experimenting with posting in Unicode-based XML content (UTF-8 
> encoded Chinese characters as it happens) to a JAX-RS resource. The content 
> parameter to the resource method is a String and so the content from a post 
> is ultimately read in with the 
> org.restlet.ext.jaxrs.internal.provider.StringProvider. Unfortunately the 
> non-ASCII characters come through garbled.
>
> Digging around the StringProvider class, the problem looks to be with the 
> Util.copyToStringBuilder method - it reads in the content a single byte at a 
> time but then casts each byte to a char. The implication is that each 
> character is one byte which, of course, for UTF-8 encoded characters is 
> incorrect.
>   
Yes, this seems to be a bug. Please create an issue on 
http://restlet.tigris.org/servlets/ProjectIssues
Could you create and attach a patch to this issue?

thank you
   Stephan

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


Re: JAXRS, Transactional Resources managed by Spring

2010-06-26 Thread Stephan Koops
Hi Sriram

the classes you refer to are not JAX-RS specific. It seems to be a 
general Restlet with Spring problem to me. Another possibility is, that 
I forget to release something in the JAX-RS extension.

best regards
   Stephan

Sriram C schrieb:
> Hi,
> I have a set of JAXRS resources built using Restlet 2.0-RC2 running in
> Tomcat 6.0. I have servlet that extends
> org.restlet.ext.servlet.ServerServlet and uses
> org.restlet.ext.jaxrs.ObjectFactory to create per request resource objects
> using org.springframework.beans.factory.config.AutowireCapableBeanFactory
> (Spring 3.0)
>
> I have my resources annotated with Spring transaction for my demarcating DB
> transactions. I ran a jmeter test with a moderate load of 100 concurrent
> threads invoking different methods on a resource 50 times each. At the end
> of my test simulation after forcing java VM garbage collection and viewing
> the memory contents in JProfiler, I see a number of instances (75) of CGLIB
> proxies for my resource objects. I also see a number of instances of
> org.restlet.ext.servlet.internal.ServletCall (102) and a number of instances
> of org.restlet.representation.InputRepresentation (102) and
> org.restlet.representation.Variant$1 (104). Apparently there seems to be a
> memory leak. Just as test, I added calls to another resource that returns a
> string and does NOT have the Spring transaction around it. I ran the same
> test against this resource and the same behavior was exhibited. What do I
> need to do in order to clean up the resources after the request is
> processed? Are there any examples that use Singleton resource objects using
> Spring/JAXRS that I can refer to as an alternative approach? What are the
> advantages/disadvantage of the per-request object approach versus the
> Singleton resource approach?
>
> Thanks very much in advance to your suggestions.
> Sriram
>

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


Re: restlet jaxrs cookie question

2010-05-21 Thread Stephan Koops
Hi
>> However I think I found the cause for the cookie setting bug. 
>>
>> NewCookieHeaderDelegate:toString is using CookieWriter. It needs to use
>> org.restlet.engine.http.header.CookieSettingWriter.
>> it should say
>>
>> return
>> CookieSettingWriter.write(Converter.toRestletCookieSetting(newCookie));
>>
>> With a web-app running this version of the jaxrs jar file. I see the correct
>> cookie settings in tcpmonitor.
>> 
> Cool ! I've fixed the bug as proposed and checked it into SVN.
More exactly: I've started the check in, but it was breaked after 
wroting the last email.
Because my Restlet workspace is very unorganized, I could not reorganize 
it in 10 minutes. Could someone else please check in this proposal, and 
also update the changes.txt?

Thanks
   stephan

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


Re: restlet jaxrs cookie question

2010-05-21 Thread Stephan Koops
Hi Srisam,
> I don't understand the org.restlet.test layout well enough to build a new
> testcase that will build a mock jaxrs Response and put it through the
> restlet lifecycle. 
>   
No problem, it is a little bit complicated.
> However I think I found the cause for the cookie setting bug. 
>
> NewCookieHeaderDelegate:toString is using CookieWriter. It needs to use
> org.restlet.engine.http.header.CookieSettingWriter.
> it should say
>
> return
> CookieSettingWriter.write(Converter.toRestletCookieSetting(newCookie));
>
> With a web-app running this version of the jaxrs jar file. I see the correct
> cookie settings in tcpmonitor.
Cool ! I've fixed the bug as proposed and checked it into SVN.

best regards
   Stephan

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


Re: restlet jaxrs cookie question

2010-05-20 Thread Stephan Koops
Hi Sriram,

Now I've had time to take a look into the source code, but I don't find 
a bug.
Because I have not your full source code here, I have to ask again: 
Please set a breakpoint in 
org.restlet.engine.http.header.CookieSettingWriter and see what happens 
with the value of cookieSettings.getMaxAge(); (line 107 in my version of 
the code). I it the value you gave, or is it zero? if it is zero, please 
put a breakpoint to 
org.restlet.ext.jaxrs.internal.spi.NewCookieHeaderDelegate.toString(NewCookie).

Sorry, that I can't execute the code myself now.

best regards
   Stephan

Sriram C schrieb:
> Stephan,
> The value of the newCookie is fine up until the point it is copied into the
> set-cookie header value in
> org.restlet.ext.jaxrs.internal.util.Util:copyResponseHeaders (line 300). The
> value that is copied is is basically the toString() of the NewCookie
> (testCookie="test"; $Path="/my_path"; $Domain="localhost"). The NewCookie
> implementtion is from jsr311-api. Could this be an issue due to the
> toString() of the newCookie not returning the data in the format that is
> expected off a newCookie in the version of jsr311 that this was built
> against?
>
> I am using jsr311-api.1.1.1.jar from the maven dependency to
> org.restlet.ext.jarxrs (2.0-RC2). Please let me know if this version is not
> right. 
>
> Sriram
>

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


Re: do annotations work in Restlet 1.1 version?

2010-05-20 Thread Stephan Koops
Hi Shrileckha,
> Thanks Stephan for the reply... Can you tell me when is the restlet2.0 going
> to be in a stable mode? I have a product release end of july, can I use the
> restlet2.0 version for my development?
I don't know.

Jerome, Thierry ?

best regards
Stephan

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


Re: Testing a Restlet service (server)

2010-05-20 Thread Stephan Koops
Hi Fabian,
> Are you testing your restlets?
as I've implemented the JAX-RS extension, I do some unit tests, which 
tests for correct behaviour, but not for performance.
> How?
>   
I've created some requests by the client API, but I don't let it 
serialize by Restlet, but directly call the JaxRsApplication; see 
project org.restlet.test, packages org.restlet.test.jaxrs.*

best regards
   Stephan

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


RE: Re: modifying received XML in Response

2010-05-20 Thread Stephan Koops
Hi,

>I'm working on the client side. I'm manipulating the namespaces prior to 
>getting the DOM instantiated. This transformation is being done to get around 
>a limitation in a third-party toolkit that processes the DOM.

it seems, that it needs a lot of time for conversion. If you need performance 
improvement, and only change a little bit data at the beginning of the stream, 
than you could read the start from the original representation InputStream, and 
implement a new InputStream class, whcih receives first the new datas, and than 
the rest of the original InputStream.

best regards
   Stepha
___
NEU: WEB.DE DSL für 19,99 EUR/mtl. und ohne Mindest-Laufzeit!
http://produkte.web.de/go/02/

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


Re: do annotations work in Restlet 1.1 version?

2010-05-20 Thread Stephan Koops
Hi Shrileckha,

>Can we use annotations in Restlet 1.1 version. if so can you paste me a
>sample example?
The answer is short: No. You have to use Restlet 2.

best regards
   Stephan
___
GRATIS: Movie-Flat mit über 300 Top-Videos. Für WEB.DE Nutzer
dauerhaft kostenlos! Jetzt freischalten unter http://movieflat.web.de

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


Re: modifying received XML in Response

2010-05-19 Thread Stephan Koops
>Representation rep = response.getEntity();
>if (rep != null)
>{
> String raw = rep.getText();
> String clean = ModifyXML(raw);
> response.setEntity(clean, MediaType.TEXT_XML);
>
> DomRepresentation dom = new DomRepresentation(rep);
> 
>}
>
>Question: is this the right sequence of calls to mess with the XML before it 
>is parsed? (It appears to work) Is there a better way?

I'm not sure, what you want. Do you work on client side?
I propose to use
DomRepresentation dom = new DomRepresentation(response.getEntity());
manipulate(dom);
...

best regards
   Stephan
___
GRATIS: Movie-Flat mit über 300 Top-Videos. Für WEB.DE Nutzer
dauerhaft kostenlos! Jetzt freischalten unter http://movieflat.web.de

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


Re: restlet jaxrs cookie question

2010-05-19 Thread Stephan Koops
Hi Siram,

>HTTP/1.1 200 OK
>Server: Apache-Coyote/1.1
>Date: Tue, 18 May 2010 20:20:34 GMT
>Accept-Ranges: bytes
>Server: Restlet-Framework/2.0rc2
>Set-Cookie: testCookie=test
>Content-Type: application/xml;charset=UTF-8
>Content-Length: 0
Ok, the value is not available in the http response. So it is definitively a 
bug: Either in the JAX-RS implementation while copying the JAX-RS cookie to the 
Restlet cookie, or while serializing with Restlet (in the Restlet engine). 
You should enter an issue for this 
(http://restlet.tigris.org/servlets/ProjectIssues ; you have to log in on 
tigris). Becuase I have no access to the code from here I can't help now.

If you want to speed up the bug removal, set the breakpoint in the JAX-RS 
cookie class again, and check what happens with the value after reading the 
age. Is it copied to the Restlet cookie? If yes, than it is a bug in the 
Restlet cookie serialization, if not, than it is a bug in the JAX-RS 
implementation. Please add the results to the issue.
It is also helpful, if you could add a reproduceable unit test to the issue. 
See the tests in the Restlet test project.

>I used tcpmon (tcpmon.dev.java.net/) and I see the following dump there.
>There is nothing about the cookie age or the path in the tcpmon output. Is
>there a better http sniffer you recommend on a mac?
Sorry, I don't know about software for mac ... But it delivers all we need.

best regards
   Stephan
___
NEU: WEB.DE DSL für 19,99 EUR/mtl. und ohne Mindest-Laufzeit!
http://produkte.web.de/go/02/

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


Re: ServerResource sucessfully received by client?

2010-05-19 Thread Stephan Koops
Hi Daniel,

I think, the API does not support it. I think, if the client stops the 
download, it closes the TCP stream, and than an IOException occurs in the 
server.
Maybe you could create a subclass of Representation which check, if the stream 
is successfully closed. But I'm not sure, if it works.

Why do you need this feature?

best regards
   Stephan 

-Ursprüngliche Nachricht-
Von: Daniel Ferber 
Gesendet: 18.05.2010 15:37:20
An: discuss@restlet.tigris.org
Betreff: ServerResource sucessfully received by client?

>Hi,
>
>How could my ServerResource get to know if the client has sucessfully received 
>the resource?
>
>I understand that as soon as the ServerResource method (annotated with @Get) 
>returns a Representation, Restlet takes over to deliver the content to the 
>client.
>
>How will Restlet behave if the connection is lost while sending data to the 
>client? Or if the client interrupts/cancels the download of the resource? Is 
>there an API to get to know if the client has received the resource with 
>success?
>
>I am considering resources that are relatively large compared to the 
>connection speed.
>
>Many thanks in advance,
>Daniel
___
GRATIS: Movie-Flat mit über 300 Top-Videos. Für WEB.DE Nutzer
dauerhaft kostenlos! Jetzt freischalten unter http://movieflat.web.de

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


Re: Getting java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpConnectionManager

2010-05-18 Thread Stephan Koops
Hi Shrileckha,

I don't know.
Do you not forgot to restarted the server?

best regards
   Stephan

Shrileckha Chaithanya schrieb:
> Thanks Stephan.. For the quick reply. I don't get that error any more. But I
> get this error 
> java.lang.NoClassDefFoundError: org/apache/commons/dbcp/ConnectionFactory.
> So I added commons-dbcp-1.2.2.jar in the class path. Still I am getting this
> error. Do you think I should add a different jar?
> Form yesterday I keep getting one error or the other with the running
> restlet with tomcat :). Pls help!
>

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


Re: Getting java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpConnectionManager

2010-05-18 Thread Stephan Koops
Hi Shrileckha,

sounds good to me.
I don't know. You could add all jars available with the download to a 
new Eclipse project, and write down org.apache.commons.h 
ttpclient.HttpConnectionManager anywhere in source code in this project 
and use ctrl-click. Than you should go into the compiled class and there 
you could see at the top of the window which jar you are in.

best regards
Stephan

Shrileckha Chaithanya schrieb:
> Hi Stephan ... I did add commons-httpclient-2.0jar. Is there any other jar
> that I need to add?please let me know.
>
> Thanks,
> Shrileckha Chaithanya
>

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


Re: restlet jaxrs cookie question

2010-05-18 Thread Stephan Koops
Hi Sriram,

maybe it is a bug in the JAX-RS implementation. I propose to set a break 
point in the getter of the age in NewCookie, and see, if it breaks 
there. If not, than it is a bug in the JAX-RS implementation.
If the program stops there, what is done with the value.

Another possibility: Sniff the http traffic and see, if the age is 
transfered If not, it is definitively a bug.

best regards
  Stephan

Sriram C schrieb:
> I have a couple of JAXRS resources built with restlet 2.0RC2 with Spring
> 3.0.1,  deployed on Tomcat 6.0.x. I set a browser cookie from a resource
> using the following logic:
>
> @GET
> @Path("/test")
> @Produces({"application/xml", "application/json", "text/plain"})
> public Response test(){
> NewCookie newCookie;
> Cookie cookie = new Cookie("testCookie", "test", "/", "localhost");
> newCookie = new NewCookie(cookie, "", 7776000, false);
> return Response.ok().cookie(newCookie).build();
> }
>
> The cookie is set fine on the browser, however the time period that I
> specified (7776000) doesn't seem to be getting applied. The cookie has an
> expiration of 'When the browser closes' basically a session cookie. The
> issue occurs regardless of when the domain is either localhost or a valid
> domain. This issue occurs on Firefox and also Chrome. What could be the
> causing the cookie age to be not set?
>
> Thanks
>

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


Re: Getting java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpConnectionManager

2010-05-18 Thread Stephan Koops
Hi Shrileckha,

you have to add the jar for apache http client to the class path.

best regards
   Stephan

Shrileckha Chaithanya schrieb:
> Hi...
>
> I am getting ava.lang.NoClassDefFoundError:
> org/apache/commons/httpclient/HttpConnectionManager when running a sample
> restlet application running on tomcat. I dont get any errors when running on
> weblogic. Pls advice.
>
> Thanks,
> Shrileckha Chaithanya
>

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


Re: redirect to an URL from a JAXRS resource

2010-05-17 Thread Stephan Koops
Hi Siram,

I think you could use Request.seeOther(uri).build(); where uri is a 
java.net.URI with a String constructor.
Or do I miss something?

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: Sriram C 
Gesendet: 17.05.2010 15:27:12
An: discuss@restlet.tigris.org
Betreff: redirect to an URL from a JAXRS resource

>I have a JAXRS resource from which I wish to do a redirect to a URL in a
>different domain, how can I achieve this? 
>
>Thanks
>Sriram
___
NEU: WEB.DE DSL für 19,99 EUR/mtl. und ohne Mindest-Laufzeit!
http://produkte.web.de/go/02/

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


Re: jaxrs question

2010-05-11 Thread Stephan Koops
Hi Sriram,
> I have developed a jaxrs service running on top of Spring 3.0 in a servlet
> container (Tomcat 6) using the 2.0RC2 restlet distribution. In my service
> class, how can I access the entire query string (equivalent to the
> javax.servlet.Request:getQueryString().
I think, it is not possible, because you normally not need it, because 
ou could get the properties directly (via @QueryParam or UriInfo).
A way is to access the Servlet Request via the Restlet request  
(org.restlet.*.Request.getCurrent() or something like that, and than 
read the Servlet request from its properties). But than you have a 
dependency to Restlet and to Servlet. The direct injection into i 
planned, but not implemented, as far as I know.
> How can I access the other elements
> of the javax.servlet.Request like getLanguage(), getRewmoteHost()?
>   
In your root resource class you could have an instance variable of type 
HttpHeaders, or in the JAX-RS methods a method parameter of this type, 
in both cases annotated with @Context. There you could read this 
properties, I think. Perhaps you have to access via the header name. The 
Restlet class Request is better to use.
Because the Restlet Request class is a class and no interface it is not 
easy to inject it with all required conditions, especially that it must 
be one Object for all threads. For HttpServletRequest it's easy, because 
it is an interface.

best regards
   Stephan

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


Re: How do I locate a post?

2010-05-03 Thread Stephan Koops
Hi Muack,

take a look at 
http://restlet.tigris.org/servlets/CTSearch?dsForumId=4447&dsNav=APzAESz .
Perhaps you must log in to tigris, I don't know.

best regards
   Stephan

webp...@tigris.org schrieb:
> Hey all, could somebody be so kind and help me out? I got here another day by 
> means of yahoo but now can not find once more the post I have been reading 
> that time :(. And before someone asks, no I am not blond simply not that 
> excellent with computers hehe. 
> Muack
>

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


Re: Client Custom Header

2010-05-01 Thread Stephan Koops
Hi Jean,

the access is on both sides the same. That's an advantage of Restlet.
To add the header for every request you could create a filter. It adds 
the header. Instead of send the request directly by the Client object 
you set the Client as next Restlet in the filter and your application 
sends all request via the filter.
(I hope that's right ...)

best regards
   Stephan

Jean-Philippe Steinmetz schrieb:
> Hi,
>
> I'm trying to add a custom HTTP header to outgoing requests when using 
> the restlet client API. Ideally i'm looking for some way to implement 
> a helper class that can inject my header into every request as they 
> are processed. However in looking through the documentation i'm not 
> really finding what i'm looking for. I see in the FAQ it's possible to 
> access headers but this seems to be from the server perspective. How 
> do I get access from a client perspective?
>
> Thanks in advance,
>
> Jean-Philippe Steinmetz

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


Re: GET service

2010-04-24 Thread Stephan Koops
Hi Nicho,

you could also encode the slash to "%2F" (without the "). See 
http://en.wikipedia.org/wiki/Percent-encoding for more details.
But I can't tell you by head, how Restlet supports the decoding.

best regards
   Stephan

webp...@tigris.org schrieb:
> Hello,
>
> I am implementing an service which is like: GET 
> http://localhost/resources/publickey/{publickey}. But my publickey includes 
> symbol of "/", so how can I sort it out?
>
> for example, if my publickey is MIGf/MA0GC/mEVps, then the server will 
> response to GET http://localhost/resources/publickey/MIGf/MA0GC/, rather than 
> GET http://localhost/resources/publickey/. any idea?
>
> Thanks in advance.
>
> Nicho
>

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


Re: What to do about sessions?

2010-04-21 Thread Stephan Koops
Hi Marc,

> So what does REST say about bandwidth, it's not a problem?

If you use proxies to cache data, than you not waste, but save bandwith. 
That's a (or the?) reason that sessions are not allowed. If you have 
state on the server, than the cache / proxy can't know whats the server 
state is (for exactly the same request as one minute before).

 > REST services are definitely chatty.
REST chats intelligent things like cache information, to allow save 
bandwith in the future. SOAP is also chatty, but it speak a lot of 
filler words (tags for soap-header, tags for soap-bosy, tag for the 
error code and so on). And it uses XML, what is bandwith waste in 
itself, because it sends a lot of tags double (at start and end of the 
tag). With REST you could transfer JSON, which does not need double tags.
BTW: The best SOAP coup in relation to this is HTTP over SOAP over HTTP 
(Web Service Resource Transfer, http://www.w3.org/Submission/WSRT/). The 
most "efficent" transfer is, if you need to encode the data you want to 
transfer into an XML node (e.g. to base64, because it contains non 
printable characters; HTTP directly allows 8 bit)

 > especially when compared to SOAP webservices that might perform N 
operations in one shot.
You could also design your web services to perform multiple operations 
in one shot:

* Get multiple objects: Design a sub collection with the IDs you want
* POST multiple objects: send an array of objects (e.g. in XML or JSON).


best regards
Stephan

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


Re: What to do about sessions?

2010-04-20 Thread Stephan Koops
Hi dj,

session are strictly forbidden in REST, because the scalability advantage of 
restful applications will get lost, because caches wont work. For details see 
the dissertation of Roy Fielding, the founder of the REST architecture style, 
espacially chapter 5 
(http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm).

Because restful application is not supposed to support sessions (as you wrote), 
they are not uspported in Restlet.
The restful way is to use HTTP autentication. You just need to use a Guard in 
your Restlet server deployment, e.g. with HTTP-Basic as authentication scheme. 
The other things do Restlet and the browser for you, but I can't say if the 
Google App support it. With a browser (e.g. Firefox or IE) it works.

best regards
   Stephan
___
NEU: WEB.DE DSL für 19,99 EUR/mtl. und ohne Mindest-Laufzeit!
http://produkte.web.de/go/02/

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


Re: SOAP Integration

2010-03-31 Thread Stephan Koops
Hi Kirk,

I think the newer WSDL versions also support REST web services. But I don't 
know, if it is supported by WSDL client libraries.

best regards
   Stephan

Kirk Daries schrieb:
> Hi,
>
> I have a requirement to build and expose my rest(let) interfaces over 
> soap(egads) for legacy clients.
>
> Does restlet provide anything out the box to help one with this?
>
> Or is it simply a mapping exercise of translating soap calls to the 
> uri's/methods restlet expects.
>
> I'd like to here from anyone who has been gone through the exercise already.
>
> Any pointers?
>
> Thank you,
> --KD
___
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

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


Re: SOAP Integration

2010-03-30 Thread Stephan Koops
Hi Kirk,

out of the box there is no support for it.
I've implemented a very small soap server by walking threw the XML with 
DomRepresentation and build the XML response myself. But it was a very 
small web service.

best regards
   Stephan

Kirk Daries schrieb:
> Hi,
>
> I have a requirement to build and expose my rest(let) interfaces over 
> soap(egads) for legacy clients.
>
> Does restlet provide anything out the box to help one with this?
>
> Or is it simply a mapping exercise of translating soap calls to the 
> uri's/methods restlet expects.
>
> I'd like to here from anyone who has been gone through the exercise already.
>
> Any pointers?
>
> Thank you,
> --KD
>

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


Re: Context and Application

2010-03-22 Thread Stephan Koops
Hi Daniel,

I think, proposal 1 it is the right approach. I would implement a class 
"DataStore" or something like that, which hides the hibernate actions.
Why you don't like the singleton approach? The approaches 2 to 4 are also 
singletons. You ever need a singleton here.

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: webp...@tigris.org
Gesendet: 19.03.2010 18:36:33
An: discuss@restlet.tigris.org
Betreff: Context and Application

>Hi,
>
>I am new to Restlet and any similar technology and I am wondering about the 
>right approach to share business and data objects (eg. Hibernate) among 
>Restlet Resources.
>
>After reading the books, docs and older posts in this forum, I know why the 
>Component Context shall not be used to pass information to the Resource 
>Restlets. I have also seen people talking different approaches:
>
>1) Create an singleton that provides access to the shared objects. I 
>personally dislike singleton approaches.
>
>2) Put the shared objects as attributes to the Application Context. This 
>requires (implicit) conventions about attribute names and casting. And 
>requires going through each Resource Restlet if some of the convention changes.
>
>3) Extend the Context with getter methods for shared objects. Objects are 
>stored as variables inside the Context. Resources then cast the Context and 
>call the getter methods.
>
>4) Extend the Application with getter methods for shared objects. Objects are 
>stored as variables inside the Application. Resources then cast the 
>Application and call the getter methods.
>
>5) Some better approach that I am missing?
>
>Sorry if the question is quite elementary, but I am not familiar to 
>webservice/restlet development. I will appreciate your advice.
>
>Thanks,
>Daniel Felix Ferber
___
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

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


Re: restful-gwt

2010-03-16 Thread Stephan Koops
Hi,

in the JAX-RS JSR discussions some people asked the question for JAX-RS 
for clients. The answer from the spec leads was, that teh first version 
is server only, but a later version could include also a client API.

best regards
  Stephan

Xavier M. schrieb:
> Hello,
> Just a link towards a new project in the REST+GWT ecosystem :
> http://code.google.com/p/restful-gwt/
> regards
> Xavier

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


Re: Route.score

2010-03-04 Thread Stephan Koops
Hi,

I think the query (after the "?") will not be respected, so the first 
query matches "/customer" and "/customer?surname={bla}", and the second 
one will matching nothing. Maybe I'm wrong, but I think so.

@Jerome, Thierry: Perhaps it is useful to throw an 
IllegalArgumentException, if a questionmark is included in the route 
while adding?

best regards
   Stephan

Kirk Daries schrieb:
> Hi Guys,
>
> I seems to have a route scoring problem.
>
> Here are the two routes:
>
> /customers  --> resourceA
>
> /customers?surname={bla} --> resourceB
>
>
> My router currently has the following properties set:
>
>   
> router.setDefaultMatchingMode(Template.MODE_EQUALS);
>   router.setRoutingMode(Router.MODE_BEST_MATCH);
>   router.setDefaultMatchingQuery(false);
>
>
> Now the 2nd route that specifies the query parameters, i specifically enable 
> the searching on the query portion.
>
> i.e.
> route.setMatchingQuery(true);
>
> The test uri i'm testing with is:
> /customers?surname=adams
>
> The problem is that currently, both routes are scoring 1.
>
> Is there any other hint i can give restlet that the 2nd route should score 
> greater than the first route?
>
> How have have you handled similar problems?
>
> --KD
>

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


Re: Restlet JAX-RS question

2010-02-26 Thread Stephan Koops
Hi Fabio, hi Jerome, hi Thierry,

cool Fabio, that you want allow the the Servlet artifacts in JAX-RS. 
Every help is welcome.

I think it is important, that the JAX-RS extension has no dependency to 
the Servlet API, so we need to have another way.
@ Jerome and Theirry: Do you think it useful to create an "extension 
extension", that has all that needs dependencies to the Servlet API? 
Than I have an idea how to implement it. Or do you have another ideas?

Are there other ideas what also could be included, that means could be 
annotated with @Context?

best regards
   Stephan

Fabio Mancinelli schrieb:
> Hi Stephan,
>
> I am writing to you to ask a little advice.
> I was thinking about writing a patch to the JAX-RS extension in order
> to allow the injection of the HttpServletRequest and
> HttpServletRespone objects using the @Context annotation.
>
> Could you point me to the code where injection is done and if I should
> be aware of some architectural details you used for implementing the
> injection mechanism?
>
> Thank you.
>
> Regards,
> Fabio
>

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


Re: Access to HttpSession from Restlet ...

2010-02-25 Thread Stephan Koops
Hi Stefan,

> If I print out the pure ID out of the byte array I get this: [...@e51b2c 
> which looks like an hex address to me. How can I get to the value then?
just cast to byte[] and access by index.
Or use new String((byte[])byteArray);

best regards
   Stephan
___
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

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


Re: Starting/stopping restlets

2010-02-24 Thread Stephan Koops
Hi Tal,

you could do some initialization and finalization work in your own Restlets.

best regards
   Stephan

Tal Liron schrieb:
> This is a basic attribute of any Restlet, but it seems like nowhere in 
> the framework is it used.
>
> My expectation was that routers, filters, etc., would not pass requests 
> on to a stopped target restlet. However, it seems that stopping restlets 
> has no effect.
>
> Is this by design? In which case, what is the purpose of starting/stopping?
>
> -Tal

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


Re: Access to HttpSession from Restlet ...

2010-02-24 Thread Stephan Koops
Hi Stefan,

but that doesn't hinder you to use Restlet.
I'm just implementing a SOAP Web Service on top of Restlet, also if it 
is not the idea behind it, just because it's easy to use with HTTP.

best regards
   Stephan

best regards
  Stephan

Stefan Meissner schrieb:
> Hi Stephan,
>
> the use of SSL ID is required in the project I am working on. But as you 
> said, REST might be not the right choice for the implementation then.
>
> thanks for your reply
> Stefan
>

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


RE: Re:Access to HttpSession from Restlet ...

2010-02-24 Thread Stephan Koops
Hi Stefan,

why do you want to access the session id? The architectural style REST forbid 
server session state.
If you want to comply to the REST architecture, than you must not use it. Or do 
you want explicit ignore this restriction?

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: Stefan Meissner 
Gesendet: 24.02.2010 17:10:42
An: discuss@restlet.tigris.org
Betreff: RE: Re:Access to HttpSession from Restlet ...

>OK, does the same constraint apply for SSL sessions? 
>Is it possible to get the SSL session IDs using Simple HTTPS server connector?
>
>Can the SSLSessionContext IDs be used in the same way as in servlet API like 
>this:
>
>String sslID = 
>(String)request.getAttribute("javax.servlet.request.ssl_session");
>
>What I did so far:
>
>Server server = component.getServers().add(Protocol.HTTPS, 8183);
>Series param = server.getContext().getParameters();
>
>param.add("keystorePath", "./mySrvKeystore");
>param.add("keystorePassword", "123456");
>   
>HttpsServerHelper helper = new HttpsServerHelper(server);
>   
>SSLContext sslContext;
>try {
>   helper.start();
>   sslContext = helper.getSslContext();
>
>Enumeration sessionIDs = sslcontext.getServerSessionContext().getIds();
>
>component.getDefaultHost().attach(new FilterApplication(sslContext));
>   
>// Start the component.
>component.start();
>   
>} catch (Exception e) {
>   e.printStackTrace();
>}
>
>I also called the getIds() method inside the FilterApplication (beforeHandle), 
>but in most of the cases there is no session ID present upon request. And if 
>there is one ID it contains weird characters such as the follwing 
>session ID: K?>7?%?[?s?#1GGb&?2???^?a??
>
>I've tried several charsets using:
>String sID = new String(id,"UTF-8");
>but I never get a better representation of the ID.
>
>Can someone please give me a clue what I'm doing wrong.
>
>Best regards
>Stefan
___
WEB.DE DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.!
http://produkte.web.de/go/02/

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


Re: Restlet Security - Securing URLs

2010-02-18 Thread Stephan Koops
Hi Nirav,

you mean, you have one Authenticator and one Authorizator for a lot of 
resources?
Why do you not protect every resource or some routers with own instances 
of the Authenticator and/or Authorizator?

best regards
   Stephan

Nirav Shah schrieb:
> Hello All !
>
> I have been working on the Security module of our product since about past 
> two months now and have a nice mechanism integrated into Restlet that lets us 
> implement our security needs.
>
> We have overwritten the Authenticator and Authorizer to hav our custom 
> requirements met like interfacing with LDAP and fine grained roles.
>
> The bit that am currently not very happy about is the "Authorization". We are 
> using regex based URI mappings to determine user permissions and roles.
>
> But this is not very robust, nor is completely foolproof. Also adding a new 
> URL means the Authorizer has to be updated.
>
> I was wondering if anyone out there has a more interesting approach on how 
> this can be.
>
> It will also be nice to know some different Authorization mechanisms. 
>
> Thanks and Regards!
> Nirav Shah
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2448703
>

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


RE: Re: Adding/removing JAX-RS resources at runtime

2010-02-05 Thread Stephan Koops
Hi,

I don't know how this works with OSGI, and if or how it is possible to react to 
OSGI events in Restlet.
If Restlet allows this, than - iI thinl - you could do it by creating a new 
javax.ws.rs.Application and adding it to the router.

best regards
  Stephan

-Ursprüngliche Nachricht-
Von: Bhallamudi Venkata Siva Kamesh 
Gesendet: 05.02.2010 15:17:29
An: discuss@restlet.tigris.org,Stephan Koops 
Betreff: RE: Re: Adding/removing JAX-RS resources at runtime

>As, I have got one requirement and the requirement is we are going to deploy 
>Restlet along with some implementation class as an OSGi bundle and this 
>implementation class will contain implementation of an Application class, 
>which will attach all the resources listed in one of the configuration file. 
>If any resource is created at runtime then it should also be added to Router 
>and the same should be updated to configuratiopn file.
>
>If you have any other way to achieve this please suggest me.
>
>
>
>> Hi Fabio,
>> 
>> sorry for the delay, I was on holiday.
>> You could
>> 
>>1. create and add another subclass of javax.ws.rs.Application, with
>>   your additional classes,
>>2. build a subclass or org.restlet.ext.jaxrs.JaxRsApplication, where
>>   you could add the singletons or classes directly, or
>>3. use your proposal.
>> 
>> I preferer the first or second way, because you don't need to double the 
>> initialization code.
>> 
>> best regards
>>Stephan
>> 
>> webp...@tigris.org schrieb:
>> > Hi everybody,
>> >
>> > a quick question to evaluate the feasibility of a project. Is it possible 
>> > to dynamically add or remove resources and providers from a JAX-RS 
>> > application?
>> >
>> > I looked at the API and it doesn't seem possible, though the class 
>> > JaxRsRestlet gives some hope. Maybe by using directly this class (with a 
>> > bit of code duplication for the initialization) instead of initializing 
>> > the application in the "canonical" way using JaxRsApplication + 
>> > javax.ws.rs.core.Application would work.
>> >
>> > Any hint/comment?
>> >
>> > Thanks,
>> > Fabio
>> >
>
>--
>http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2445147
___
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

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


Re: Representation for multiple types?

2010-01-23 Thread Stephan Koops
Hi Jean-Philipee,

there is the converter service, perhaps it helps you. Unfortunately I 
can't give you details.

best regards
   Stephan

Jean-Philippe Steinmetz schrieb:
> Thank you for the quick reply. This certainly would resolve the issue 
> but it doesn't really offer the kind of solution I was hoping for. 
> With this solution i'd still have to do a mapping of media type to 
> some representation which is what I am trying to avoid. The thought 
> was that there is a Representation that just outputs the message body 
> regardless of whatever media type variant is set for it. That way I 
> don't have to make a mapping of media type to anything.

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


Re:Restletdoc

2010-01-12 Thread Stephan Koops
Hi Xavier,

there is WADL (Web Application Description Language). Do you took a look to 
this?

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: "Xavier M." 
Gesendet: 12.01.2010 14:58:24
An: discuss@restlet.tigris.org
Betreff: Restletdoc

>Hello,
>I would like to know your opinion about a kind of javadoc for restlet we
>could call restletdoc. A rest api is an api as the others, so it could be
>interesting to have a web representation of this api like the one we have
>for java or other languages.
>In this restlet doc we would have :
>* categories of retslets apis , ie kind of java package for restlets
>* the restlet api like /myproject/myresource/{mytype}
>* the http methods like get/put/...
>* the data exchanged
>* the HTTP error code involved and processed
>* ...
>
>regards
>xavier
>
>--
>http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2436620
___
Kostenlos tippen, täglich 1 Million gewinnen: zum WEB.DE MillionenKlick!
http://produkte.web.de/go/08/

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

Re:Access to HttpSession from Restlet ...

2010-01-12 Thread Stephan Koops
Hi Eugene,

RESTful application have NO session state (see 
http://en.wikipedia.org/wiki/Representational_State_Transfer#Constraints for 
example).
So you have no access to the session state.

best regards
   Stephan Koops

Eugene Batogov schrieb: Hello all.
I use Restlet-2.0M5 over servlet  with Jetty-6.1.21.
Can I get access to HttpSession from ServerResource or  Request ?

I understand, that restlet include cookies support, But how I may get 
HttpSession ?
Thanks.
___
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

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


Re: Describe Restlet services

2009-12-17 Thread Stephan Koops
Hi Ruben,

WADL is a standard for describing REST resources. There is a WADl 
extension for Restlet, But I'm not sure, if it do, what you need.

best regards
   Stephan

Ruben Hernando schrieb:
> 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=4447&dsMessageId=2431287


Re: Why so few interfaces???

2009-12-11 Thread Stephan Koops
Hi Conor,
> * Was the code developed using TDD techniques? (I haven't come across any 
> unit tests yet...)
>   
There is an own test project (maybe only in the SVN repository) with a 
lot of tests.

To the interfaces I can't say much. There were discussions about this on 
the mailing lists one or two years ago (see 
http://restlet.tigris.org/ds/viewForums.do)

best regards
  Stephan

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


Re: CacheDirective.maxAge(int) adds a quoted string to http headers

2009-12-08 Thread Stephan Koops
Hi Guido,
> thanks for fixing this so quickly. I'll have a look at my scenarios when
> it's in the latest snapshot. Is there by any chance already a scheduled date
> for this?
>   
I think every night, but I'm not sure.

best regards
   Stephan

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


Re: Object exchange between Android and AppEngine

2009-12-07 Thread Stephan Koops
Hi Marcel,
> I have my business model on AppEngine and now like to use Android as a client 
> to communicate via http. I'd like to keep my beans structure and simply 
> transfer objects between client and server and then call servlets for method 
> calls.
> a) Do you think this is a good approach? (Or are there nicer designs?)
>   
Why do you want to call Servlets? You could implement your logic in 
Restlets.

best regards
   Stephan

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


Re: JAXRS - methodNotAllowed vs resourceMethodNotFound?

2009-12-07 Thread Stephan Koops
Hi Anthony,

it's a long time ago, but if I remember right, your usecase is not 
planned in JAX-RS, so it is not implemented.
I have the code not on the hand, and, I will not have time to look this 
week. The ExceptionHandler is a class of Restlet, and not implementing a 
JAX-RS interface, right?
Than you could modify the JaxRsRestlet, so that you could give a 
subclass of ExceptionHandler (or change ExceptionHandler to an interface 
and use the logic as default implementation with the possibility to 
extend it.). Perhaps you need to extend the signature of method 
ExceptionHandler#methodNotAllowed() by addings the methods name.
If you change it, it would be cool, if you could give the changes back 
to the community, see http://www.restlet.org/community and especially 
http://www.restlet.org/community/contribute.

If I remember right, the only sense of this class was to redude the 
number lines of code in the class JaxRsRestlet, and this was a 
meaningful own part of the logic.

best regards
   Stephan

webp...@tigris.org schrieb:
> Hi,
>
> I have a resource say, GetOnlyResource which only supports the get GET method.
>
> When my client calls the GetOnlyResource with PUT method there's no hooks for 
> me to handle this Exception.
>
> I was under the impression that the above situation would be 
> resourceMethodNotFound and would subsequently calls 
> ExceptionHandler#resourceMethodNotFound() which then invoke the 
> noResMethodHandler hook.
>
> But my test reveals the above situation would end up calling 
> ExceptionHandler#methodNotAllowed() and there's no hook to handle this 
> exception.
>
> My assumption is, when the client tries to call a PUT method on the 
> GetOnlyResource but the PUT method is not found on the GetOnlyResource 
> therefore its resourceMethodNotFound.
>
> Could anyone please clarify my understanding. If my understanding was wrong 
> what is the alternative to hook into the methodNotAllowed().
>
> My use case is when a client calls on any Unsupported method on any resource 
> (my example above) then I need to log it in our audit system. Currently we've 
> implemented this use case by;
>
> GetOnlyResource
> #handleGet() -> do real work
> #handlePut() -> audit log the Unsupported method
> #handleDel() -> audit log the Unsupported 
> #handlePost() -> audit log the Unsupported 
>
> We have a number of resource like the one above and I'm seeking an elegant 
> solution like using the noResMethodHandler.
>
> Thanks,
> Anthony Xiao

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


  1   2   3   4   >