POST Requests return with a 405 with @Post annotated method

2010-09-15 Thread Dustin N. Jenkins
I'm using Restlet 2.0.1 with JDK 1.6 in Tomcat 6.0.29.

Nobody else has mentioned this, so I assume that it's something I'm 
doing.  When I upgraded to 2.0.1 from 2.0m7, the POST requests all 
returned a 405 Method Not Allowed status.

Here's how my method is defined:
/**
 
  */
 @Post
 public Representation acceptRepresentation(final Representation entity)
  {
  

Do I need to define a better MetadataService or anything?  Is this a 
known issue to anybody else?  I'm about to try version 2.0.0 to see if 
it happens there.

Thanks,
Dustin
-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: POST Requests return with a 405 with @Post annotated method

2010-09-15 Thread Dustin N. Jenkins
I have just confirmed that this issue is not present in Restlet 2.0.0.

Thanks,
Dustin

On 09/15/2010 09:10 AM, Dustin N. Jenkins wrote:
 I'm using Restlet 2.0.1 with JDK 1.6 in Tomcat 6.0.29.

 Nobody else has mentioned this, so I assume that it's something I'm
 doing.  When I upgraded to 2.0.1 from 2.0m7, the POST requests all
 returned a 405 Method Not Allowed status.

 Here's how my method is defined:
  /**
   
*/
   @Post
   public Representation acceptRepresentation(final Representation entity)
{


 Do I need to define a better MetadataService or anything?  Is this a
 known issue to anybody else?  I'm about to try version 2.0.0 to see if
 it happens there.

 Thanks,
 Dustin

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: ServerRouter in ComponentHelper not routing?

2010-07-14 Thread Dustin N. Jenkins
I believe that is the issue.

Thanks, Thierry!
Dustin


On 07/14/2010 06:59 AM, Thierry Boileau wrote:
 Hello Dustin,

 I suspect that the main cause is related to the last changes and the 
 signature of the annotated method. Does this thread help you?
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2632190
  
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2632190

 Best regards,
 Thierry Boileau


 I'm using the July 11th snapshot.

 I have my own router that routes to their appropriate resources, and
 that router is returned from the createInboundRoute() in my
 Application.  However, the ServerRouter in the ComponentHelper is
 trying
 to route it first, but is returning a 405 Method Not Allowed from
 a POST
 Request.  My web.xml has the org.restlet.application set to my actual
 Application instance, but I'm leaving the Component to the
 ServerServlet
 to create.  Do I need to create my own?

 Any ideas?

 Thanks,
 Dustin

 --


 Dustin N. Jenkins | Tel/Tél: 250.363.3101 |
 dustin.jenk...@nrc-cnrc.gc.ca mailto:dustin.jenk...@nrc-cnrc.gc.ca

 facsimile/télécopieur: (250) 363-0045

 National Research Council Canada | 5071 West Saanich Rd, Victoria BC.
 V9E 2E7

 Conseil national de recherches Canada | 5071, ch. West Saanich,
 Victoria
 (C.-B) V9E 2E7

 Government of Canada | Gouvernement du Canada

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



-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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

Tomcat Restlet Threads and OutOfMemoryException

2010-04-30 Thread Dustin N. Jenkins
I'm running a Tomcat Container version 6.0.26 with JDK 1.6_20 in Linux 
with Restlet 2.0 RC3.

I'm seeing a lot of the following when I shut my Tomcat instance down:
SEVERE: A web application created a ThreadLocal with key of type 
[java.lang.ThreadLocal] (value [java.lang.threadlo...@3fb0ed]) and a 
value of type [org.restlet.Application] (value 
[org.restlet.applicat...@b5423f]) but failed to remove it when the web 
application was stopped. To prevent a memory leak, the ThreadLocal has 
been forcibly removed.
Apr 30, 2010 1:28:55 PM org.apache.catalina.loader.WebappClassLoader 
clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type 
[java.lang.ThreadLocal] (value [java.lang.threadlo...@15306c6]) and a 
value of type [org.restlet.Response] (value [WAR/null 200 The request 
has succeeded]) but failed to remove it when the web application was 
stopped. To prevent a memory leak, the ThreadLocal has been forcibly 
removed.
Apr 30, 2010 1:28:55 PM org.apache.catalina.loader.WebappClassLoader 
clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type 
[java.lang.ThreadLocal] (value [java.lang.threadlo...@1e1cb7d]) and a 
value of type [org.restlet.engine.component.ChildContext] (value 
[org.restlet.engine.component.childcont...@f683b0]) but failed to remove 
it when the web application was stopped. To prevent a memory leak, the 
ThreadLocal has been forcibly removed.

If I test it long enough, the Container returns with an 
OutOfMemoryException:

java.lang.OutOfMemoryError: unable to create new native thread
 java.lang.Thread.start0(Native Method)
 java.lang.Thread.start(Thread.java:597)
 
java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadPoolExecutor.java:703)
 
java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:652)
 
java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:78)
 
java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:600)
 org.restlet.engine.http.connector.BaseHelper.start(BaseHelper.java:461)
 
org.restlet.engine.http.connector.BaseClientHelper.start(BaseClientHelper.java:652)
 
org.restlet.engine.http.connector.HttpClientHelper.start(HttpClientHelper.java:58)
 org.restlet.Client.start(Client.java:350)
 org.restlet.Restlet.handle(Restlet.java:217)
 org.restlet.Client.handle(Client.java:229)
 org.restlet.Client.handle(Client.java:223)
ca.nrc.cadc.restlet.freemarker.StandardHeaderTemplateDirective.execute(StandardHeaderTemplateDirective.java:104)

I couldn't see any bugs related to this.  Any insight into this?

Thank you!
Dustin

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Tomcat Restlet Threads and OutOfMemoryException

2010-04-30 Thread Dustin N. Jenkins
Oh, and my Restlet beans (Application, Context, Router, and Resources) 
are all Spring-loaded beans with scope = prototype.

Thanks again,
Dustin


On 04/30/2010 01:50 PM, Dustin N. Jenkins wrote:
 I'm running a Tomcat Container version 6.0.26 with JDK 1.6_20 in Linux
 with Restlet 2.0 RC3.

 I'm seeing a lot of the following when I shut my Tomcat instance down:
 SEVERE: A web application created a ThreadLocal with key of type
 [java.lang.ThreadLocal] (value [java.lang.threadlo...@3fb0ed]) and a
 value of type [org.restlet.Application] (value
 [org.restlet.applicat...@b5423f]) but failed to remove it when the web
 application was stopped. To prevent a memory leak, the ThreadLocal has
 been forcibly removed.
 Apr 30, 2010 1:28:55 PM org.apache.catalina.loader.WebappClassLoader
 clearThreadLocalMap
 SEVERE: A web application created a ThreadLocal with key of type
 [java.lang.ThreadLocal] (value [java.lang.threadlo...@15306c6]) and a
 value of type [org.restlet.Response] (value [WAR/null 200 The request
 has succeeded]) but failed to remove it when the web application was
 stopped. To prevent a memory leak, the ThreadLocal has been forcibly
 removed.
 Apr 30, 2010 1:28:55 PM org.apache.catalina.loader.WebappClassLoader
 clearThreadLocalMap
 SEVERE: A web application created a ThreadLocal with key of type
 [java.lang.ThreadLocal] (value [java.lang.threadlo...@1e1cb7d]) and a
 value of type [org.restlet.engine.component.ChildContext] (value
 [org.restlet.engine.component.childcont...@f683b0]) but failed to remove
 it when the web application was stopped. To prevent a memory leak, the
 ThreadLocal has been forcibly removed.

 If I test it long enough, the Container returns with an
 OutOfMemoryException:

 java.lang.OutOfMemoryError: unable to create new native thread
   java.lang.Thread.start0(Native Method)
   java.lang.Thread.start(Thread.java:597)

 java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadPoolExecutor.java:703)

 java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:652)

 java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:78)

 java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:600)
   org.restlet.engine.http.connector.BaseHelper.start(BaseHelper.java:461)

 org.restlet.engine.http.connector.BaseClientHelper.start(BaseClientHelper.java:652)

 org.restlet.engine.http.connector.HttpClientHelper.start(HttpClientHelper.java:58)
   org.restlet.Client.start(Client.java:350)
   org.restlet.Restlet.handle(Restlet.java:217)
   org.restlet.Client.handle(Client.java:229)
   org.restlet.Client.handle(Client.java:223)
 ca.nrc.cadc.restlet.freemarker.StandardHeaderTemplateDirective.execute(StandardHeaderTemplateDirective.java:104)

 I couldn't see any bugs related to this.  Any insight into this?

 Thank you!
 Dustin



-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


How to use Filters with Spring Configuration

2010-04-23 Thread Dustin N. Jenkins
Howdy,

I'm using Restlet 2.0 RC3 on Linux with JDK 1.6_20 and Tomcat 6.0.26.  
Latest and greatest.

Is there an appropriate way to use Filters with Spring loaded 
Resources?  I have some Resource beans:

bean name=/abc/xyz id=myresource class=abc.xyz.MyResource /
bean name=/abc/xyz/1 id=myotherresource 
class=abc.xyz.MyOtherResource /
bean name=/abc/xyz/2 id=anotherresource 
class=abc.xyz.AnotherResource /

I have an AuthorizationFilter, which will check for X509 Certificates 
and implementors can do appropriate authorization based on it.  This 
Filter is also a Spring loaded bean.  Defining it and wiring it up to 
the next Resource is tough since one can't simply set the 'next' 
property to be the next Resource bean when one doesn't know what it will 
be.  Also, I think I'm supposed to name the bean like a Resource:

bean name=/abc/xyz/protected ... /

Is there a certain way to do this that I've missed?

Thanks!
Dustin

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: [Disregard/Solved] How to use Filters with Spring Configuration

2010-04-23 Thread Dustin N. Jenkins
Please disregard.  I just found that one needs to set the Router as the 
'next' and it should work.

Apologies and thanks!
Dustin



On 04/23/2010 01:56 PM, Dustin N. Jenkins wrote:
 Howdy,

 I'm using Restlet 2.0 RC3 on Linux with JDK 1.6_20 and Tomcat 6.0.26.
 Latest and greatest.

 Is there an appropriate way to use Filters with Spring loaded
 Resources?  I have some Resource beans:

 bean name=/abc/xyz id=myresource class=abc.xyz.MyResource /
 bean name=/abc/xyz/1 id=myotherresource
 class=abc.xyz.MyOtherResource /
 bean name=/abc/xyz/2 id=anotherresource
 class=abc.xyz.AnotherResource /

 I have an AuthorizationFilter, which will check for X509 Certificates
 and implementors can do appropriate authorization based on it.  This
 Filter is also a Spring loaded bean.  Defining it and wiring it up to
 the next Resource is tough since one can't simply set the 'next'
 property to be the next Resource bean when one doesn't know what it will
 be.  Also, I think I'm supposed to name the bean like a Resource:

 bean name=/abc/xyz/protected ... /

 Is there a certain way to do this that I've missed?

 Thanks!
 Dustin



-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: QueryParam missing after upgrade to 2.0m7

2010-02-17 Thread Dustin N. Jenkins
Hi Anthony,

It's a known bug.  It is fixed in the Snapshot release.

Dustin


On 02/16/2010 10:32 PM, webp...@tigris.org wrote:
 Hi

 I've just upgraded from Restlet 2.0m4 to 2.0m7, apart from a few API changes 
 I have no problems upgrading.

 I'm using the Restlet JAXRS Extension on my Server.

 When I run my unit test, the ones when client sends QueryParms to the server 
 they all failed.

 This is an example of my client test code;

 String uri = BASE_URI + ?startRow=100rowCount=100;

 // Invoke the web service
 ClientResource clientResource = new ClientResource(uri);
   
 String resultSetXML = clientResource.get().getText();

 // should get an OK response
 assertTrue(clientResource.getStatus().isSuccess()); //FAILED


 On the server the QueryParams startRow=100rowCount=100 are missing. But when 
 I type the same URI into IE everything works perfectly and my server can read 
 those QueryParams.

 So my question is, did the client restlet API changed and this is intended? 
 Or there's a bug somewhere?

 I'm happy to do further investigation if this is unintended or provide 
 further details if required.

 Regards,
 Anthony Xiao

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


