Re: Matlab With Restlet

2010-02-22 Thread Thierry Boileau
Hello Rashik

I've entered an issue for this problem = 
http://restlet.tigris.org/issues/show_bug.cgi?id=1042.
Could you check the value of org.restlet.util.Engine.getInstance() (its 
class especially). If this is an instance of com.noelios.restlet.Engine, 
could you check the value of getRegisteredClients()?


Best regards,
Thierry Boileau



 hi Thierry

 Im really sorry for the partial information in the post. i will just explain 
 what i have done till now so it more clear about my problem.

 In matlab we can add the jar files dynamically or statically.

 Adding Jar files to matlab math
 dynamically
 ==
 I tried to add the following jar files
 org.restlet.ext.json-1.1.7.jar
 org.json_2.0.0.jar
 org.restlet-1.1.7.jar
 com.noelios.restlet-1.1.7.jar

 dynamically (using matlab command javaaddpath).
 The jar files currently inside the matlab environment can been seen with 
 command javaclasspath.
 Now i was able to see all the jar files mentioned above in the javaclasspath.

 Then when i tried to create a client
 Client(Protocol.HTTP)

 I got the following error
 ??? Java exception occurred:
 java.lang.RuntimeException: Unable to fully initialize the Restlet. No 
 Restlet engine available.

 But this problem was solved when i added the jar files statically to matlab.
 (We can do that by editing the classpath.txt). (I dont know the reson for 
 this because im not sure how the classloading for matlab works.I got the info 
 from the forums that there has been difference in behaviour between static 
 and dynamic class loading).

 After this problem was solved
 When i tried to execute to
 Client(Protocol.HTTP)

 i got the warning
 No available client connector supports the required protocols: 'PROTOCOL.HTTP
 Protocol' . Please add the JAR of a matching connector to your classpath.

 But based on your inputs i tried to include
 following jar files also to matlab class path
 i.com.noelios.restlet.ext.net.jar
 and also i tired adding
 org.apache.commons.httpclient.jar
 and com.noelios.restlet.ext.httpclient_3.1.jar
 These were done as separate trials.
 Still i have the same warning.
 Can u pls let me know what all information you need from matlab side so that 
 we can figure out this issue.

 Regards
 Rashik

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



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

Re: URL never matched within servlet environment (M7

2010-02-22 Thread Thierry Boileau
Hello Zsolt,

thanks for your report. The fix is available in the svn repository.

Best regads,
Thierry Boileau


 Hello

 I've upgraded from M6 to M7 and the requested URLs never match when I
 use my application within servlet container (via the restlet servlet).
 Application is attached, but server responses 404 to every request.

 It works with M6. If my application is run with M7, but _not_ in
 servlet environment, it works, too.

 restlet.xml
 ---
 ?xml version=1.0?
   component xmlns=http://www.restlet.org/schemas/2.0/Component;
  defaultHost
 attach uriPattern=
targetClass=hu.zakk.z108.MainApplication /
  /defaultHost
   /component


 web.xml
 
 servlet
  servlet-nameRestletServlet/servlet-name
  servlet-classorg.restlet.ext.servlet.ServerServlet/servlet-class
/servlet

servlet-mapping
   servlet-nameRestletServlet/servlet-name
   url-pattern/*/url-pattern
/servlet-mapping
 --

 Is it a known issue?

 Thanks

 Zsolt

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



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


Re: URL never matched within servlet environment (M7

2010-02-22 Thread Zsolt Czinkos
Hello Thierry,

Thank you for the quick fix!

Best

zsolt

On Mon, Feb 22, 2010 at 11:23 AM, Thierry Boileau
thierry.boil...@noelios.com wrote:
 Hello Zsolt,

 thanks for your report. The fix is available in the svn repository.

 Best regads,
 Thierry Boileau


 Hello

 I've upgraded from M6 to M7 and the requested URLs never match when I
 use my application within servlet container (via the restlet servlet).
 Application is attached, but server responses 404 to every request.

 It works with M6. If my application is run with M7, but _not_ in
 servlet environment, it works, too.

 restlet.xml
 ---
 ?xml version=1.0?
   component xmlns=http://www.restlet.org/schemas/2.0/Component;
      defaultHost
         attach uriPattern=
                    targetClass=hu.zakk.z108.MainApplication /
      /defaultHost
   /component


 web.xml
 
 servlet
      servlet-nameRestletServlet/servlet-name
      servlet-classorg.restlet.ext.servlet.ServerServlet/servlet-class
    /servlet

    servlet-mapping
                   servlet-nameRestletServlet/servlet-name
                   url-pattern/*/url-pattern
    /servlet-mapping
 --

 Is it a known issue?

 Thanks

 Zsolt

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



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


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


RE: Re: Matlab With Restlet

2010-02-22 Thread webpost
Hi Thierry

I have checked the values 

Then value of org.restlet.util.Eng​ine.getInstance() 
is com.noelios.restlet.eng...@ae43b8 (is an instance of 
com.noelios.restlet.Engine)

and the value returned from the method getRegisteredC​lients() are 

[com.noelios.restlet.ext.net.httpclienthel...@54919e, 
com.noelios.restlet.http.streamclienthel...@2437ef, 
com.noelios.restlet.local.clapclienthel...@1d46259, 
com.noelios.restlet.local.fileclienthel...@84fa6a]

If you need any more information please let me know.

Thanks.

Regards
Rashik.T

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


Re: Matlab With Restlet

2010-02-22 Thread Thierry Boileau
Hi Rashik,

the values are correct, and we can notice the presence of the internal 
connector (denoted by the presence of an instance of 
com.noelios.restlet.http.StreamClientHelper).
Your client code should work.
What happens if you display the client's helper?
 Client client = new Client(Protocol.HTTP);
 System.out.println(Engine.getInstance().createHelper(client, 
null));

Besrt regards,
Thierry Boileau

 Hi Thierry

 I have checked the values

 Then value of org.restlet.util.EngâEUR

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

Re: preferred variant

2010-02-22 Thread Thierry Boileau
Hello Zsolt,

you can specify a default media type on the metadata service of the 
application:
your app.getMetadataService().setDefaultMediaType(MediaType.TEXT_HTML);

Best regards,
Thierry Boileau

 Hello

 I'm sure I'm missing something trivial, but I can't figure it out.

 I have this simple interface:

 public interface EntryResource {
  @Get(html)
  public Representation asHtml();
   
  @Get(json|xml)
  public Entry retrieve();
   
  @Put
  public void store(Entry entry);

  @Delete
  public void remove();
 }

 I have a server resource class which implements these methods (no @Get
 annotation there). When I don't set the Accept header in request, I
 always get application/json response. How can I set the preferred
 media type to text/html?

 When I set Accept: text/html, it returns the html representation.



 Thank you in advance

 zsolt

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



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


Re: preferred variant

2010-02-22 Thread Zsolt Czinkos
Hi Thierry,

Thanks for your help.

Best,

Zsolt

On Mon, Feb 22, 2010 at 1:11 PM, Thierry Boileau
thierry.boil...@noelios.com wrote:
 Hello Zsolt,

 you can specify a default media type on the metadata service of the
 application:
 your app.getMetadataService().setDefaultMediaType(MediaType.TEXT_HTML);

 Best regards,
 Thierry Boileau

 Hello

 I'm sure I'm missing something trivial, but I can't figure it out.

 I have this simple interface:

 public interface EntryResource {
     �...@get(html)
      public Representation asHtml();

     �...@get(json|xml)
      public Entry retrieve();

     �...@put
      public void store(Entry entry);

     �...@delete
      public void remove();
 }

 I have a server resource class which implements these methods (no @Get
 annotation there). When I don't set the Accept header in request, I
 always get application/json response. How can I set the preferred
 media type to text/html?

 When I set Accept: text/html, it returns the html representation.



 Thank you in advance

 zsolt

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



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


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


RE: Re: Matlab With Restlet

2010-02-22 Thread webpost
hi Thierry

If i execute the following in side matlab

Client client = new Client(Protocol.HTTP);
I get the warning 

WARNUNG: No available client connector supports the required protocols: 
'PROTOCOL.HTTP' . Please add the JAR of a matching connector to your classpath.

When i execut the following
System.out.println(E​ngine.getInstance().​createHelper(client,​
null));
I get the same warning.
WARNUNG: No available client connector supports the required protocols: 
'PROTOCOL.HTTP' . Please add the JAR of a matching connector to your classpath.

But when i checked the code of the createhelper() and so i checked for more 
values from matlab.

client.getProtocol() returns [HTTP].
but for
(connector.getprotocols().containsAll(client.getProtocol()) returns 0 for 
iteration with
com.noelios.restlet.​http.StreamClientHel​per
instance.)

Can u please let me know why this returning zero.I hope im on right path of 
debugging the problem.

Thanks

Regards
Rashik.T

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


Redirected resources URIs

2010-02-22 Thread Fabian Mandelbaum
Hello there,

one of the elements needed in a WebDAV response for the PROPFIND
method is the href (full URI) of the resource in question. For
example:

d:hrefhttp://host:port/path/to/the/resource/d:href

Now, if my Restlet application is 'behind' an URL redirect engine, for
example Apache's mod_rewrite, and the client makes the request to:

http://redirected.uri/path/to/the/resource

using something like:

String hrefs = String.format(%s%s, getHostRef().toString(false,
false), Reference.decode(fragment)); // NOI18N

to compute the text node's value inside d:href I get:

d:hrefhttp://inside.host:port/path/to/the/resource/d:href

instead of (the expected by the client which doesn't need to know
anything about proxies and redirection):

d:hrefhttp://redirected.uri/path/to/the/resource/d:href

So, I was wondering if getting the HTTP standard Via header's first
value (ex: Via: 1.1 redirected.uri 1.1 internal.first.host 1.1
inside.host:port) to build the URI's value is the right thing to do to
get http://redirected.uri/path/to/the/resource, and if restlet has a
mapped method to get the Via header's value, or I'll have to use the
getRequest().getAttributes().get(org.restlet.http.headers) method
and some String manipulation magic to get the 1st value.

I hope to have been clear enough, thanks in advance for your prompt
and accurate answer.

-- 
Fabián Mandelbaum
IS Engineer

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


Re: Redirect from HTTP to RIAP

2010-02-22 Thread Thierry Boileau
Hello Tal,

thanks for your report. The fix is available in the svn repository.

Best regards,
Thierry Boileau


 It seems like I cannot use a Redirector to an RIAP URI.

 For example:

 router.attach(/note/{id}), new Redirector(component.context,
 riap://component/myapp/note, Redirector.MODE_SERVER_DISPATCHER));

 Is this intentional? Can anyone think of a simple workaround?

 The use case is to have a different internal URI space, and a different
 one exposed to the world.

 By the way, setting the Redirector in MODE_CLIENT_DISPATCHER in this
 case causes a JVM failure...

 -Tal

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



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

Re: Matlab With Restlet

2010-02-22 Thread Thierry Boileau
Hello Rashik,

there's something unclear to me. The StreamClientHelper explicitely 
supports the HTTP protocol, so 
connector.getprotocols().containsAll(client.getProtocols()) must 
return true.

Could you tell us what the following code produces on the console?

com.noelios.restlet.Engine engine = (com.noelios.restlet.Engine) 
org.restlet.util.Engine.getInstance();
System.out.println(   engine:  + engine);
System.out.println(client connectors:  + engine.getRegisteredClients());

Client client = new Client(Protocol.HTTP);

for (ClientHelper helper : engine.getRegisteredClients()) {
System.out.println(client helper:  + helper);
System.out.print( client protocols:  + helper.getProtocols());
System.out.println( =  + 
helper.getProtocols().containsAll(client.getProtocols()));
}
System.out.println(chosen helper:  + 
Engine.getInstance().createHelper(client, null));

Best regards,
Thierry Boileau
ps: what release of Restlet are you using?


 hi Thierry

 If i execute the following in side matlab

 Client client = new Client(Protocol.HTTP);
 I get the warning

 WARNUNG: No available client connector supports the required protocols: 
 'PROTOCOL.HTTP' . Please add the JAR of a matching connector to your 
 classpath.

 When i execut the following
 System.out.println(EâEUR
 null));
 I get the same warning.
 WARNUNG: No available client connector supports the required protocols: 
 'PROTOCOL.HTTP' . Please add the JAR of a matching connector to your 
 classpath.

 But when i checked the code of the createhelper() and so i checked for more 
 values from matlab.

 client.getProtocol() returns [HTTP].
 but for
 (connector.getprotocols().containsAll(client.getProtocol()) returns 0 for 
 iteration with
 com.noelios.restlet.âEUR

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

Re: ConcurrentModificationException from Resource

2010-02-22 Thread Thierry Boileau
Hello Ruben,

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

Best regards,
Thierry Boileau

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

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


 Regards
 R.Hernando

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



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

Re: If-None-Match: * not handled correctly

2010-02-22 Thread Thierry Boileau
Hello,

thanks for your report, the fix is available in the svn repository.

Best regards,
Thierry Boileau

 I am trying to send a conditional PUT to a Restlet resource using the 
 'If-None-Match: *' header, basically I need the PUT to succeed if no entity 
 exists and to fail if it does exist (see 
 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26). The current 
 behavior of Restlet appears to be the opposite.

 Within ServerResource.doConditionalHandle() if the resource does not exist 
 resultInfo ends up null so Conditions.getStatus(...) is never consulted and a 
 404 is returned.

 When the resource does exist resultInfo is non-null and 
 Conditions.getStatus(...) is invoked. The If-None-Match rule if (Conditions 
 line #273) then enters the entityExists if block, but since my entity tag is 
 null 'matched' is left as false even though the existence of the entity 
 should cause a match when '*' is specified, as stated in the spec: the 
 method MUST NOT be performed if the representation selected by the origin 
 server (or by a cache, possibly using the Vary mechanism, see section 14.44) 
 exists. Since matched is left as false the PUT is allowed to proceed, 
 overwriting the previously existing resource.

 Also as a side note, within the If-None-Match rule if the entity does not 
 exist (entityExists = false) matched is set to 
 'getNoneMatch().get(0).equals(Tag.ALL)', whereas it should remain false.

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



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

Re: Redirected resources URIs

2010-02-22 Thread Thierry Boileau
Hello Fabian,

regarding the support of HTTP headers, you can have a look at the user 
guide here: http://wiki.restlet.org/docs_2.0/130-restlet.html. The via 
header is not supported yet.
Thus, you will to get the org.restlet.http.headers reques's attribute...

I see a problem if the rewriting rule is also based on the path.

Best regards,
Thierry Boileau

 Hello there,

 one of the elements needed in a WebDAV response for the PROPFIND
 method is the href (full URI) of the resource in question. For
 example:

 d:hrefhttp://host:port/path/to/the/resource/d:href

 Now, if my Restlet application is 'behind' an URL redirect engine, for
 example Apache's mod_rewrite, and the client makes the request to:

 http://redirected.uri/path/to/the/resource

 using something like:

 String hrefs = String.format(%s%s, getHostRef().toString(false,
 false), Reference.decode(fragment)); // NOI18N

 to compute the text node's value insided:href  I get:

 d:hrefhttp://inside.host:port/path/to/the/resource/d:href

 instead of (the expected by the client which doesn't need to know
 anything about proxies and redirection):

 d:hrefhttp://redirected.uri/path/to/the/resource/d:href

 So, I was wondering if getting the HTTP standard Via header's first
 value (ex: Via: 1.1 redirected.uri 1.1 internal.first.host 1.1
 inside.host:port) to build the URI's value is the right thing to do to
 get http://redirected.uri/path/to/the/resource, and if restlet has a
 mapped method to get the Via header's value, or I'll have to use the
 getRequest().getAttributes().get(org.restlet.http.headers) method
 and some String manipulation magic to get the 1st value.

 I hope to have been clear enough, thanks in advance for your prompt
 and accurate answer.



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

Re: Redirected resources URIs

2010-02-22 Thread Fabian Mandelbaum
Hello Thierry,

I've just found again the Mapping HTTP semantics page and was reading it :-)

The idea is to try to get the original host:port requested by the
client, and if the redirection engine is before the Restlet
application, the HTTP Host header for requests hitting the Restlet app
are already redirected.

However, WebDAV needs (or at least all the implementations I've seen
so far do it like this) the URL of the original call, not the
redirected URL, in the href element of some DAV responses. So I
think I'll get the Via header and parse it to get the 1st host:port
pair in the Via 'chain' to get the original host:port requested (that
is, before all redirections/proxies 'in the middle', between the
client and my Restlet server).

Thanks.

On Mon, Feb 22, 2010 at 2:11 PM, Thierry Boileau
thierry.boil...@noelios.com wrote:
 Hello Fabian,

 regarding the support of HTTP headers, you can have a look at the user guide
 here: http://wiki.restlet.org/docs_2.0/130-restlet.html. The via header is
 not supported yet.
 Thus, you will to get the org.restlet.http.headers reques's attribute...

 I see a problem if the rewriting rule is also based on the path.

 Best regards,
 Thierry Boileau

 Hello there,

 one of the elements needed in a WebDAV response for the PROPFIND
 method is the href (full URI) of the resource in question. For
 example:

 d:hrefhttp://host:port/path/to/the/resource/d:href

 Now, if my Restlet application is 'behind' an URL redirect engine, for
 example Apache's mod_rewrite, and the client makes the request to:

 http://redirected.uri/path/to/the/resource

 using something like:

 String hrefs = String.format(%s%s, getHostRef().toString(false,
 false), Reference.decode(fragment)); // NOI18N

 to compute the text node's value inside d:href I get:

 d:hrefhttp://inside.host:port/path/to/the/resource/d:href

 instead of (the expected by the client which doesn't need to know
 anything about proxies and redirection):

 d:hrefhttp://redirected.uri/path/to/the/resource/d:href

 So, I was wondering if getting the HTTP standard Via header's first
 value (ex: Via: 1.1 redirected.uri 1.1 internal.first.host 1.1
 inside.host:port) to build the URI's value is the right thing to do to
 get http://redirected.uri/path/to/the/resource, and if restlet has a
 mapped method to get the Via header's value, or I'll have to use the
 getRequest().getAttributes().get(org.restlet.http.headers) method
 and some String manipulation magic to get the 1st value.

 I hope to have been clear enough, thanks in advance for your prompt
 and accurate answer.





-- 
Fabián Mandelbaum
IS Engineer

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


Handling HEAD requests

2010-02-22 Thread Fabian Mandelbaum
Hello there,

I've noticed (Restlet 2.0snapshot from 2010-02-19 IIRC) that there's
no @Head annotation to handle HEAD requests. The method annotated with
@Get is handling HEAD also. A priori this makes some sense because one
expects to get the same answer for HEAD and GET, except that HEAD has
just metadata (in the HTTP headers) while GET has both the metadata
and a body with the representation of the resource in question.

So far, so good.

This no body in the response almost mandates the usage of
EmptyRepresentation... except that it cannot have the other metadata
set properly.

Look at this example, code:

getLogger().info(-*-*-*-*-*-*-*-*-DBG: METADATA:  + cmd.toString());
Representation rep = new EmptyRepresentation();
rep.setModificationDate(cmd.getLastModif().getTime());
rep.setSize(cmd.getSize());
rep.setMediaType(new MediaType(cmd.getMimeType()));
return rep;

It basically creates an empty representation (no Content-Type header,
Length header fixed to 0) and then tries to set the correct metadata
(Content-Type, Length and Date are the ones I need properly set) by
issuing standard API calls as suggested by both the Restlet engine and
the docs at 
http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet/130-restlet.html

However, this is not working, in the logs I get the correct metadata info:

*
INFO: -*-*-*-*-*-*-*-*-DBG: METADATA: { Last Modified on
java.util.GregorianCalendar[time=1266859161000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=America/Buenos_Aires,offset=-1080,dstSavings=360,useDaylight=true,transitions=118,lastRule=java.util.SimpleTimeZone[id=America/Buenos_Aires,offset=-1080,dstSavings=360,useDaylight=true,startYear=0,startMode=3,startMonth=9,startDay=15,startDayOfWeek=1,startTime=0,startTimeMode=0,endMode=3,endMonth=2,endDay=15,endDayOfWeek=1,endTime=0,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=1,WEEK_OF_YEAR=9,WEEK_OF_MONTH=4,DAY_OF_MONTH=22,DAY_OF_YEAR=53,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=4,AM_PM=1,HOUR=3,HOUR_OF_DAY=15,MINUTE=19,SECOND=21,MILLISECOND=0,ZONE_OFFSET=-1080,DST_OFFSET=360],
Type text/plain, Size 19 bytes, HEAD rev is 1.1 }
*

But in the response I don't get the correct metadata info, and just
get the ones corresponding to EmptyRepresentation (which is not what
should be happening...):

*
HTTP/1.1 200 The request has succeeded

Content-Length: 0

Connection: close

Date: Mon, 22 Feb 2010 16:00:13 GMT

Accept-Ranges: bytes

Server: Restlet-Framework/2.0snapshot

*

Using Restlet 2.0snapshot from 2010-02-19 IIRC (not the latest, but
the one before, or two before)

Needless to say that if I try to set the HTTP headers on purpose with
the correct values, Restlet correctly barks:

*
Feb 22, 2010 3:19:21 PM org.restlet.engine.http.header.HeaderUtils
addExtensionHeaders
WARNING: Addition of the standard header Content-Type is not
allowed. Please use the equivalent property in the Restlet API.
Feb 22, 2010 3:19:21 PM org.restlet.engine.http.header.HeaderUtils
addExtensionHeaders
WARNING: Addition of the standard header Content-Length is not
allowed. Please use the equivalent property in the Restlet API.
*

Thanks in advance...

-- 
Fabián Mandelbaum
IS Engineer

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


RE: If-None-Match: * not handled correctly

2010-02-22 Thread webpost
Thierry,

Thanks for the quick fix. I just started working with Restlet and have really 
enjoyed it so far.

Best,
Ray Bradley

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


Re: Redirect from HTTP to RIAP

2010-02-22 Thread Tal Liron
Thanks!

Would love to test and confirm, but Restlet won't build (revision 6159). 
My error:

 [javac] 
/Depot/Projects/Collaborative/Restlet/build/temp/android/modules/org.restlet.ext.odata/src/org/restlet/ext/odata/internal/FeedParser.java:362:
 
cannot find symbol
 [javac] symbol  : method getNode(java.lang.String)
 [javac] location: class org.restlet.ext.xml.DomRepresentation
 [javac] Node node = 
inlineContent.getNode(mapping.getValuePath());

On 02/22/2010 09:07 AM, Thierry Boileau wrote:
 Hello Tal,

 thanks for your report. The fix is available in the svn repository.

 Best regards,
 Thierry Boileau


 It seems like I cannot use a Redirector to an RIAP URI.

 For example:

 router.attach(/note/{id}), new Redirector(component.context,
 riap://component/myapp/note, Redirector.MODE_SERVER_DISPATCHER));

 Is this intentional? Can anyone think of a simple workaround?

 The use case is to have a different internal URI space, and a different
 one exposed to the world.

 By the way, setting the Redirector in MODE_CLIENT_DISPATCHER in this
 case causes a JVM failure...

 -Tal

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



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


RE: Re: Matlab With Restlet

2010-02-22 Thread webpost
hi Thierry

   I have done the test suggested by you.Im using Restlet 1.1.8.Also i have 
downloaded (version 2 milestone 7 but i was not able to find 
com.noelios.restlet.jar inside lib folder. So i havent tried anything with this 
release). 

The log from the Matlab Command Window is as follows:

Diagnostics START
Executing : com.noelios.restlet.Engine engine = (com.noelios.restlet.Engine) 
org.restlet.util.Engine.getInstance();.And the Output Is:
 
Executing : System.out.println( engine:  + engine);.And the Output Is:
Engine : com.noelios.restlet.eng...@ae43b8
 
Executing : System.out.println( client connectors:  + 
engine.getRegisteredClients());.And the Output Is:
client Connectors : [com.noelios.restlet.ext.net.httpclienthel...@54919e, 
com.noelios.restlet.http.streamclienthel...@2437ef, 
com.noelios.restlet.local.clapclienthel...@1d46259, 
com.noelios.restlet.local.fileclienthel...@84fa6a]
 
Executing : Client client = new Client(Protocol.HTTP);.And the Output Is:
22.02.2010 18:52:44 com.noelios.restlet.Engine createHelper

WARNUNG: No available client connector supports the required protocols: 
'PROTOCOL.HTTP' . Please add the JAR of a matching connector to your classpath.

Client : org.restlet.cli...@18307be
 
Executing : System.out.println( client helper:  + helper);.And the Output Is:
Client Helper : com.noelios.restlet.ext.net.httpclienthel...@54919e
 
Executing : System.out.print( client protocols:  + helper.getProtocols());.And 
the Output Is:
Client Protocols : [HTTP, HTTPS]
 
Executing : System.out.println( =  + 
helper.getProtocols().containsAll(client.getProtocols()));.And the Output Is:
Value returned by (helper.getProtocols().containsAll(client.getProtocols())) : 0
 
Executing : System.out.println( client helper:  + helper);.And the Output Is:
Client Helper : com.noelios.restlet.http.streamclienthel...@2437ef
 
Executing : System.out.print( client protocols:  + helper.getProtocols());.And 
the Output Is:
Client Protocols : [HTTP]
 
Executing : System.out.println( =  + 
helper.getProtocols().containsAll(client.getProtocols()));.And the Output Is:
Value returned by (helper.getProtocols().containsAll(client.getProtocols())) : 0
 
Executing : System.out.println( client helper:  + helper);.And the Output Is:
Client Helper : com.noelios.restlet.local.clapclienthel...@1d46259
 
Executing : System.out.print( client protocols:  + helper.getProtocols());.And 
the Output Is:
Client Protocols : [CLAP]
 
Executing : System.out.println( =  + 
helper.getProtocols().containsAll(client.getProtocols()));.And the Output Is:
Value returned by (helper.getProtocols().containsAll(client.getProtocols())) : 0
 
Executing : System.out.println( client helper:  + helper);.And the Output Is:
Client Helper : com.noelios.restlet.local.fileclienthel...@84fa6a
 
Executing : System.out.print( client protocols:  + helper.getProtocols());.And 
the Output Is:
Client Protocols : [FILE]
 
Executing : System.out.println( =  + 
helper.getProtocols().containsAll(client.getProtocols()));.And the Output Is:
Value returned by (helper.getProtocols().containsAll(client.getProtocols())) : 0
 
Executing : System.out.println( chosen helper:  + 
Engine.getInstance().createHelper(client, null));.And the Output Is:
22.02.2010 18:52:44 com.noelios.restlet.Engine createHelper

WARNUNG: No available client connector supports the required protocols: 
'PROTOCOL.HTTP' . Please add the JAR of a matching connector to your classpath.

chosen helper: The Value returned from 
Engine.getInstance().createHelper(client, null)) is Empty
 
Diagnostics END 

I hope  u can easily understand the above log file.
If you need any more info pls let me know. 
Thanks.

Regards
Rashik.T

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