-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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

Re: POST ignored after GET issued on same URL

2010-02-16 Thread Dustin N. Jenkins
Great, thanks Thierry!

Dustin


On 02/16/2010 02:59 AM, Thierry Boileau wrote:
 Hello Dustin,

 Should I submit a bug report?
 thanks for having submitted a bug report, that's a nice idea.
 I've reassigned the issue (#1035) and updated the target milestone.

 Best regards,
 Thierry Boileau

 I'm using JDK 6 with Tomcat 6.0.24/5.5.20 and Restlet 2.0rc7 on Linux 
 FC8.  Spring 2.6.5 is also used.

 I have a reproducable issue, with a test case for this problem now.  
 I had submitted this a month and a half ago, but only now had time to 
 mock up a test case.

 If I submit a GET request to /myservlet/list, which returns a list of 
 items in XML, then submit a POST to /myservlet/list, the POST is 
 ignored and the GET is instead issued.  My debugger has shown that 
 the Request's Method is indeed a POST, but the Variant's method is GET.

 I don't think I can attach the test case here.  Should I submit a bug 
 report?

 Thanks,
 Dustin

 -- 


 Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

 facsimile/télécopieur: (250) 363-0045

 National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
 V9E 2E7

 Conseil national de recherches Canada | 5071, ch. West Saanich, 
 Victoria (C.-B) V9E 2E7

 Government of Canada | Gouvernement du Canada


-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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

POST ignored after GET issued on same URL

2010-02-12 Thread Dustin N. Jenkins
I'm using JDK 6 with Tomcat 6.0.24/5.5.20 and Restlet 2.0rc7 on Linux 
FC8.  Spring 2.6.5 is also used.

I have a reproducable issue, with a test case for this problem now.  I 
had submitted this a month and a half ago, but only now had time to mock 
up a test case.

If I submit a GET request to /myservlet/list, which returns a list of 
items in XML, then submit a POST to /myservlet/list, the POST is ignored 
and the GET is instead issued.  My debugger has shown that the Request's 
Method is indeed a POST, but the Variant's method is GET.

I don't think I can attach the test case here.  Should I submit a bug 
report?

Thanks,
Dustin

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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

Re: Query string being ignored with Client.get()

2010-02-11 Thread Dustin N. Jenkins
Sorry, I just noticed this was fixed in the snapshot.

Dustin


On 02/10/2010 05:35 PM, Dustin N. Jenkins wrote:
 I'm using JDK 1.6 build 18, with Fedora Core 8 and Restlet 2.0rc7 on
 Tomcat 6.0.24.

 I have a peculiar problem that started with Restlet 2.0rc7.  The
 Client.get() calls are ignoring the query string when called:

 Client client = new Client(Protocol.HTTP);
 Response response =
 client.get(http://www.google.com/search?q=Supernatural;);

 This URL should return the search results page, but it instead returns
 the redirect to http://www.google.com/webhp;, which is the redirect if
 no search parameters (the query string) are given.  Is this a known bug?

 It works fine if I use the Client.get(new Reference(http,
 www.google.com, 80, /search, q=Supernatural, null));

 Thank you!
 Dustin

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


-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: restlet with open session in view for hibernate

2009-12-03 Thread Dustin N. Jenkins
Hello,

I currently use the Hibernate/Spring Open Session In View model too with 
FreeMarker and it works perfectly.  Can you post your web.xml?  Is it 
setup properly?

Dustin


kiwionly wrote:
 hi, 

 I had create an web application that using restlet to replace serlvet (for 
 Resource that no need any session).

 my web app basically is using spring + hibernate + velocity template (with 
 restlet extension for velocity template)

 however, i had encounter LazyInitializeException, as my servlet had an 
 Inteceptor for hibernate session. But it don't have any OSIV for reslet. 
 hence the exception come. (spring close the session before complete render 
 the page).

 do restlet plan to support a use case for this ? or do anyone have find a 
 solution ?

 any idea ?

 regards,
 kiwionly

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: HTTPS with Tomcat

2009-12-01 Thread Dustin N. Jenkins
Thanks, Bruno.

I am using the Client certificate authentication method.  It does look 
like the best way to do it is to place a ChallengeAuthenticator in front 
of my resource to ensure there is Certifiate authorization.  Does that 
sound right?

Thank you,
Dustin



Bruno Harbulot wrote:
 Hi Dustin,

 If you're running within Tomcat (or other servlet containers), it's 
 Tomcat that deals with the SSL connector, not the Restlet connector.
 Therefore, this setup has nothing to do with what's on the Restlet wiki 
 regarding SslContextFactories (which are only for connections with a 
 direct connector in Restlet). You should follow the Tomcat SSL 
 documentation for this instead.

 If you want to use client-certificate authentication, the Servlet 
 connector (of Restlet) relays the certificate chain (same as with the 
 other connectors), so you can get it from the 
 org.restlet.https.clientCertificates attribute in the Request: this is 
 a List of certificates (whereas javax.servlet.request.X509Certificate 
 is an array in Servlets).

 Best wishes,

 Bruno.

 Dustin N. Jenkins wrote:
   
 I'm using Java 1.6, RESTlet 2.0M6, Tomcat 6.0.20, on a Linux system.

 My Tomcat runs a Connector on port 8443 to support HTTPS connections, 
 and my Apache configuration is proxying to it.  It's not using the AJP, 
 but just with Redirects.

 I'm not sure how to setup SSL Certificates with my REST application.  
 For the BASIC authentication with HTTP, one would use a ChallengeGuard, 
 for example, but with HTTPS, do we still need a Guard in place to check 
 for certificates?

 The setup has me confused too.  See here:
 http://wiki.restlet.org/docs_2.0/13-restlet/28-restlet/153-restlet.html

 Do I need to configure a Server bean to look on the 8443 port that 
 Tomcat already has open?  I assume a SSLContextFactory of some kind 
 needs to be configured.

 Has anyone got HTTPS Certificates working?  Is there a guide for it?

 Thanks,
 Dustin
 

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


HTTPS with Tomcat

2009-11-30 Thread Dustin N. Jenkins
I'm using Java 1.6, RESTlet 2.0M6, Tomcat 6.0.20, on a Linux system.

My Tomcat runs a Connector on port 8443 to support HTTPS connections, 
and my Apache configuration is proxying to it.  It's not using the AJP, 
but just with Redirects.

I'm not sure how to setup SSL Certificates with my REST application.  
For the BASIC authentication with HTTP, one would use a ChallengeGuard, 
for example, but with HTTPS, do we still need a Guard in place to check 
for certificates?

The setup has me confused too.  See here:
http://wiki.restlet.org/docs_2.0/13-restlet/28-restlet/153-restlet.html

Do I need to configure a Server bean to look on the 8443 port that 
Tomcat already has open?  I assume a SSLContextFactory of some kind 
needs to be configured.

Has anyone got HTTPS Certificates working?  Is there a guide for it?

Thanks,
Dustin
-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: HTTPS with Tomcat

2009-11-30 Thread Dustin N. Jenkins
Perfect, thank you Bruno.

Dustin



Bruno Harbulot wrote:
 Hi Dustin,

 If you're running within Tomcat (or other servlet containers), it's 
 Tomcat that deals with the SSL connector, not the Restlet connector.
 Therefore, this setup has nothing to do with what's on the Restlet wiki 
 regarding SslContextFactories (which are only for connections with a 
 direct connector in Restlet). You should follow the Tomcat SSL 
 documentation for this instead.

 If you want to use client-certificate authentication, the Servlet 
 connector (of Restlet) relays the certificate chain (same as with the 
 other connectors), so you can get it from the 
 org.restlet.https.clientCertificates attribute in the Request: this is 
 a List of certificates (whereas javax.servlet.request.X509Certificate 
 is an array in Servlets).

 Best wishes,

 Bruno.

 Dustin N. Jenkins wrote:
   
 I'm using Java 1.6, RESTlet 2.0M6, Tomcat 6.0.20, on a Linux system.

 My Tomcat runs a Connector on port 8443 to support HTTPS connections, 
 and my Apache configuration is proxying to it.  It's not using the AJP, 
 but just with Redirects.

 I'm not sure how to setup SSL Certificates with my REST application.  
 For the BASIC authentication with HTTP, one would use a ChallengeGuard, 
 for example, but with HTTPS, do we still need a Guard in place to check 
 for certificates?

 The setup has me confused too.  See here:
 http://wiki.restlet.org/docs_2.0/13-restlet/28-restlet/153-restlet.html

 Do I need to configure a Server bean to look on the 8443 port that 
 Tomcat already has open?  I assume a SSLContextFactory of some kind 
 needs to be configured.

 Has anyone got HTTPS Certificates working?  Is there a guide for it?

 Thanks,
 Dustin
 

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: POST ignored in RESTlet 2.0Mx

2009-11-20 Thread Dustin N. Jenkins
Hi Thierry,

That's right, my @Post method is not being called.  I'm expecting the 
additional @Get as part of the redirect, but the initial @Post should 
still be called.  If I restart my Tomcat container, then it works for 
one, maybe two requests, then it simply goes straight to the @Get 
method, but the logs still show a POST request.  I've also attached my 
debugger to the @Post and @Get methods to be sure, and only the @Get 
method is called, and if I call getMethod() from within there, it says 
it's a POST, so it's a little confusing.  This is why I was thinking 
that something is cached and the @Post is skipped, but it's just a guess.

The latest snapshot seems better, though, so I'm going to work with that 
for a while to see if it stays more stable.

Thanks for the reply,
Dustin



Thierry Boileau wrote:
 Hi Dustin,

 something is not clear for me. When you send a post request to your 
 resource, is your post method called or not?
 If not, there is a problem. Otherwise, as said Stephan, a redirection 
 makes your browser makes automatically an additional GET request the new 
 location.

 Best regards,
 Thierry Boileau

   
 Hi Dustin,

 303 (see other) says, that the result is at the given location, and you 
 have to get it with GET. So the behaviour is right.
 Use 301 (Moved Permanently) or 307 (Temporary redirect).
 See http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection

 best regards
Stephan

 Dustin N. Jenkins schrieb:
   
 
 I'm using Java 6, Tomcat 6.0.20, RESTlet 2.0M5 on a Linux platform.

 After my business operations in my POST call, I simply call 
 redirectSeeOther().  When I make POST calls to the Resource now, the log 
 records it as a POST call, but my @Get method is being called instead.  
 Does the redirectSeeOther() get cached somewhere or something?  Normally 
 I'd see a POST followed by a GET in the log.  Is this a bug in the 
 current 2.0 tree?  The snapshot is doing the same thing.

 I've used wget and browser clients just to test this.

 Thanks,
 Dustin

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


 

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


POST ignored in RESTlet 2.0Mx

2009-11-19 Thread Dustin N. Jenkins
I'm using Java 6, Tomcat 6.0.20, RESTlet 2.0M5 on a Linux platform.

After my business operations in my POST call, I simply call 
redirectSeeOther().  When I make POST calls to the Resource now, the log 
records it as a POST call, but my @Get method is being called instead.  
Does the redirectSeeOther() get cached somewhere or something?  Normally 
I'd see a POST followed by a GET in the log.  Is this a bug in the 
current 2.0 tree?  The snapshot is doing the same thing.

I've used wget and browser clients just to test this.

Thanks,
Dustin

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: DELETE goes to GET !!

2009-11-13 Thread Dustin N. Jenkins
Are you still talking about the @Delete not being accessed?

I've found that one needs to be more specific with the @Get annotation 
now with regards to the Media Type, meaning annotating the Method with 
@Get by itself isn't enough, rather putting @Get(html) or @Get(xml) 
or something else is necessary.  I can only assume that this is intentional.

Dustin


webp...@tigris.org wrote:
 Ok, 

 Now I have retrieved the restlet-jee-2.0m5. There was some changes since 
 the previous version but no docs.
 Now it seems that my resourec is never acceeded (No logs nor system.out was 
 displayed on my console and my breakpoints never match). 

 Please can ypou help me to make it working ?


 Ther is the logs I receiv when I do a GET on my resource ( 
 http://localhost:8081/epublish/templates/Big_sample1.odt ) :
 # 13-nov.-2009 9:16:11 org.restlet.engine.http.StreamServerHelper start
 # INFO: Starting the internal HTTP server
 # 13-nov.-2009 9:16:13 org.restlet.routing.Filter doHandle
 # ATTENTION: A filter was executed without a next Restlet attached to it.
 # 13-nov.-2009 9:16:13 org.restlet.engine.log.LogFilter afterHandle
 # INFO: 2009-11-1309:16:13127.0.0.1   -   -   8081
 GET /epublish/templates/Big_sample1.odt -   500 365 - 
   15  http://localhost:8081   Apache-HttpClient/4.0-beta2 (java 1.5)  -

 My resource is joined as attachment.

 Thanks

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Null Context in ServerResource through SpringBeanFinder

2009-10-29 Thread Dustin N. Jenkins
Hi Jerome,

I sent a tar file containing the source and WAR file, but the attachment 
was 4.4M in the end.  It sent fine, but I haven't seen it pop up on 
here.  Is there a better way to get it to you?  Or will it come through 
eventually?

Thanks,
Dustin


Jerome Louvel wrote:
 Hi Dustin,

 Thanks for all the details. Would it be possible for you to send a mini 
 project (Eclipse or other) that would reproduce the issue? That would 
 really help us resolving any issue quickly.

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



 Dustin N. Jenkins a écrit :
   
 I should mention too that I have my component defined:

   !-- The Restlet Component --
   bean name=component class=org.restlet.ext.spring.SpringComponent
 property name=defaultTarget ref=application /
 property name=context ref=component.context /
 property name=clientsList
   list
 valuehttp/value
 valuefile/value
   /list
 /property
   /bean

   bean name=component.context
 
 class=org.springframework.beans.factory.config.PropertyPathFactoryBean /

 And also in my web.xml:

 context-param
   param-nameorg.restlet.component/param-name
   param-valuecomponent/param-value
 /context-param

 Thanks!
 Dustin


 Dustin N. Jenkins wrote:
   
 
 Hello!

 I'm using Java 1.6, Tomcat 6, RESTlet 2.0M5, Spring 2.5, the supported 
 version of FreeMarker, all on Linux.

 The relevant part of my spring configuration looks like this:

 bean id=freeMarkerConfig 
 class=org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
   ...
 /bean

 bean id=application name=application class=org.restlet.Application
   property name=root ref=router /
   ...
 /bean

 bean name=router class=org.restlet.ext.spring.SpringBeanRouter /

 bean abstract=true name=baseResource scope=prototype 
 class=ca.nrc.cadc.dp.web.restlet.resources.AbstractResource
   !-- Method to configure FreeMarker using the FreeMarker Configurer. --
   property name=freeMarkerConfigViaConfigurer 
 ref=freeMarkerConfigurer /
 /bean

 Which is very straightforward and worked fine with the 1.1.x versions of 
 RESTlet.  Here are the relevant parts of my web.xml also:

 context-param
   param-nameorg.restlet.application/param-name
   param-valueapplication/param-value
 /context-param

   servlet
 servlet-nameRestletServer/servlet-name
 
 servlet-classorg.restlet.ext.spring.SpringServerServlet/servlet-class
 load-on-startup1/load-on-startup
   /servlet

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

 My problem is that in my baseResource bean, I create a new 
 ContextTemplateLoader for FreeMarker to use, and I pass it getContext() 
 like so:

 /**
  * Set the FreeMarker Configuration.
  *
  * @param freeMarkerConfig  The FreeMarker Configuration instance.
  */
 public void setFreeMarkerConfig(final Configuration freeMarkerConfig)
 {
 if (freeMarkerConfig == null)
 {
 throw new FreeMarkerConfigurationException(
 FreeMarker Configuration cannot be NULL);
 }

 this.freeMarkerConfig = freeMarkerConfig;

 freeMarkerConfig.setTemplateLoader(
 new ContextTemplateLoader(getContext(),
   war:///freemarker-templates/));
 }

 public void setFreeMarkerConfigViaConfigurer(
 final FreeMarkerConfigurer springFreeMarkerConfigurer)
 {
 setFreeMarkerConfig(springFreeMarkerConfigurer.getConfiguration());
 }

 but getContext() returns null because the ServerResource's context 
 member is null.  Is there a step I need to set the Context?  The 
 SpringBeanFinder from the Router is passing in a null Context when the 
 init(Context, Request, Response) method is called on the 
 ServerResource.  Has anyone else experienced this?  I have not tried the 
 SVN trunk of RESTlet yet.

 Many thanks!
 Dustin
   
 
   
 

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Null Context in ServerResource through SpringBeanFinder

2009-10-29 Thread Dustin N. Jenkins
From some further investigation, it looks like the problem stems from 
the Finder class still using the deprecated methods, which require the 
Resource class instead of the ServerResource class.  Fixing this may be 
as simple as overriding the findTarget() method to return the result of 
the find() method.

Dustin


Dustin N. Jenkins wrote:
 Hi Jerome,

 I sent a tar file containing the source and WAR file, but the attachment 
 was 4.4M in the end.  It sent fine, but I haven't seen it pop up on 
 here.  Is there a better way to get it to you?  Or will it come through 
 eventually?

 Thanks,
 Dustin


 Jerome Louvel wrote:
   
 Hi Dustin,

 Thanks for all the details. Would it be possible for you to send a mini 
 project (Eclipse or other) that would reproduce the issue? That would 
 really help us resolving any issue quickly.

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



 Dustin N. Jenkins a écrit :
   
 
 I should mention too that I have my component defined:

   !-- The Restlet Component --
   bean name=component class=org.restlet.ext.spring.SpringComponent
 property name=defaultTarget ref=application /
 property name=context ref=component.context /
 property name=clientsList
   list
 valuehttp/value
 valuefile/value
   /list
 /property
   /bean

   bean name=component.context
 
 class=org.springframework.beans.factory.config.PropertyPathFactoryBean /

 And also in my web.xml:

 context-param
   param-nameorg.restlet.component/param-name
   param-valuecomponent/param-value
 /context-param

 Thanks!
 Dustin


 Dustin N. Jenkins wrote:
   
 
   
 Hello!

 I'm using Java 1.6, Tomcat 6, RESTlet 2.0M5, Spring 2.5, the supported 
 version of FreeMarker, all on Linux.

 The relevant part of my spring configuration looks like this:

 bean id=freeMarkerConfig 
 class=org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
   ...
 /bean

 bean id=application name=application class=org.restlet.Application
   property name=root ref=router /
   ...
 /bean

 bean name=router class=org.restlet.ext.spring.SpringBeanRouter /

 bean abstract=true name=baseResource scope=prototype 
 class=ca.nrc.cadc.dp.web.restlet.resources.AbstractResource
   !-- Method to configure FreeMarker using the FreeMarker Configurer. --
   property name=freeMarkerConfigViaConfigurer 
 ref=freeMarkerConfigurer /
 /bean

 Which is very straightforward and worked fine with the 1.1.x versions of 
 RESTlet.  Here are the relevant parts of my web.xml also:

 context-param
   param-nameorg.restlet.application/param-name
   param-valueapplication/param-value
 /context-param

   servlet
 servlet-nameRestletServer/servlet-name
 
 servlet-classorg.restlet.ext.spring.SpringServerServlet/servlet-class
 load-on-startup1/load-on-startup
   /servlet

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

 My problem is that in my baseResource bean, I create a new 
 ContextTemplateLoader for FreeMarker to use, and I pass it getContext() 
 like so:

 /**
  * Set the FreeMarker Configuration.
  *
  * @param freeMarkerConfig  The FreeMarker Configuration instance.
  */
 public void setFreeMarkerConfig(final Configuration freeMarkerConfig)
 {
 if (freeMarkerConfig == null)
 {
 throw new FreeMarkerConfigurationException(
 FreeMarker Configuration cannot be NULL);
 }

 this.freeMarkerConfig = freeMarkerConfig;

 freeMarkerConfig.setTemplateLoader(
 new ContextTemplateLoader(getContext(),
   war:///freemarker-templates/));
 }

 public void setFreeMarkerConfigViaConfigurer(
 final FreeMarkerConfigurer springFreeMarkerConfigurer)
 {
 setFreeMarkerConfig(springFreeMarkerConfigurer.getConfiguration());
 }

 but getContext() returns null because the ServerResource's context 
 member is null.  Is there a step I need to set the Context?  The 
 SpringBeanFinder from the Router is passing in a null Context when the 
 init(Context, Request, Response) method is called on the 
 ServerResource.  Has anyone else experienced this?  I have not tried the 
 SVN trunk of RESTlet yet.

 Many thanks!
 Dustin
   
 
   
 
 
   
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2411727
   
 

   

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

Null Context in ServerResource through SpringBeanFinder

2009-10-27 Thread Dustin N. Jenkins
Hello!

I'm using Java 1.6, Tomcat 6, RESTlet 2.0M5, Spring 2.5, the supported 
version of FreeMarker, all on Linux.

The relevant part of my spring configuration looks like this:

bean id=freeMarkerConfig 
class=org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
  ...
/bean

bean id=application name=application class=org.restlet.Application
  property name=root ref=router /
  ...
/bean

bean name=router class=org.restlet.ext.spring.SpringBeanRouter /

bean abstract=true name=baseResource scope=prototype 
class=ca.nrc.cadc.dp.web.restlet.resources.AbstractResource
  !-- Method to configure FreeMarker using the FreeMarker Configurer. --
  property name=freeMarkerConfigViaConfigurer 
ref=freeMarkerConfigurer /
/bean

Which is very straightforward and worked fine with the 1.1.x versions of 
RESTlet.  Here are the relevant parts of my web.xml also:

context-param
  param-nameorg.restlet.application/param-name
  param-valueapplication/param-value
/context-param

  servlet
servlet-nameRestletServer/servlet-name

servlet-classorg.restlet.ext.spring.SpringServerServlet/servlet-class
load-on-startup1/load-on-startup
  /servlet

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

My problem is that in my baseResource bean, I create a new 
ContextTemplateLoader for FreeMarker to use, and I pass it getContext() 
like so:

/**
 * Set the FreeMarker Configuration.
 *
 * @param freeMarkerConfig  The FreeMarker Configuration instance.
 */
public void setFreeMarkerConfig(final Configuration freeMarkerConfig)
{
if (freeMarkerConfig == null)
{
throw new FreeMarkerConfigurationException(
FreeMarker Configuration cannot be NULL);
}

this.freeMarkerConfig = freeMarkerConfig;

freeMarkerConfig.setTemplateLoader(
new ContextTemplateLoader(getContext(),
  war:///freemarker-templates/));
}

public void setFreeMarkerConfigViaConfigurer(
final FreeMarkerConfigurer springFreeMarkerConfigurer)
{
setFreeMarkerConfig(springFreeMarkerConfigurer.getConfiguration());
}

but getContext() returns null because the ServerResource's context 
member is null.  Is there a step I need to set the Context?  The 
SpringBeanFinder from the Router is passing in a null Context when the 
init(Context, Request, Response) method is called on the 
ServerResource.  Has anyone else experienced this?  I have not tried the 
SVN trunk of RESTlet yet.

Many thanks!
Dustin
-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Null Context in ServerResource through SpringBeanFinder

2009-10-27 Thread Dustin N. Jenkins
I should mention too that I have my component defined:

  !-- The Restlet Component --
  bean name=component class=org.restlet.ext.spring.SpringComponent
property name=defaultTarget ref=application /
property name=context ref=component.context /
property name=clientsList
  list
valuehttp/value
valuefile/value
  /list
/property
  /bean

  bean name=component.context

class=org.springframework.beans.factory.config.PropertyPathFactoryBean /

And also in my web.xml:

context-param
  param-nameorg.restlet.component/param-name
  param-valuecomponent/param-value
/context-param

Thanks!
Dustin


Dustin N. Jenkins wrote:
 Hello!

 I'm using Java 1.6, Tomcat 6, RESTlet 2.0M5, Spring 2.5, the supported 
 version of FreeMarker, all on Linux.

 The relevant part of my spring configuration looks like this:

 bean id=freeMarkerConfig 
 class=org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
   ...
 /bean

 bean id=application name=application class=org.restlet.Application
   property name=root ref=router /
   ...
 /bean

 bean name=router class=org.restlet.ext.spring.SpringBeanRouter /

 bean abstract=true name=baseResource scope=prototype 
 class=ca.nrc.cadc.dp.web.restlet.resources.AbstractResource
   !-- Method to configure FreeMarker using the FreeMarker Configurer. --
   property name=freeMarkerConfigViaConfigurer 
 ref=freeMarkerConfigurer /
 /bean

 Which is very straightforward and worked fine with the 1.1.x versions of 
 RESTlet.  Here are the relevant parts of my web.xml also:

 context-param
   param-nameorg.restlet.application/param-name
   param-valueapplication/param-value
 /context-param

   servlet
 servlet-nameRestletServer/servlet-name
 
 servlet-classorg.restlet.ext.spring.SpringServerServlet/servlet-class
 load-on-startup1/load-on-startup
   /servlet

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

 My problem is that in my baseResource bean, I create a new 
 ContextTemplateLoader for FreeMarker to use, and I pass it getContext() 
 like so:

 /**
  * Set the FreeMarker Configuration.
  *
  * @param freeMarkerConfig  The FreeMarker Configuration instance.
  */
 public void setFreeMarkerConfig(final Configuration freeMarkerConfig)
 {
 if (freeMarkerConfig == null)
 {
 throw new FreeMarkerConfigurationException(
 FreeMarker Configuration cannot be NULL);
 }

 this.freeMarkerConfig = freeMarkerConfig;

 freeMarkerConfig.setTemplateLoader(
 new ContextTemplateLoader(getContext(),
   war:///freemarker-templates/));
 }

 public void setFreeMarkerConfigViaConfigurer(
 final FreeMarkerConfigurer springFreeMarkerConfigurer)
 {
 setFreeMarkerConfig(springFreeMarkerConfigurer.getConfiguration());
 }

 but getContext() returns null because the ServerResource's context 
 member is null.  Is there a step I need to set the Context?  The 
 SpringBeanFinder from the Router is passing in a null Context when the 
 init(Context, Request, Response) method is called on the 
 ServerResource.  Has anyone else experienced this?  I have not tried the 
 SVN trunk of RESTlet yet.

 Many thanks!
 Dustin
   

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Help with basic spring setup

2009-09-24 Thread Dustin N. Jenkins
Use the org.restlet.ext.servlet.SpringServerServlet instead.

Dustin


norton borf wrote:
 Hi,
 I am using the 2.0 snapshot and trying to get Restlet to work in a Spring 
 2.5.6 application. I have read as much as I can from the docs but am unable 
 to get this working.

 --
 MY WEB.XML

 What am I missing here? I somehow need to hook this into my Spring 
 application already running within this web-app and loaded via a standard 
 ContextLoaderlistener
 --
  servlet
   servlet-namerest-api-v1/servlet-name
   
 servlet-classorg.restlet.ext.servlet.ServerServlet/servlet-class
 /servlet

   servlet-mapping
   servlet-namerest-api-v1/servlet-name
   url-pattern/api/REST/v1/*/url-pattern
   /servlet-mapping

 -
 Restlet PORTION OF MY APP-CONTEXT.xml
 --

 !-- this Application class configures a single resource that lives at 
 /hello --
 bean id=feedbackRestApp 
 class=com.leopard.feedback.rest.v1.application.FeedbackApplication/

 !-- So from what I have seen in various guides out there I need this 
 SpringComponent defined, how does the ServerServlet, talk to this or even 
 know about it --
 bean id=feedbackRestRoot class=org.restlet.ext.spring.SpringComponent
   property name=defaultTarget ref=feedbackRestApp /
 /bean

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


XML Extension not being cleaned up

2009-09-08 Thread Dustin N. Jenkins
I'm using Restlet 2.0 M4 with JDK 1.6.0_16 on Fedora Core 8.  My web 
application's container is Tomcat 6.0.20.

My web application returns XML Representations for each GET request, and 
the Representations are all created like so:

try
{
final DomRepresentation rep =
new DomRepresentation(MediaType.TEXT_XML);
final Document document = rep.getDocument();

// Create elements and append them to the Document.
buildXML(document);

document.normalizeDocument();

return rep;
}
catch (IOException e)
{
LOGGER.error(Unable to create representation., e);
throw new InvalidResourceException(
Unable to create XML Document., e);
}

The buildXML() method simply creates Elements for a Domain Object with 
an XML Namespace and appends them to the given Document.

But if I try to hot redeploy the webapp in Tomcat, there is still a 
handle on the org.restlet.ext.xml.jar file, so if the 
${CATALINA_BASE}/webapps directory were NFS mounted, the .nfs file 
would still exist and Tomcat could not redeploy it.

Is anyone else having trouble with this?  Is this a problem with Streams 
not closing somewhere along the line?

Thanks,
Dustin
-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Restlet 2.0 M4 released!

2009-08-17 Thread Dustin N. Jenkins
Nope, I just downloaded the latest and it's all good now.

Thanks!
Dustin



Jerome Louvel wrote:
 Hi Dustin,

 Do you still have the issue? I have just downloaded Restlet 2.0 M4 for JEE 
 and the SpringServerServlet is present in the JAR.

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


 -Message d'origine-
 De : Dustin N. Jenkins [mailto:dustin.jenk...@nrc-cnrc.gc.ca] 
 Envoyé : vendredi 7 août 2009 16:47
 À : discuss@restlet.tigris.org
 Objet : Re: Restlet 2.0 M4 released!

 You're right, I don't need the Simple extension and I'm not sure why I 
 brought it up, sorry about that.

 However, the org.restlet.ext.spring.SpringServerServlet class is missing 
 from the Spring extension, but remains in the JavaDocs.

 Dustin


 Jerome Louvel wrote:
   
 Hi guys,

 The reasoning is that we you plan to use Restlet in a Java EE container, 
 all you really need is the Servlet adapter extension. During 
 development/prototyping, you could use the internal HTTP server and 
 client connectors to do quick tests.

 Dustin, what is your use case requiring both the Servlet and the Simple 
 extensions?

 Cheers,
 Jerome


 Thierry Boileau a écrit :
   
 
 Hi Dustin,

  the fact that the simple extension is missing from the jee extension 
 is a bug, I've updated the svn repository.
 I'm not very well waken up... Actually , it was chosen to remove the 
 server connectors from the jee edition except the servlet extension.
 But as said previously, we can reconsider this.

 Best regards,
 Thierry Boileau


   
 
   
 Hi Dustin,

 the fact that the simple extension is missing from the jee extension is 
 a bug, I've updated the svn repository.
 It has ben chosen to exclude the servlet extension from the jse 
 edition and integrate it inside the jee one. The latter can be 
 consider as the jse edition plus the support of the servlet and all 
 features that rely on servlet.
 Having said that we are totally open to reconsider the question, and 
 ameliorate what we consider as a proposition.

 Best regards,
 Thierry Boileau

   
 
   
 
 Great work guys, thanks!

 I need features from both the jse, and the jee versions though (i.e. 
 Simple is missing from the jee version, and servlet is missing from the 
 jse version).  Is it best to download both, then merge them?

 Thanks,
 Dustin


 Jerome Louvel wrote:
   
 
   
 
   
 Hi Restleters,

  

 We are happy to announce our latest 2.0 milestone:

 http://blog.noelios.com/2009/08/06/restlet-2-0-m4-released/

  

 We have received an incredible amount of contributions since 2.0 M3: 
 thank you all!

  

 I want also like to highlight the key work done by Thierry, behind the 
 covers, to bring you a fully automated port of all editions (Java SE, 
 Java EE, GWT, GAE and Android) from a single code base. He also 
 greatly improved our build system to provide dedicated distributions 
 for each edition!

  

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

  

  

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


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


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

   

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Restlet 2.0 M4 released!

2009-08-07 Thread Dustin N. Jenkins
You're right, I don't need the Simple extension and I'm not sure why I 
brought it up, sorry about that.

However, the org.restlet.ext.spring.SpringServerServlet class is missing 
from the Spring extension, but remains in the JavaDocs.

Dustin


Jerome Louvel wrote:
 Hi guys,

 The reasoning is that we you plan to use Restlet in a Java EE container, 
 all you really need is the Servlet adapter extension. During 
 development/prototyping, you could use the internal HTTP server and 
 client connectors to do quick tests.

 Dustin, what is your use case requiring both the Servlet and the Simple 
 extensions?

 Cheers,
 Jerome


 Thierry Boileau a écrit :
   
 Hi Dustin,

  the fact that the simple extension is missing from the jee extension 
 is a bug, I've updated the svn repository.
 I'm not very well waken up... Actually , it was chosen to remove the 
 server connectors from the jee edition except the servlet extension.
 But as said previously, we can reconsider this.

 Best regards,
 Thierry Boileau


   
 
 Hi Dustin,

 the fact that the simple extension is missing from the jee extension is 
 a bug, I've updated the svn repository.
 It has ben chosen to exclude the servlet extension from the jse 
 edition and integrate it inside the jee one. The latter can be 
 consider as the jse edition plus the support of the servlet and all 
 features that rely on servlet.
 Having said that we are totally open to reconsider the question, and 
 ameliorate what we consider as a proposition.

 Best regards,
 Thierry Boileau

   
 
   
 Great work guys, thanks!

 I need features from both the jse, and the jee versions though (i.e. 
 Simple is missing from the jee version, and servlet is missing from the 
 jse version).  Is it best to download both, then merge them?

 Thanks,
 Dustin


 Jerome Louvel wrote:
   
 
   
 
 Hi Restleters,

  

 We are happy to announce our latest 2.0 milestone:

 http://blog.noelios.com/2009/08/06/restlet-2-0-m4-released/

  

 We have received an incredible amount of contributions since 2.0 M3: 
 thank you all!

  

 I want also like to highlight the key work done by Thierry, behind the 
 covers, to bring you a fully automated port of all editions (Java SE, 
 Java EE, GWT, GAE and Android) from a single code base. He also 
 greatly improved our build system to provide dedicated distributions 
 for each edition!

  

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

  

  

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


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


 

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Restlet 2.0 M4 released!

2009-08-06 Thread Dustin N. Jenkins
One more thing...  The org.restlet.ext.spring.SpringServerServlet class 
seems to be M.I.A..

Thanks again,
Dustin


Dustin N. Jenkins wrote:
 Great work guys, thanks!

 I need features from both the jse, and the jee versions though (i.e. 
 Simple is missing from the jee version, and servlet is missing from the 
 jse version).  Is it best to download both, then merge them?

 Thanks,
 Dustin


 Jerome Louvel wrote:
   
 Hi Restleters,

  

 We are happy to announce our latest 2.0 milestone:

 http://blog.noelios.com/2009/08/06/restlet-2-0-m4-released/

  

 We have received an incredible amount of contributions since 2.0 M3: 
 thank you all!

  

 I want also like to highlight the key work done by Thierry, behind the 
 covers, to bring you a fully automated port of all editions (Java SE, 
 Java EE, GWT, GAE and Android) from a single code base. He also 
 greatly improved our build system to provide dedicated distributions 
 for each edition!

  

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

  

  

 

   

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Pagination

2009-06-10 Thread Dustin N. Jenkins
I assume the POST/Redirect/GET pattern is the Client POSTing to the 
Resource, and instead of filling the Response's Entity with the 
Representation of the change, one simply redirects the Client to the GET 
representation.  Is this the desired behaviour?  I was under the 
impression that populating the Response's Entity in the POST was 
improper practice, but we often lazily do it.

One more thing I thought of that might be handy is the ability to go 
directly to the First or Last page.  Going to the First page would be 
easy, I think, as one would simply omit the AFTER clause, but going to 
the Last page seems like a different story.  The type of Pagination 
we've been talking about is simply a Go to Next Page and Go to 
Previous Page design, which should be sufficient I guess.  Although I 
think users typically would like to see how many pages there are in the 
result set.  Having said that, though, I suppose if the Searching 
service were asked to simply return everything, and only Resource 
consumes what it wants to based on, say, the User's preferred page size, 
then one could simply do the math on the Collection size.  Anyway, the 
scope of Pagination seems to be growing...

Thanks again for your help Rob.  I really like this approach to RESTful 
Pagination.

Dustin


Rob Heittman wrote:
 Yes, keeping the state bookmarkable for a complex search is also an 
 interesting challenge.  I know one web site (also a science app) that 
 has several hundred variables that can be incorporated in a query, 
 more than a bookmark would easily store.  They keep a permanent cache 
 of search queries in the database and return a minified URL, like 
 bit.ly 
 http://bit.ly, using the Post/Redirect/Get pattern.  They mark position in 
 pagination using query params:

 http://{science-app}/search/afq1z?start=1564extent=20

 but I also like the after approach better:

 http://{science-app}/search/afq1z?after=Sula+Nebouxi,Ecuadorextent=20

 There are also nice properties of the minified query identifier URL, 
 in that it lends itself to subsequent RESTful interrogation in other ways:

 http://{science-app}/search/afq1z/sql -- retrieve SQL query definition
 http://{science-app}/search/afq1z/export/csv -- dump entire data set 
 to CSV

 or fun using Variants ... etc ...

 On Tue, Jun 9, 2009 at 11:44 AM, Dustin N. Jenkins 
 dustin.jenk...@nrc-cnrc.gc.ca mailto:dustin.jenk...@nrc-cnrc.gc.ca 
 wrote:

 Hi Rob,

 Thank you very much for the detailed post.  It's very useful.

 My Persistence Layer uses Hibernate, which in turn uses ehcache as the
 Second Layer cache, but I've always had it turned off, so now
 would be a
 good time to experiment with it I suppose.

 A stable search result is not required in my case, and I would happily
 go back to the Persistence Layer each time as I deal with Scientific
 results that are updated all the time.  A user wouldn't
 necessarily get
 lost while moving from page to page.

 In reference to Josh's solution, I really like the idea of going
 by the
 sorted results and asking for the data after the last known item.  I
 deal with a multi-field form; upwards of a dozen fields to search
 on, so
 passing data back and forth may not be viable all the time, especially
 with a GET given the known character limitation.  However, do users
 commonly bookmark a search result with a page number?  I could
 definitely see it.  Perhaps the bookmark would encapsulate the AFTER
 clause in the URL.

 Thanks again, Rob.  It is an interesting problem.
 Dustin


 Rob Heittman wrote:
  Ah, pagination.  One of the great programming tradeoffs  :-)  Have a
  look at this comment thread from Ohloh a while back.
 
  http://www.ohloh.net/forums/3491/topics/1056
 
  Josh Triplett proposes a good solution that is lightweight for
 paging
  non-critical data without server state.
 
  You can guarantee a stable search result for the duration of the
  browse by caching the entire result set server side and providing a
  means of moving through it ... that might scale to hundreds of
  results, but not so much to millions.  Still, that's the usual
 Session
  idiom.
 
  Here's what I usually do ... send an HTML or XML representation with
  sufficient information about how to repeat the search and page thru
  it, but keep no server side state per se.  I just make sure the data
  layer is smart enough about caching result sets to avoid
 unnecessary work.
 
  Example: say I am exposing a fulltext search over a collection of
  10,000 documents and someone searches on the.
 
  Client hits Resource (stateless, short lived) by POST to /search
 with
  something like
 query
  termthe/term
 /query
  Resource submits the search to a query service.
  Query service hits fulltext index and gets 9,995

Re: Pagination

2009-06-09 Thread Dustin N. Jenkins
 of error, or 
 repeat the search and send back the response with some kind of flag to 
 indicate that the result set has changed.  (I like this last behavior, 
 along with the above really smart about knowing which result sets are 
 identical)

 I like ehcache a lot for all this.  I can trivially implement memory 
 sensitive caches with disk backing to hold server side resources 
 representing result sets and other goodies.  This can be done very 
 close to the Representation level to avoid duplicative work, and the 
 general usage doesn't vary much between different kinds of data layers 
 -- relational queries, Web service queries, Lucene queries, XML 
 document searches, etc.

 Finally, if you're dealing with dumb HTML clients (that work page by 
 page and can't be bothered to keep state like what they queried for in 
 the first place), instead of the XML example above, you can 
 incorporate a form that repeats the search (with the appropriate 
 pagination) directly into your HTML result.  This isn't much of a 
 problem with AJAX or desktop clients that can maintain their own state 
 better.

 Any of that useful?

 - R

 On Fri, Jun 5, 2009 at 2:14 PM, Dustin N. Jenkins 
 dustin.jenk...@nrc-cnrc.gc.ca mailto:dustin.jenk...@nrc-cnrc.gc.ca 
 wrote:

 I'd like to be able to paginate my search results in my Restlet Web
 Application as the user can easily return hundreds of results.  I've
 searched around and came across the Value List Holder Design Pattern,
 but I'm not sure it meets my needs.



-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Attach all URIs

2009-05-25 Thread Dustin N. Jenkins
Hi Rajath,

Is your web application being deployed with Tomcat?  If so, what does 
your web.xml look like?

Which version of Restlet are you using also?

Dustin



Thierry Boileau wrote:
 Hello rajath,

 It should work. I send you a sample code that works.

 Best regards,
 Thierry Boileau
   
 Hi Thierry,
 This is a part of the code:

 public class ServerMainApp extends Application
 {
  public synchronized Restlet createRoot()
  {
  Router router = new Router(getContext());
  router.attachDefault(XXXResource.class);
  return router;
  }
 }

 Regards,
 Rajath


 Thierry Boileau wrote:
   
 
 Hello rajath,

 how do you instantiate the router object?
 How do you attache your application instance to the component?

 best regards,
 Thierry Boileau
 
   
 Hi all,
 Irrespective of the URI, I want all requests to be routed to a
 XXXResource
 class. I tried this, but it does not work:
 router.attachDefault(XXXResource.class);

 Is there another way to do this?

 Thanks,
 Rajath

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


 
   
 

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Spring-loaded Restlets with Context dependencies

2009-05-19 Thread Dustin N. Jenkins
Thanks Jerome,

The WAR client is only added if the component is created by the 
ServerServlet, and not by the SpringServerServlet (i.e. created from a 
Spring Bean).

Cheers,
Dustin


Jerome Louvel wrote:
 Hi Dustin,

 Thanks for reporting your solution and for the support! I'm sure it will help 
 others.  

 Regarding the WAR client, it is normally automatically added by the 
 ServerServlet#createComponent() method, which is invoked at the end of 
 SpringServerServlet#createComponent. No need to declare it anymore.

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


 -Message d'origine-
 De : Dustin N. Jenkins [mailto:dustin.jenk...@nrc-cnrc.gc.ca] 
 Envoyé : vendredi 15 mai 2009 21:15
 À : discuss@restlet.tigris.org
 Objet : Re: Spring-loaded Restlets with Context dependencies

 I solved this for the most part.  I'm using the 
 org.springframework.beans.factory.config.PropertyPathFactoryBean class 
 to provide a Context to my component, which is now defined in Spring:

 !-- Component.  This will be loaded by the Servlet according to the 
 web.xml definition of org.restlet.component --
   bean name=component class=org.restlet.ext.spring.SpringComponent
 property name=defaultTarget ref=application /
 property name=context ref=component.context /
 property name=clientsList
   list
 valuehttp/value
 valuefile/value
   /list
 /property
   /bean

 !-- Context --
   bean name=component.context
 
 class=org.springframework.beans.factory.config.PropertyPathFactoryBean /
   
 I had to override the SpringServerServlet.createComponent() method to 
 add a ServletWARClient to the Spring loaded component since simply 
 declaring 'war' in the clientsList is not sufficient.  The 
 ServletContext is required to build one of those Clients.  I need the 
 WAR protocol to load my FreeMarker Templates from my WAR, as well as my 
 CSS and JavaScript files.

 I hope I did this in the best way possible and didn't miss something 
 simple that prevented me from doing the extra work.  Maybe this will 
 help someone else!

 Thanks to the Restlet team for everything.  I am enjoying myself none 
 the less.
 Dustin





 Dustin N. Jenkins wrote:
   
 All,

 I'm using the 1.2 (2.0) snapshot with JDK 1.6.

 All of my beans are loaded by Spring.  This is working really lovely for 
 the most part, except for any bean that relies on the Context to be 
 passed in.  How do we create ChallengeGuards, for example, in Spring, 
 when we don't have a Context to pass to it?

 I used to override the default Constructor to use a Restlet instead of a 
 Context, which would act as a Parent and I could call getContext() from 
 that bean.  That Parent bean used to be the Application, which is 
 initialized by the SpringServerServlet.  The problem is that Spring is 
 loading in all the beans first, which means the Parent's Context is 
 null, which used to be alright prior to 2.0.

 What is the solution for this problem?  Do I need to create a Spring 
 Component around my Application?  I don't use a Component now, only an 
 Application.

 Thanks!
 Dustin
   
 

   

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Spring-loaded Restlets with Context dependencies

2009-05-15 Thread Dustin N. Jenkins
I solved this for the most part.  I'm using the 
org.springframework.beans.factory.config.PropertyPathFactoryBean class 
to provide a Context to my component, which is now defined in Spring:

!-- Component.  This will be loaded by the Servlet according to the 
web.xml definition of org.restlet.component --
  bean name=component class=org.restlet.ext.spring.SpringComponent
property name=defaultTarget ref=application /
property name=context ref=component.context /
property name=clientsList
  list
valuehttp/value
valuefile/value
  /list
/property
  /bean

!-- Context --
  bean name=component.context

class=org.springframework.beans.factory.config.PropertyPathFactoryBean /

I had to override the SpringServerServlet.createComponent() method to 
add a ServletWARClient to the Spring loaded component since simply 
declaring 'war' in the clientsList is not sufficient.  The 
ServletContext is required to build one of those Clients.  I need the 
WAR protocol to load my FreeMarker Templates from my WAR, as well as my 
CSS and JavaScript files.

I hope I did this in the best way possible and didn't miss something 
simple that prevented me from doing the extra work.  Maybe this will 
help someone else!

Thanks to the Restlet team for everything.  I am enjoying myself none 
the less.
Dustin





Dustin N. Jenkins wrote:
 All,

 I'm using the 1.2 (2.0) snapshot with JDK 1.6.

 All of my beans are loaded by Spring.  This is working really lovely for 
 the most part, except for any bean that relies on the Context to be 
 passed in.  How do we create ChallengeGuards, for example, in Spring, 
 when we don't have a Context to pass to it?

 I used to override the default Constructor to use a Restlet instead of a 
 Context, which would act as a Parent and I could call getContext() from 
 that bean.  That Parent bean used to be the Application, which is 
 initialized by the SpringServerServlet.  The problem is that Spring is 
 loading in all the beans first, which means the Parent's Context is 
 null, which used to be alright prior to 2.0.

 What is the solution for this problem?  Do I need to create a Spring 
 Component around my Application?  I don't use a Component now, only an 
 Application.

 Thanks!
 Dustin
   

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Entity consumption problem

2009-05-05 Thread Dustin N. Jenkins
Hello again!

I've been using the 1.2 Snapshot for a while now without any problems, 
so well done to all of those involved!

I've recently run into a problem where I'm getting the following Exception:
SEVERE: Unhandled exception or error intercepted
java.lang.IllegalStateException: The Web form cannot be parsed as no 
fresh content is available. If this entity has been already read once, 
caching of the entity is required
at org.restlet.engine.util.FormUtils.parse(FormUtils.java:270)
at org.restlet.data.Form.init(Form.java:82)
...

I'm sending a GET Request to Resource #1, then that Resource is making a 
POST Request using the previous Request's Entity Representation to 
Resource #2:

/**
* Resource #1 for GET.
*/
public Representation represent(final Variant variant)
{
...
new Client(getContext(), Protocol.HTTP).post(http://...;, 
getRequest().getEntity());
... 
}

/**
* Resource #2 for POST.
*/
public void acceptRepresentation(final Representation entity)
{
Form form = getRequest().getEntityAsForm();  // Exception happens here.
...
}

Where is the Entity being consumed between during the POST request?  
Should I be consuming the Entity entirely before the POST call, then 
create a new Representation as the Entity with that raw data?

Thank you!
Dustin
-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Entity consumption problem

2009-05-05 Thread Dustin N. Jenkins
My apologies.  The Request Entity is empty, which results in the error 
described, so this is a non issue.

Dustin


Dustin N. Jenkins wrote:
 Hello again!

 I've been using the 1.2 Snapshot for a while now without any problems, 
 so well done to all of those involved!

 I've recently run into a problem where I'm getting the following Exception:
 SEVERE: Unhandled exception or error intercepted
 java.lang.IllegalStateException: The Web form cannot be parsed as no 
 fresh content is available. If this entity has been already read once, 
 caching of the entity is required
 at org.restlet.engine.util.FormUtils.parse(FormUtils.java:270)
 at org.restlet.data.Form.init(Form.java:82)
 ...

 I'm sending a GET Request to Resource #1, then that Resource is making a 
 POST Request using the previous Request's Entity Representation to 
 Resource #2:

 /**
 * Resource #1 for GET.
 */
 public Representation represent(final Variant variant)
 {
 ...
 new Client(getContext(), Protocol.HTTP).post(http://...;, 
 getRequest().getEntity());
 ... 
 }

 /**
 * Resource #2 for POST.
 */
 public void acceptRepresentation(final Representation entity)
 {
 Form form = getRequest().getEntityAsForm();  // Exception happens here.
 ...
 }

 Where is the Entity being consumed between during the POST request?  
 Should I be consuming the Entity entirely before the POST call, then 
 create a new Representation as the Entity with that raw data?

 Thank you!
 Dustin
   

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: FreeMarker Template Loading

2009-04-16 Thread Dustin N. Jenkins
Jerome,

Thanks, this works as expected with one exception.  The 
getLastModified(Object templateSource) returns a NullPointerException 
all the time for me as the getModificationDate() from the Representation 
(templateSource) is always null.  I overrode the class and that method 
and it works as expected.  Should I make a ticket for this too or is 
this e-mail sufficient?

Thanks,
Dustin


Jerome Louvel wrote:
 Hi Dustin,

 Thanks for reporting this issue. 

 I have just added a ContextTemplateLoader class to FreeMarker extension that
 will allow you to achieve the same result as the
 Configuration#setServletContextForTemplateLoading() method.

 It is checked in SVN trunk and will be available in the next snapshot.
 Please test and let me know if it works as expected.

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


 -Message d'origine-
 De : Dustin N. Jenkins [mailto:dustin.jenk...@nrc-cnrc.gc.ca] 
 Envoyé : jeudi 9 avril 2009 23:10
 À : discuss@restlet.tigris.org
 Objet : FreeMarker Template Loading

 Hello all,

 I'm running JDK 1.6 with Restlet 1.2 and the included FreeMarker all being
 served from a Tomcat 6 container.  My FreeMarker templates are in the web
 content root under the directory freemarker-templates.

 I used to cast the context to a ServletContextAdapter before 1.2, and was
 able to tell my FreeMarker Configuration to obtain my Templates from the
 ServletContext, but that's not true anymore.  Is there a way to get the
 ServletContext now?

 I am able to use this:
 getContext().getClientDispatcher().get(war:///freemarker-templates/ +
 templateName).getEntity();

 and wrap it in a TemplateRepresentation, but my #include myHeader.ftl
 files within my templates no longer work as they're relative URLs. 

 So which way is better?  Is there a better third option?

 Thank you!
 Dustin
   

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Guards through Spring

2009-04-15 Thread Dustin N. Jenkins
Great, thanks Rhett!

I just tried overriding it to include the Guards, but I get an exception 
from the SpringBeanFinder's createResource() method, so some more 
tweaking will be needed.  I'll put in a ticket for it.

Cheers,
Dustin


Rhett Sutphin wrote:
 Hi Dustin,

   
 I'm using Restlet 1.2 with the SpringBeanRouter, but I've noticed that
 it only picks up those URLs that are tied to a Resource, and not a
 Guard.  Would it be appropriate to simply override the
 postProcessBeanFactory() method to look for Guards too?  Would this be
 considered a bug/issue or is there another way of attaching Guards
 through Spring?
 

 I'd consider that an issue.  Can you file a bug?  It would be fairly  
 straightforward to extend SpringBeanRouter to handle attaching Guards  
 (and Filters, and any other Restlets) in a similar way to how it  
 handles Resources.

 Note that, since SpringBeanRouter can only handle attaching things to  
 itself, if you have multiple Resources behind your Guard, you'll have  
 to figure out some other way to set up those routes.

 Rhett

 On Apr 15, 2009, at 12:46 PM, Dustin N. Jenkins wrote:

   
 I'm using Restlet 1.2 with the SpringBeanRouter, but I've noticed that
 it only picks up those URLs that are tied to a Resource, and not a
 Guard.  Would it be appropriate to simply override the
 postProcessBeanFactory() method to look for Guards too?  Would this be
 considered a bug/issue or is there another way of attaching Guards
 through Spring?

 Thanks!
 Dustin
 -- 


 Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

 facsimile/télécopieur: (250) 363-0045

 National Research Council Canada | 5071 West Saanich Rd, Victoria BC.
 V9E 2E7

 Conseil national de recherches Canada | 5071, ch. West Saanich,  
 Victoria
 (C.-B) V9E 2E7

 Government of Canada | Gouvernement du Canada

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

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: FreeMarker Template Loading

2009-04-15 Thread Dustin N. Jenkins
Kick arse!  Thanks Jerome.

Dustin



Jerome Louvel wrote:
 Hi Dustin,

 Thanks for reporting this issue. 

 I have just added a ContextTemplateLoader class to FreeMarker extension that
 will allow you to achieve the same result as the
 Configuration#setServletContextForTemplateLoading() method.

 It is checked in SVN trunk and will be available in the next snapshot.
 Please test and let me know if it works as expected.

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


 -Message d'origine-
 De : Dustin N. Jenkins [mailto:dustin.jenk...@nrc-cnrc.gc.ca] 
 Envoyé : jeudi 9 avril 2009 23:10
 À : discuss@restlet.tigris.org
 Objet : FreeMarker Template Loading

 Hello all,

 I'm running JDK 1.6 with Restlet 1.2 and the included FreeMarker all being
 served from a Tomcat 6 container.  My FreeMarker templates are in the web
 content root under the directory freemarker-templates.

 I used to cast the context to a ServletContextAdapter before 1.2, and was
 able to tell my FreeMarker Configuration to obtain my Templates from the
 ServletContext, but that's not true anymore.  Is there a way to get the
 ServletContext now?

 I am able to use this:
 getContext().getClientDispatcher().get(war:///freemarker-templates/ +
 templateName).getEntity();

 and wrap it in a TemplateRepresentation, but my #include myHeader.ftl
 files within my templates no longer work as they're relative URLs. 

 So which way is better?  Is there a better third option?

 Thank you!
 Dustin
   

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


FreeMarker Template Loading

2009-04-09 Thread Dustin N. Jenkins
Hello all,

I'm running JDK 1.6 with Restlet 1.2 and the included FreeMarker all 
being served from a Tomcat 6 container.  My FreeMarker templates are in 
the web content root under the directory freemarker-templates.

I used to cast the context to a ServletContextAdapter before 1.2, and 
was able to tell my FreeMarker Configuration to obtain my Templates from 
the ServletContext, but that's not true anymore.  Is there a way to get 
the ServletContext now?

I am able to use this:
getContext().getClientDispatcher().get(war:///freemarker-templates/ + 
templateName).getEntity();

and wrap it in a TemplateRepresentation, but my #include 
myHeader.ftl files within my templates no longer work as they're 
relative URLs. 

So which way is better?  Is there a better third option?

Thank you!
Dustin
-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Loading Spring Beans

2009-04-03 Thread Dustin N. Jenkins
Thanks very much Jerome!

We do have other Servlet applications that are outside my control 
unfortunately.

Dustin

Jerome Louvel wrote:
 Hi Dustin,

 After looking at the code, there has been changes related to context in 1.2,
 to better isolate Components from Applications that affect you.

 I suggest that you enter an issue report in our tracker so we can have a
 closer look at this an see how we could support that again.

 Alternatively, you could initialize Spring from within Restlet itself to
 bypass this issue, unless you have other pure Servlet applications.
  
 Best regards,
 Jerome Louvel
 --
 Restlet ~ Founder and Lead developer ~ http://www.restlet.org
 Noelios Technologies ~ Co-founder ~ http://www.noelios.com
  

 -Message d'origine-
 De : Dustin N. Jenkins [mailto:dustin.jenk...@nrc-cnrc.gc.ca] 
 Envoyé : mercredi 1 avril 2009 21:45
 À : discuss@restlet.tigris.org
 Objet : Loading Spring Beans

 Hello!

 I'm using JDK 1.6 with Tomcat 6.0 on Fedora Core 8.

 I'm upgrading to Restlet 1.2, and I used to create a BeanUtil class that
 would load my Spring 1.2.9 beans by casting getContext() to a
 ServletContextAdapter, then obtaining the ServletContext from there to use
 the WebApplicationContextUtils class in Spring to obtain a bean by name.
 I'm only loading my Services and DAOs from Spring.

 In Restlet 1.2, I can no longer cast it.  Is there an easier way to obtain
 the ServletContext, or, better yet, to load beans using the Spring
 extension?

 Thanks!
 Dustin
   

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: Loading Spring Beans

2009-04-03 Thread Dustin N. Jenkins
That's a good point.  I'd need to do some refactoring, but that could 
work.  Might be cleaner in the end too.

Thanks!
Dustin


Rhett Sutphin wrote:
 Hi Dustin,

 Another option you could consider (if you haven't already) is using  
 RestletFrameworkServlet and SpringBeanRouter to configure your  
 application.  This allows you to use IoC to configure your Resource  
 instances, obviating the need to access the ApplicationContext  
 directly most of the time.  (If you do still need to access the  
 ApplicationContext directly, you can always have the Resource that  
 needs it implement ApplicationContextAware.)

 Rhett

 On Apr 3, 2009, at 9:35 AM, Dustin N. Jenkins wrote:

   
 Thanks very much Jerome!

 We do have other Servlet applications that are outside my control
 unfortunately.

 Dustin

 Jerome Louvel wrote:
 
 Hi Dustin,

 After looking at the code, there has been changes related to  
 context in 1.2,
 to better isolate Components from Applications that affect you.

 I suggest that you enter an issue report in our tracker so we can  
 have a
 closer look at this an see how we could support that again.

 Alternatively, you could initialize Spring from within Restlet  
 itself to
 bypass this issue, unless you have other pure Servlet applications.

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


 -Message d'origine-
 De : Dustin N. Jenkins [mailto:dustin.jenk...@nrc-cnrc.gc.ca]
 Envoyé : mercredi 1 avril 2009 21:45
 À : discuss@restlet.tigris.org
 Objet : Loading Spring Beans

 Hello!

 I'm using JDK 1.6 with Tomcat 6.0 on Fedora Core 8.

 I'm upgrading to Restlet 1.2, and I used to create a BeanUtil class  
 that
 would load my Spring 1.2.9 beans by casting getContext() to a
 ServletContextAdapter, then obtaining the ServletContext from there  
 to use
 the WebApplicationContextUtils class in Spring to obtain a bean by  
 name.
 I'm only loading my Services and DAOs from Spring.

 In Restlet 1.2, I can no longer cast it.  Is there an easier way to  
 obtain
 the ServletContext, or, better yet, to load beans using the Spring
 extension?

 Thanks!
 Dustin

   
 -- 


 Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

 facsimile/télécopieur: (250) 363-0045

 National Research Council Canada | 5071 West Saanich Rd, Victoria BC.
 V9E 2E7

 Conseil national de recherches Canada | 5071, ch. West Saanich,  
 Victoria
 (C.-B) V9E 2E7

 Government of Canada | Gouvernement du Canada

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

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Loading Spring Beans

2009-04-01 Thread Dustin N. Jenkins
Hello!

I'm using JDK 1.6 with Tomcat 6.0 on Fedora Core 8.

I'm upgrading to Restlet 1.2, and I used to create a BeanUtil class that 
would load my Spring 1.2.9 beans by casting getContext() to a 
ServletContextAdapter, then obtaining the ServletContext from there to 
use the WebApplicationContextUtils class in Spring to obtain a bean by 
name.  I'm only loading my Services and DAOs from Spring.

In Restlet 1.2, I can no longer cast it.  Is there an easier way to 
obtain the ServletContext, or, better yet, to load beans using the 
Spring extension?

Thanks!
Dustin
-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Using credentials from the Container

2009-03-24 Thread Dustin N. Jenkins
Hi everyone,

Can someone tell me, with the new Security API, will it be possible to 
use the credentials from the Container?  I use the BASIC authentication 
with Tomcat now, but I'm wondering if it's possible to have the Restlet 
Request's ChallengeResponse be populated automagically from the 
Container's principal information.

Thanks!
Dustin
-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Re: JSP/Servlet Representation

2009-02-25 Thread Dustin N. Jenkins
Agreed on the 'not easy' part...

I could treat the JSP like a FreeMarker template and just replace 
mark-ups, but then it's not really a JSP anymore, especially for 
maintainers of the code after me.

Thanks for the reply Thierry,
Dustin N. Jenkins


Thierry Boileau wrote:
 Hello Dustin, John

 I'm not aware of such tutorial.
 As jsp are tied with servlet spec, the task is not easy and has not be 
 done yet, as far as I know.

 best regards,
 Thierry Boileau

   
 Is there a good tutorial on using JSPs with Restlet?

 
   
 I've been planning on asking about this as well.  Is this use case 
 supported?  It would really simplify my code

 
 John Wismar
 john.wis...@autozone.com

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


 

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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


Force Media Type

2008-10-28 Thread Dustin N. Jenkins

Hi there,

I thought once upon a time you could force the media-type by specifying 
?media-type=XXX in the URL.  Is this still true?


Thanks,
Dustin

--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada



Re: Force Media Type

2008-10-28 Thread Dustin N. Jenkins

Perfect, thank you!

Dustin

Jerome Louvel wrote:

Hi Dustin,

Try just ?media=gif instead. See the TunnelService Javadocs for details.

Best regards,
Jérôme Louvel
--
Noelios Technologies
http://www.noelios.com
tel / fax : +33 1 47 57 30 53
mob : +33 6 85 14 21 12
 


-Message d'origine-
De : Dustin N. Jenkins [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 28 octobre 2008 17:52

À : Restlet Users Group
Objet : Force Media Type

Hi there,

I thought once upon a time you could force the media-type by specifying 
?media-type=XXX in the URL.  Is this still true?


Thanks,
Dustin

  


--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada



Re: ChallengeResponse with multiple url-patterns

2008-04-21 Thread Dustin N. Jenkins

Hi Jerome,

Thanks for the response, I think that clears it up!

Cheers,
Dustin


Jerome Louvel wrote:

Hi Dustin,

Restlet has its own separate mechanism to authenticate HTTP requests. When
you deploy your Restlet application inside a Servlet container, we recommend
to use Restlet mechanisms instead (Guard, etc.).

Otherwise, the required HTTP headers are probably consumed by the Servlet
container before the request reaches the Restlet adapter.

I hope it helps explaining the observed behavior.

Best regards,
Jerome  

  

-Message d'origine-
De : Dustin N. Jenkins [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 3 avril 2008 19:58

À : Restlet Users Group
Objet : ChallengeResponse with multiple url-patterns

I'm using JDK 1.5 with Resltet 1.0.9 in a Linux environment running 
Tomcat 5.5.


I have multiple url-patterns in my security constraint as 
shown in this 
bit from my web.xml:


  security-constraint
web-resource-collection
  web-resource-nameSecurityConstraint/web-resource-name
  url-pattern/firstpattern/*/url-pattern
  url-pattern/secondpattern/*/url-pattern
/web-resource-collection
auth-constraint
  role-namepublic/role-name
/auth-constraint
  /security-constraint

This works fine for the first pattern that is found, and I can call 
getRequest().getChallengeResponse().getIdentifier() to obtain the 
currently authenticated username. So if I call 
http://myhost/mywebapp/firstpattern/do I get challenged and 
it's fine.  
If do not close my browser and try to use the challenge response by 
calling http://myhost/mywebapp/secondpattern/do I am not 
challenged, as 
expected as I think it's cached somewhere, and then the 
getRequest().getChallengeResponse() returns a null.  Is this 
according 
to spec?  A bug?  Or is it tied to the URL pattern somewhere 
only once 
per webapp?


Thanks!
Dustin
--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | 
[EMAIL PROTECTED]


facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West 
Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada




  


--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada



ChallengeResponse with multiple url-patterns

2008-04-03 Thread Dustin N. Jenkins
I'm using JDK 1.5 with Resltet 1.0.9 in a Linux environment running 
Tomcat 5.5.


I have multiple url-patterns in my security constraint as shown in this 
bit from my web.xml:


 security-constraint
   web-resource-collection
 web-resource-nameSecurityConstraint/web-resource-name
 url-pattern/firstpattern/*/url-pattern
 url-pattern/secondpattern/*/url-pattern
   /web-resource-collection
   auth-constraint
 role-namepublic/role-name
   /auth-constraint
 /security-constraint

This works fine for the first pattern that is found, and I can call 
getRequest().getChallengeResponse().getIdentifier() to obtain the 
currently authenticated username. So if I call 
http://myhost/mywebapp/firstpattern/do I get challenged and it's fine.  
If do not close my browser and try to use the challenge response by 
calling http://myhost/mywebapp/secondpattern/do I am not challenged, as 
expected as I think it's cached somewhere, and then the 
getRequest().getChallengeResponse() returns a null.  Is this according 
to spec?  A bug?  Or is it tied to the URL pattern somewhere only once 
per webapp?


Thanks!
Dustin
--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada



Request for an Object

2008-03-14 Thread Dustin N. Jenkins

Hi all,

This could be a REST understanding problem in general.  I'm using JDK 
1.5.10 with Restlet 1.0.8.


I have a resource that accepts GET requests for a User.  The HTML 
representation will return a FreeMarker page, and the Text version will 
just return a String representation of the User.  Simple and lovely.


I also want to be able to ask for the User object too, and I think that 
the ObjectRepresentation class is used for that.  How do I specify that 
from the Resource though?  I thought of narrowing down the ClientInfo's 
accepted MediaTypes to just 'x-java-serialized-object' and checking for 
that in the getRepresentation() method of the Resource, but it won't 
accept requests with just that MediaType to choose from.


Any ideas of how to just return the Object?  It seems like just another 
representation, but I don't think I should have to create another 
Resource as it's essentially doing the same thing as the HTML and 
Textual representations are doing.


Thanks,
Dustin



--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada



Re: Request for an Object

2008-03-14 Thread Dustin N. Jenkins
Excellent thank you both for your replies.  I missed the rule that every 
Representation is a Resource to be honest, and that's good to know now.


Here is my code:

Client client = new Client(Protocol.HTTP);
Request request = new Request(Method.GET, 
http://www.mysite.com/users?media=application/x-java-serialized-object;);

request.setChallengeResponse();

Response response = client.handle(request);
Representation representation = response.getEntity();

Why is representation always an InputRepresentation and not the one that 
was asked for?  The correct ObjectRepresentation is now being returned 
from my Resource (thanks!), but the Response in this case never returns 
the right one.  Is this intentional?


Thanks!
Dustin


Thierry Boileau wrote:

Hello,

Just a few words to complete Jonathan's responce.

The next question is how can I request this specific representation?.

Let's say that you define the URI of your User resource like this =
http://my.company.org/users/id.
On the client side, if you have a full control of the HTTP request,
you can set the requested URI with http://my.company.org/users/id
and set the ACCEPT header with the right media-type.
If not, for example with your favorite browser, there is one solution
based on the Tunnel service [1]. If the Tunnel service is running on
server side (e.g. in an Aplication), you can rely on the
mediaTypeParameter.
It just says that if your browser requests for
http://my.company.org/users/id?media=application/x-java-serialized-object
then the Tunnel Filter updates the request on fly by replacing the
media-types preferences sent by the browser with the single preference
application/x-java-serialized-object. Then the Resource will return
the right representation.

This solution has another effect : it complies with the rule saying
that every Representation is a Resource, and thus is identified by its
own URI(s).

best regards,
Thierry Boileau
[1] 
http://www.restlet.org/documentation/1.0/api/org/restlet/service/TunnelService.html


On Fri, Mar 14, 2008 at 10:43 PM, Jonathan Hall [EMAIL PROTECTED] wrote:
  

Hi Justin,

 If I understand you, you want to return html,text and an object for a
 resource?
 Simplest form

 public class MyResource extends Resource {
public MyResource(Context context, Request request, Response response) {
super(context, request, response);
getVariants().add(new Variant(MediaType.APPLICATION_JAVA_OBJECT));
getVariants().add(new Variant(MediaType.TEXT_PLAIN));
getVariants().add(new Variant(MediaType.TEXT_HTML));

}

@Override
public Representation getRepresentation(Variant variant) {
Representation rep = null;
if (MediaType.TEXT_PLAIN.equals(variant.getMediaType())) {
rep = StringRep...
}
else if (MediaType.TEXT_HTML.equals(variant.getMediaType())) {
rep = Freemarker...
}
else if 
(MediaType.APPLICATION_JAVA_OBJECT.equals(variant.getMediaType())) {
rep = ObjectRepresenation( YOUR_SERIALIZED_OBJECT );
}

  return rep;
}
 }

 Your client sending:
 Accept: application/x-java-serialized-object

 works fine on 1.1 snapshot, sorry I dont have a test setup for 1.0.8.


 jon



 Dustin N. Jenkins wrote:
  Hi all,
 
  This could be a REST understanding problem in general.  I'm using JDK
  1.5.10 with Restlet 1.0.8.
 
  I have a resource that accepts GET requests for a User.  The HTML
  representation will return a FreeMarker page, and the Text version
  will just return a String representation of the User.  Simple and lovely.
 
  I also want to be able to ask for the User object too, and I think
  that the ObjectRepresentation class is used for that.  How do I
  specify that from the Resource though?  I thought of narrowing down
  the ClientInfo's accepted MediaTypes to just
  'x-java-serialized-object' and checking for that in the
  getRepresentation() method of the Resource, but it won't accept
  requests with just that MediaType to choose from.
 
  Any ideas of how to just return the Object?  It seems like just
  another representation, but I don't think I should have to create
  another Resource as it's essentially doing the same thing as the HTML
  and Textual representations are doing.
 
  Thanks,
  Dustin
 
 
 





--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada



Re: SELECT values not in Request attributes

2008-03-12 Thread Dustin N. Jenkins

Skookum, thanks Thierry!

What you're saying makes sense too as there is an inconsistency.  
Textual input fields appear fine as request attributes, it seems just 
the SELECT ones that don't.  I'd prefer to just grab everything as 
request attributes as it'd make things simpler, so many thanks!


Will this solution be in 1.1 final?

Thanks again,
Dustin


Thierry Boileau wrote:

Hello Stephan,

actually there is a mechanism (applied when using the Router) which
extract parameters from query, cookies and entity into the request's
list of attributes.
As reported by Justin this mechanism seems buggy and does not extract
select values.
I wanted to say that we are solving the problem and that we let Dustin
free to choose one method or the other.

best regards,
Thierry Boileau

On Tue, Mar 11, 2008 at 9:21 PM, Stephan Koops [EMAIL PROTECTED] wrote:
  

Hello Thierry,

 I think request.getEntityAsForm() is THE solution. Why only use it as
 workaround? What are I missing?

 best regards
   Stephan

 Thierry Boileau schrieb:




Hello Dustin,
  

 
  your web form is in fact the entity of the POST request sent to the
  server, thus you have access to it via request.getEntity().
  There is a shortcut which allows to have a list of all input fields :
 
  Form form = request.getEntityAsForm();
  for (Parameter parameter : form) {
 System.out.print(parameter  + parameter.getName());
 System.out.println(/ + parameter.getValue());
  }
 
  You can use it as workaround (or simply as a solution) before we fix
  the problem you point to.
 
  best regards,
  Thierry Boileau




--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada



SELECT values not in Request attributes

2008-03-11 Thread Dustin N. Jenkins

I'm using Restlet 1.0.8, JDK 1.5.0_10 running on Tomcat 5.5.

Seems like this has been covered before but I couldn't find anything, my 
apologies if it's been raked over many times.


If I post form data that includes a pull down menu (HTML SELECT), it 
doesn't show up in the request's attributes, is this intentional?  How 
do I extract the values out?  All the INPUT fields come across just fine...


Thanks,
Dustin
--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada



Re: SELECT values not in Request attributes

2008-03-11 Thread Dustin N. Jenkins

Oh good, thanks very much!

Dustin


Thierry Boileau wrote:

Hello Dustin,


your web form is in fact the entity of the POST request sent to the
server, thus you have access to it via request.getEntity().
There is a shortcut which allows to have a list of all input fields :

Form form = request.getEntityAsForm();
for (Parameter parameter : form) {
   System.out.print(parameter  + parameter.getName());
   System.out.println(/ + parameter.getValue());
}

You can use it as workaround (or simply as a solution) before we fix
the problem you point to.

best regards,
Thierry Boileau


On Tue, Mar 11, 2008 at 6:41 PM, Dustin N. Jenkins
[EMAIL PROTECTED] wrote:
  

I'm using Restlet 1.0.8, JDK 1.5.0_10 running on Tomcat 5.5.

 Seems like this has been covered before but I couldn't find anything, my
 apologies if it's been raked over many times.

 If I post form data that includes a pull down menu (HTML SELECT), it
 doesn't show up in the request's attributes, is this intentional?  How
 do I extract the values out?  All the INPUT fields come across just fine...

 Thanks,
 Dustin
 --


 Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

 facsimile/télécopieur: (250) 363-0045

 National Research Council Canada | 5071 West Saanich Rd, Victoria BC.
 V9E 2E7

 Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria
 (C.-B) V9E 2E7

 Government of Canada | Gouvernement du Canada





--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada



Re: Returning from a POST

2007-12-07 Thread Dustin N. Jenkins
The POST is creating a new resource in the persistence layer, then 
returning, as text, the URL to that new resource.  It just strikes me 
that returning the textual representation of the URL is a GET operation 
and should be treated as such, no?  Redirecting and writing to the 
Response both address my needs, but I don't want to issue a redirect per 
se.  Thinking it through now, I'd say continuing to write to the 
response is the most appropriate way.


Thank you,
- Dustin

Rob Heittman wrote:
I think, before I made any sound observations, I'd want to know more 
about your use case and what functional effects are exposed by this 
particular POST.


In general, there's nothing illicit about POST returning either a 
meaningful representation, or a redirect.  Either of these are the two 
most common choices.  I don't think the concept of forwarding maps 
especially well on to the REST style, since it is all about internally 
returning the representation of a resource other than the one 
addressed by the client.  You can achieve it in Restlet by executing a 
client operation inside your POSTable resource (and in Restlet 1.1 you 
can use the addressable server router on the Component to do this 
efficiently), but it looks exactly like the sleight of hand it is.


- Rob



--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada


Returning from a POST

2007-12-07 Thread Dustin N. Jenkins
My apologies if this has been discussed too many times already.  I'm 
using JDK 1.5.x with Restlet 1.0.6.


I think I've come to the conclusion that to return something from a 
POST, the best way is to forward to a GET on another resource, sound 
right?  I could write to the Response directly, but it's not as sexy as 
I'd hoped, plus can create undesired behaviour at the user level.


My first question is whether this is the best way to return something 
from a POST request, and my second question is that I've never been able 
to find a way to forward a URL in Restlet, and redirects leave browser 
codes in the web server logs, so how do I forward to a GET URL?


Thank you!
Dustin

--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada


Re: Multiples rest service using multiples servlet in tomcat.

2007-07-05 Thread Dustin N. Jenkins

Balas Julien wrote:

I'm using 1.0.2
The very strange thing is that I have a previous version of my app and the 2 
servlets are working perfectly.
(I can prove it with a war) :) 


But I can't find the differences.
The web.xml is the same
The .class files are the same.

I tried the war on another tomcat (on a Linux box) as well, just to be sure 
it's not a problem on my machine.
I get the same 404 error.

Btw, who is sending this error?
The restlet framework ? 
Is there a way to get more information during the execution of the framework ?


  


The Restlet framework is throwing this error because, as it implies, it 
cannot match the URI to anything that it has mapped.
When I decompressed your WAR file, there is no web.xml in the main 
WEB-INF directory, but rather in the EventViewer/WEB-INF, which I don't 
think Tomcat will find. 
Hopefully Jerome will correct me, but can you setup an Application per 
ServerServlet like this:


web-app
 display-nameJDAS Event Resolver/display-name

 servlet
   servlet-nameServerServletUN/servlet-name
   
servlet-classcom.noelios.restlet.ext.servlet.ServerServlet/servlet-class

   init-param
 param-nameorg.restlet.application/param-name
 param-valuecom.deere.ujh813.eventViewer.rest.Hello1/param-value
   /init-param
 /servlet

 servlet
   servlet-nameServerServletDEUX/servlet-name
   
servlet-classcom.noelios.restlet.ext.servlet.ServerServlet/servlet-class

   init-param
 param-nameorg.restlet.application/param-name
 param-valuecom.deere.ujh813.eventViewer.rest.Hello2/param-value
   /init-param
 /servlet

 servlet-mapping
   servlet-nameServerServletUN/servlet-name
   url-pattern/rest1/*/url-pattern
 /servlet-mapping

 servlet-mapping
   servlet-nameServerServletDEUX/servlet-name
   url-pattern/rest2/*/url-pattern
 /servlet-mapping

/web-app


Thanks,
Dustin


Re: Best way to serve CSS and Javascript from a WAR?

2007-06-18 Thread Dustin N. Jenkins

Jerome,

   Excellent!  Fantastic!  I will try it, thank you so much.

Dustin


Jerome Louvel wrote:

Hi Dustin,

The WAR client is automatically installed when you use the ServerServlet
adapter. In Restlet 1.1, this will work with the standalone mode too, so
Application portability will be intact.

So, you can already simplify your code like this:

public Representation getRepresentation(final Variant variant)
{
return getContext().getDispatcher()
.get(war:///css/{cssfile}).getEntity();
}

Note that going through the context's dispatcher lets you transparently
reuse request's attributes via URI templates :)

Let me know if this works for you.

Best regards,
Jerome  

  

-Message d'origine-
De : Dustin N. Jenkins [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 12 juin 2007 16:19

À : Discussion about Restlet
Objet : Best way to serve CSS and Javascript from a WAR?

I'm deploying my Restlet application into a WAR in Tomcat, and 
everything seems to be working just fine.  Normally, it'd be nicer to 
simply let Tomcat handle the CSS and Javascript files, but I 
want to map 
everything (/*) to the ServerServlet so I can keep the 
initial part of 
the resource ref (i.e. if I were to map /abc/* and /xyz/* I 
wouldn't be 
able to match those because it becomes the base ref and gets stripped 
off). 

Here's what I'm doing now for the CSSResource that the 
/css/{cssfile} is 
routed to:

public Representation getRepresentation(final Variant variant)
{
final ServletWarClient warClient =
new ServletWarClient(getContext(),
 ((ServletContextAdapter) 
getContext()).getServletContext());


return warClient.get(war:///css/
 + 
getRequestAttribute(cssfile)).getEntity();

}

Which isn't elegant at all as it's tuned specifically to 
being deployed 
as a WAR, and can no longer be run as a standalone, not to 
mention all 
the implementation specific stuff...
Is there a better way?  I know normal static stuff is served via the 
Directory resource, but it doesn't apply here because everything is 
inside the WAR. 


Any suggestions?
Thank you for the fantastic framework!

Dustin



--


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [EMAIL PROTECTED]

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7


Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7


Government of Canada | Gouvernement du Canada


Best way to serve CSS and Javascript from a WAR?

2007-06-12 Thread Dustin N. Jenkins
I'm deploying my Restlet application into a WAR in Tomcat, and 
everything seems to be working just fine.  Normally, it'd be nicer to 
simply let Tomcat handle the CSS and Javascript files, but I want to map 
everything (/*) to the ServerServlet so I can keep the initial part of 
the resource ref (i.e. if I were to map /abc/* and /xyz/* I wouldn't be 
able to match those because it becomes the base ref and gets stripped 
off). 

Here's what I'm doing now for the CSSResource that the /css/{cssfile} is 
routed to:

   public Representation getRepresentation(final Variant variant)
   {
   final ServletWarClient warClient =
   new ServletWarClient(getContext(),
((ServletContextAdapter) 
getContext()).getServletContext());


   return warClient.get(war:///css/
+ getRequestAttribute(cssfile)).getEntity();
   }

Which isn't elegant at all as it's tuned specifically to being deployed 
as a WAR, and can no longer be run as a standalone, not to mention all 
the implementation specific stuff...
Is there a better way?  I know normal static stuff is served via the 
Directory resource, but it doesn't apply here because everything is 
inside the WAR. 


Any suggestions?
Thank you for the fantastic framework!

Dustin