RE: Re: How to get HttpServletResponse object in restlet

2010-01-13 Thread Sam Bloomquist
Ok, I have a related question.  I've found out how to get to the 
HttpServletResponse object and have passed that to the Blobstore API, where it 
was successfully written to and committed.  Is there an example of how to turn 
that HttpServletResponse object into a Representation that can be returned to 
the Restlet framework?  I'm guessing I want to use the OutputRepresentation, 
but I'm not super clear on how that should work.

Thanks,
Sam

 Hello Sam,
 
 At this moment, nothing is available in the framework to get access to 
 the servlet's response which could help you to support the Blobstore API.
 You can have a look at the code of the ServerServlet and Servlet Call 
 classes of the Servlet extension.
 There is also an issue in order to support this feature: 
 http://restlet.tigris.org/issues/show_bug.cgi?id=998.
 
 Best regards,
 Thierry Boileau
 
  I'm using Restlet with GAE, and the GAE Blobstore API requires a 
  HttpServletRequest object for uploading blobs and a HttpServletResponse 
  object for serving them.  I found the static 
  ServletCall#getRequest(Request) method to get the HttpServletRequest object 
  from a restlet Request object, but is there a similar way to get the 
  HttpServletResponse object from the restlet Response?
 
  Thanks,
  Sam
 
  --
  http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2435938
 
 

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


RE: Re: How to get HttpServletResponse object in restlet

2010-01-11 Thread Sam Bloomquist
Thanks for the response, Thierry.  I'll take a look at those classes and see 
what I can come up with.  Maybe I'll be able to pitch in on that issue if I get 
something worked out in the next week or two.

Thanks,
Sam

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


RE: Re: Custom StatusService#getRepresentation() not invoked with GAE M6 build

2010-01-11 Thread Sam Bloomquist
Yep, putting it in my Application class' constructor fixed it for me.  Thanks.

 Hello Sam,
 
 Can you set the statusService at instantiation time?
 
 Best regards,
 Thierry Boileau
 
  Please ignore the weird comments and code in the getRepresentation method 
  body. My brain was going a couple different directions at the time I posted 
  originally, and I realize it doesn't make much sense now. My issue is just 
  that the method is never called.
 
  Thanks,
  Sam
 
  --
  http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2435928
 
 

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


How to get HttpServletResponse object in restlet

2010-01-10 Thread Sam Bloomquist
I'm using Restlet with GAE, and the GAE Blobstore API requires a 
HttpServletRequest object for uploading blobs and a HttpServletResponse object 
for serving them.  I found the static ServletCall#getRequest(Request) method to 
get the HttpServletRequest object from a restlet Request object, but is there a 
similar way to get the HttpServletResponse object from the restlet Response?

Thanks,
Sam

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


RE: Custom StatusService#getRepresentation() not invoked with GAE M6 build

2010-01-10 Thread Sam Bloomquist
Please ignore the weird comments and code in the getRepresentation method body. 
My brain was going a couple different directions at the time I posted 
originally, and I realize it doesn't make much sense now. My issue is just that 
the method is never called.

Thanks,
Sam

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


Custom StatusService#getRepresentation() not invoked with GAE M6 build

2010-01-09 Thread Sam Bloomquist
I have a custom StatusService class, and the overridden 
getRepresentation(Status, Request, Response) method is never getting invoked 
when exceptions are thrown.  I tried overriding 
getStatus(Throwable,Request,Response) temporarily as a test, and it is called 
and receives a valid Throwable.  I'm using the GAE M6 build.

Here is my sample code:

in my Application class:

@Override
public synchronized Restlet createInboundRoot() {
this.setStatusService(new MyStatusService());
// ...
}


My custom StatusService:

public class MyStatusService extends StatusService {
public MyStatusService() {
super(true);
}

@Override
public Representation getRepresentation(Status status, Request request,
Response response)
{
// If an error occurred, try to return the error page. 
Otherwise, return
//  null so that Restlet to delegate the response 
handling to Restlet's default.
if (status.isError()) {
// handle the error
}

return null;
}
}

Any ideas what I may be missing here?

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


ChallengeAuthenticator not working in GAE M6

2009-12-23 Thread Sam Bloomquist
I can't seem to get ChallengeAuthenticators to work in Restlet GAE m6 when I 
have both public and protected resources.

I've created a custom class, MyAuthenticator, that extends 
ChallengAuthenticator.  Right now it simply overrides the authenticate(request, 
response) method and returns true.

Below is my createInboundRoot method.  Anyone spot an obvious mistake:

--
@Override
public synchronized Restlet createInboundRoot() {
Router router = new Router(getContext());

//public resources
router.attach(/page/{pageName}, FreemarkerPageResource.class);

// create a secure router and associate it with my custom 
authenticator
Router secureRouter = new Router(getContext());
secureRouter.attach(/hello, HelloWorldResource.class);

MyAuthenticator authenticator = new 
MyAuthenticator(getContext(),
ChallengeScheme.CUSTOM, System Authentication 
- Provide your credentials);
authenticator.setNext(secureRouter);
router.attach(/admin, authenticator);

return router;
}
--

When I hit the http://localhost:8080/admin url, the 
MyAuthenticator.authenticate(request, response) method does get called.  But if 
I try to hit http://localhost:8080/admin/hello I get a 404.

Thanks,
Sam

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


Re: Problem: GAE - Attaching sub applications does not work

2009-11-25 Thread Sam
Oh I see ..
Thanks for the quick reply


On Tue, Nov 24, 2009 at 9:49 AM, Thierry Boileau 
thierry.boil...@noelios.com wrote:

 Hello Sam,

 I think this issue is due to the routing and the matching strategy.
 Before the 2.0m6 release, a router detected the best route according to
 the start_with mode. At this time, this default strategy has been
 replaced by the equals mode, which is clearly not appropriate with
 your hierarchical structure.
 That is to say: /sub/a/b is not equals to the first defined segment
 /sub, it simply starts with.
 Therefore, I suggest that you updated the default routing strategy of
 the RootApplication's router:
 router.setDefaultMatchingMode(Template.MODE_STARTS_WITH);

 Best regards,
 Thierry Boileau



  I am trying to create an application on GAE using the Restlet-GAE M6 ..
 
  I ran into a problem when trying to attach an sub Application to the root
 Application ..
 
  here is what I am trying to do:
  public class RootApplication extends Application {
 
  @Override
  public Restlet createInboundRoot() {
  Router router = new Router(getContext());
 
  router.attach(/a/, new SubApplication());
  return router;
  }
  }
 
  public class SubApplication extends Application {
 
  @Override
  public Restlet createInboundRoot() {
  Router router = new Router(getContext());
 
  router.attach(b/, HelloWorldHelloWorldResource.class);
  return router;
  }
  }
 
  public class HelloWorldResource extends ServerResource {
 
  @Get
  public String represenxst() {
  return hello, world (from the cloud!);
  }
 
  }
 
 
  I have tested this on the SE edition and it worked fine when I go to
 /a/b/ url it works as expected .. but on GAE it does not work
 
  any suggestions on why this is happening?
 
  Thanks in advance
 
  --
 
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2423740
 
 

 --

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


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

Problem: GAE - Attaching sub applications does not work

2009-11-24 Thread Sam
I am trying to create an application on GAE using the Restlet-GAE M6 ..

I ran into a problem when trying to attach an sub Application to the root 
Application ..

here is what I am trying to do:
public class RootApplication extends Application {

@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());

router.attach(/a/, new SubApplication());
return router;
}
}

public class SubApplication extends Application {

@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());

router.attach(b/, HelloWorldHelloWorldResource.class);
return router;
}
}

public class HelloWorldResource extends ServerResource {

@Get
public String represenxst() {
return hello, world (from the cloud!);
}

}


I have tested this on the SE edition and it worked fine when I go to /a/b/ url 
it works as expected .. but on GAE it does not work

any suggestions on why this is happening?

Thanks in advance

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


RE: Re: how to Router.attach() a resource object

2009-09-23 Thread sam l
ah, thank you very much.
indeed, template names are directly inferred from the request path. 
So, I just modified DirectToTemplateResource.

Thank you again for prompt response.
It could have taken me a long time.

Thanks.
sam

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


unsubscribe from mailing list

2008-07-25 Thread Bao,Sam
I would like to unsubscribe from the mailing list.  How can I do that?

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.

RE: Re: Calling a resource from another resource

2008-05-21 Thread Bao,Sam
No, the response entity, when it's deployed is null as I don't think the 
appropriate resource is not being used at all.  When I run in eclipse locally, 
the response entity is valid with the correct reply content. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 20, 2008 1:52 PM
To: discuss@restlet.tigris.org
Subject: Re: Calling a resource from another resource

do you checked the response entity, if it is correct in both cases?

Bao,Sam schrieb:
 Well, localhost, is what I'm running when I'm running tomcat locally.  And I 
 can take what it logs out, throw it into my firefox, and it'll hit the 
 appropriate conditions resource.

 When it's deployed on Websphere, it's actually something like 
 http://ipvmhewas13/hhmsvc-healthriskengine
   
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 20, 2008 1:44 PM
 To: discuss@restlet.tigris.org
 Subject: Re: Calling a resource from another resource

 Could it be, that you request another server, because localhost means another 
 interface on your Websphere / tomcat machine?

 Bao,Sam schrieb:
   
 Yes, I checked the rootURL and it is exactly as I would enter in to firefox.

 For example rootURL = http://localhost:8080/resources And the I 
 append /conditions onto it in firefox, and it returns me a list of 
 conditions.

 Has anyone had any experience with using Client to call another resource 
 inside the same application?

   
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 20, 2008 12:33 PM
 To: discuss@restlet.tigris.org
 Subject: Re: Calling a resource from another resource

 Hi Sam,

 I don't know. Do you checked the rootURL you request? Perhaps they differs. 
 Just log them. Perhaps this causes trouble. If I remeber right, a Router 
 routes to one of it's goals, but not require, that it consume the full 
 remaining path.

 best regards
Stephan

 Bao,Sam schrieb:
   
 
 Stephen,

 Do you know why this would return a 200, but yet it doesn't actually make 
 the http call?

 Request request = getRequest();
 Reference rootRef = request.getRootRef();
 String rootURL = rootRef.getHostIdentifier();
 String rootPath = rootRef.getPath();
 //produces http://hostname:port/path
 if (rootPath != null  rootPath.trim().length()  0) {
 rootURL = rootURL + rootPath;
 }
 Client c = new Client(Protocol.HTTP);
 //test conditions resource
 if (TRACER.isEnabled()) {
 TRACER.trace(Test Conditions Resource);
 }
 c.start();
 Response r = c.get(rootURL + /conditions);  ---Calling 
 another resource as if simulating a call from a client (ie firefox, ie, 
 safari).
 c.stop();
 Status status = r.getStatus();
 if (TRACER.isEnabled()) {
 TRACER.trace(Status:  + status + . Description:  + 
 status.getDescription());
 }
 if (!Status.SUCCESS_OK.equals(status)) {
 throw new Exception(Conditions GET failed. Status:  + 
 status + . Description:  + status.getDescription());
 }

 This code is inside a resource's GET, which then calls another resource in 
 the same application.  When I run this piece locally in eclipse, alls fine, 
 and the call to '/conditions' resource runs.  However, when I deployed this 
 piece of code to Tomcat or Websphere, I get back a status of 200 (and no 
 exception is thrown), but it doesn't appear that the '/conditions' resource 
 actually gets called.  Anyone have a clue as to why?
 
   

 --
 CONFIDENTIALITY NOTICE This message and any included attachments are from 
 Cerner Corporation and are intended only for the addressee. The information 
 contained in this message is confidential and may constitute inside or 
 non-public information under international, federal, or state securities 
 laws. Unauthorized forwarding, printing, copying, distribution, or use of 
 such information is strictly prohibited and may be unlawful. If you are not 
 the addressee, please promptly delete this message and notify the sender of 
 the delivery error by e-mail or you may call Cerner's corporate offices in 
 Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
   


RE: Re: Calling a resource from another resource

2008-05-20 Thread Bao,Sam
Stephen,

Do you know why this would return a 200, but yet it doesn't actually make the 
http call?

Request request = getRequest();
Reference rootRef = request.getRootRef();
String rootURL = rootRef.getHostIdentifier();
String rootPath = rootRef.getPath();
//produces http://hostname:port/path
if (rootPath != null  rootPath.trim().length()  0) {
rootURL = rootURL + rootPath;
}
Client c = new Client(Protocol.HTTP);
//test conditions resource
if (TRACER.isEnabled()) {
TRACER.trace(Test Conditions Resource);
}
c.start();
Response r = c.get(rootURL + /conditions);  ---Calling 
another resource as if simulating a call from a client (ie firefox, ie, safari).
c.stop();
Status status = r.getStatus();
if (TRACER.isEnabled()) {
TRACER.trace(Status:  + status + . Description:  + 
status.getDescription());
}
if (!Status.SUCCESS_OK.equals(status)) {
throw new Exception(Conditions GET failed. Status:  + status 
+ . Description:  + status.getDescription());
} 

This code is inside a resource's GET, which then calls another resource in the 
same application.  When I run this piece locally in eclipse, alls fine, and the 
call to '/conditions' resource runs.  However, when I deployed this piece of 
code to Tomcat or Websphere, I get back a status of 200 (and no exception is 
thrown), but it doesn't appear that the '/conditions' resource actually gets 
called.  Anyone have a clue as to why?

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 14, 2008 3:00 PM
To: discuss@restlet.tigris.org
Subject: Re: Calling a resource from another resource

Hi Sam,

You could directly call the handle method of the Application, Router or 
whatever. You must ensure, that you set the right base ref of the Reference.
Otherwise you could create a Client and send a request to the own server.

best regards
   Stephan

Bao,Sam schrieb:

 Is it possible to call a resource from within another resource?  The 
 reasoning behind this is I want to create a Check Setup Resource, 
 where a user can go to this resource, and it will run a test GET, 
 POST, PUT, and DELETE on the other resources to make sure that 
 everything is set up, configured, deployed, and running correctly.


--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


RE: Re: Calling a resource from another resource

2008-05-20 Thread Bao,Sam
Well, localhost, is what I'm running when I'm running tomcat locally.  And I 
can take what it logs out, throw it into my firefox, and it'll hit the 
appropriate conditions resource.

When it's deployed on Websphere, it's actually something like 
http://ipvmhewas13/hhmsvc-healthriskengine 


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 20, 2008 1:44 PM
To: discuss@restlet.tigris.org
Subject: Re: Calling a resource from another resource

Could it be, that you request another server, because localhost means another 
interface on your Websphere / tomcat machine?

Bao,Sam schrieb:
 Yes, I checked the rootURL and it is exactly as I would enter in to firefox.

 For example rootURL = http://localhost:8080/resources And the I append 
 /conditions onto it in firefox, and it returns me a list of conditions.

 Has anyone had any experience with using Client to call another resource 
 inside the same application?

   
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 20, 2008 12:33 PM
 To: discuss@restlet.tigris.org
 Subject: Re: Calling a resource from another resource

 Hi Sam,

 I don't know. Do you checked the rootURL you request? Perhaps they differs. 
 Just log them. Perhaps this causes trouble. If I remeber right, a Router 
 routes to one of it's goals, but not require, that it consume the full 
 remaining path.

 best regards
Stephan

 Bao,Sam schrieb:
   
 Stephen,

 Do you know why this would return a 200, but yet it doesn't actually make 
 the http call?

  Request request = getRequest();
 Reference rootRef = request.getRootRef();
 String rootURL = rootRef.getHostIdentifier();
 String rootPath = rootRef.getPath();
  //produces http://hostname:port/path
 if (rootPath != null  rootPath.trim().length()  0) {
 rootURL = rootURL + rootPath;
 }
 Client c = new Client(Protocol.HTTP);
 //test conditions resource
 if (TRACER.isEnabled()) {
 TRACER.trace(Test Conditions Resource);
 }
 c.start();
 Response r = c.get(rootURL + /conditions);  ---Calling 
 another resource as if simulating a call from a client (ie firefox, ie, 
 safari).
 c.stop();
 Status status = r.getStatus();
 if (TRACER.isEnabled()) {
 TRACER.trace(Status:  + status + . Description:  + 
 status.getDescription());
 }
 if (!Status.SUCCESS_OK.equals(status)) {
 throw new Exception(Conditions GET failed. Status:  + 
 status + . Description:  + status.getDescription());
 }

 This code is inside a resource's GET, which then calls another resource in 
 the same application.  When I run this piece locally in eclipse, alls fine, 
 and the call to '/conditions' resource runs.  However, when I deployed this 
 piece of code to Tomcat or Websphere, I get back a status of 200 (and no 
 exception is thrown), but it doesn't appear that the '/conditions' resource 
 actually gets called.  Anyone have a clue as to why?
 

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


RE: RE: Re: 'method' parameter

2008-05-16 Thread Bao,Sam
Ah, I think one of our users created a custom XMLBeansRepresentation that does 
not have the size, and thus was not working using the method below.  I ended up 
checking for the entity size manually to get around this issue.  I may have him 
look at the implementation of the StringRepresentation to see if he can derive 
the size information.  Thanks. 


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: Jerome Louvel [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 16, 2008 3:24 AM
To: discuss@restlet.tigris.org
Subject: RE: Re: 'method' parameter


Hi Sam,

If you use the StringRepresentation for your POSTed entity, then you can be 
sure that the size will known by the server. It is very easy for the 
StringRepresentation to know this information and pass it along, which is not 
true for more dynamic representations where buffering would be necessary.

Best regards,
Jerome


-Message d'origine-
De : Bao,Sam [mailto:[EMAIL PROTECTED] Envoye : jeudi 15 mai 2008 18:49 A : 
discuss@restlet.tigris.org Objet : RE: Re: 'method' parameter

Thierry,

I don't know if you remember this conversation, but we just encountered a 
situation where the the check against the size on a 'post' GET is not always 
guaranteed to be UNKNOWN.

Example: Someone did a 'post' GET and passed along a representation containing 
valid XML.  So when we do a getRequest().getEntity().getText, there is the XML. 
 However, the entity size is unknown, so using the check describe below, we 
process the GET as if it'a 'real' GET, which won't work because all the 
attributes and data are in the entity text, which a 'real'
GET doesn't look at.

I guess my question is if we're doing a POST, and there is text in the entity, 
is the size guaranteed to be not UNKNOWN_SIZE (aka KNOWN)?


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 |
[EMAIL PROTECTED] | www.cerner.com

-Original Message-
From: Thierry Boileau [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 17, 2008 9:44 AM
To: discuss@restlet.tigris.org
Subject: Re: 'method' parameter

Hi Sam,

if you are using Restlet 1.1, you can check the availability of the entity = 
request.isEntityAvailable().
Otherwise, as you said, you can check the size and compare with the constant
: Representation.UNKNOWN_SIZE (which equals to -1).

best regards,
Thierry Boileau
 Yes, I did modify the long variable, and that helps so that we're not 
 so
limited to a unuseable short attribute.  However, I've still got a concern over 
unknown limitations somewhere in our software stack that may cause problem such 
as appServer, proxies, browsers, etc...

 As for the checking against the entity.  I tried that and noticed that 
 I
still get an InputRepresentation even on a 'real' GET, just as I do when it's a 
'post' GET.  However, I see that I can check against the size or the media 
type.  If I check against the size, on a 'real' GET, is it always guaranteed to 
be -1?

   
 Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | 
 [EMAIL PROTECTED] | www.cerner.com
 

 -Original Message-
 From: Thierry Boileau [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 17, 2008 9:05 AM
 To: discuss@restlet.tigris.org
 Subject: Re: 'method' parameter

 Hi Sam,

 did you try to update your URI templates to catch long variables?
 Route route = router.attach(/result/{yourVar}, Restlet instance or 
 Resource class); route.getTemplate().getVariables().put(yourVar,
 new Variable(Variable.TYPE_ALL));

 Otherwise, you can check the entity of the request
(getRequest().getEntity()). A real GET request does not have such entity 
instead of a POST-GET.

 best regards,
 Thierry Boileau

   
 Thierry,

 I don't know if you remember about a week ago I was using a POST-GET 
 hack
to get around the fact that the Pattern that was generated around the really 
long (1400+ characters) attribute string would cause an StackOverflowException. 
 So I ended up parsing the attribute string myself.
However, we determined that we still would keep the post hack due to other 
limitations that other applications we use may impose on the uri length such as 
proxies, app servers, browsers, etc...  So we post with a method parameter 
telling us of what we should be doing.


   
 
 Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | 
 [EMAIL PROTECTED] | www.cerner.com
 
   
 -Original Message-
 From: Thierry Boileau [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 16, 2008 3:25 PM
 To: discuss@restlet.tigris.org
 Subject: Re: 'method' parameter

 Hello Sam,

 I'm not sure it was designed to do so. Could you explain us why you 
 need
to update the request's method?

 best regards,
 Thierry Boileau

   
 
 On a POST, I'm using the method parameter and just happened to set 
 it
'GET', and noticed that the resource will run the getRepresentation() method 
rather than the post() method.  If I do

RE: RE: Re: URI won't match what's attached to the router

2008-05-16 Thread Bao,Sam
I've got another thing to throw in to this problem.  So our reqs changed and 
now we need to also specify a person id type in the url, e.g. 
http://localhost:8182/lastRiskEval/{personid}/{personidtype}

So how do I attach to the router so that all of these patterns would match to 
the single resource, rather than return a 404:

http://localhost:8182/lastRiskEval/
http://localhost:8182/lastRiskEval/12345
http://localhost:8182/lastRiskEval/12345/
http://localhost:8182/lastRiskEval/12345/12345

This is what I've tried:
  Route route = 
router.attach(/lastRiskEval/{personid}/{personidtype}, 
LastRiskEvaluationResource.class);
Variable variable = new Variable(Variable.TYPE_ALL, , false, false);
route.getTemplate().getVariables().put(personid, variable);
route.getTemplate().getVariables().put(personidtype, variable);

I've tried setting personid and personidtype variable to be both optional, I've 
tried setting personidtype to be the only variable optional, and I've tried 
setting personid to be the only variable optional, but no matter, the first 
example always returns a 404.  How do I match on the first example?

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: Bao,Sam [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 13, 2008 10:55 AM
To: discuss@restlet.tigris.org
Subject: RE: Re: URI won't match what's attached to the router

Thanks Stephan,  That had been my original thought on the project, but our 
design has been trimmed so that we limit a single request to a single person 
id, as there is not usecase (yet) for wanting to retrieve info for more than 
one person. 


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | 
[EMAIL PROTECTED] | www.cerner.com

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 13, 2008 10:52 AM
To: discuss@restlet.tigris.org
Subject: Re: URI won't match what's attached to the router

Hi Sam,

you could also create a resource for /lastRiskEval (without slash at the
end) that handles the requests for the collection of persons.

best regards
   Stephan

Bao,Sam schrieb:
 Ah, I gotcha.  My previous application could match because I actually had  
 /results/ that was attached to a resource.  In this case /lastRiskEval/ 
 is not attached to any resource.  LastRiskEvaluationResource only supports 
 GET when given a 'personid', nothing else, so I didn't think there would be a 
 need to attach the uri pattern /lastRiskEva/ to anything.  That makes sense 
 to me now.  Thanks.
   
 -Original Message-
 From: Thierry Boileau [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 13, 2008 10:42 AM
 To: discuss@restlet.tigris.org
 Subject: Re: URI won't match what's attached to the router

 Hi Sam,

 by default a variable is supposed to eat at least one character. In your 
 case, the route /lastRiskEval/{personid} cannot match the URI 
 /lastRiskEval/.
 Another question is what is the resource behind /lastRiskEval/? Does this 
 URI really correspond to a LastRiskEvaluationResource instance?

 best regards,
 Thierry Boileau

   
 I can try this, but I'm curious as to am I declaring the variable wrong?  Is 
 the example below the proper way to do that?  Thanks. 
 
 -Original Message-
 From: Thierry Boileau [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 13, 2008 10:03 AM
 To: discuss@restlet.tigris.org
 Subject: Re: URI won't match what's attached to the router

 Hello Sam,

 you can update the personid variable in order to make it facultative:

 Route route = router.attach(/lastRiskEval/{personid},
 LastRiskEvaluationResource.class);
 // You can use other Variable.TYPE_...
 Variable variable = new Variable(Variable.TYPE_ALPHA_DIGIT, , 
 false, false); route.getTemplate().getVariables().put(personid,
 variable);

 best regards,
 Thierry Boileau
 
 I've got the following resource attached to my router:

 Router router = new Router(getContext());
 router.attach(/conditions, ConditionsResource.class);
 router.attach(/facts, FactsResource.class);
 router.attach(/risks, RisksResource.class);
 router.attach(/riskEval, RiskEvaluationResource.class);
 router.attach(/lastRiskEval/{personid},
 LastRiskEvaluationResource.class);

 However, when I try to go to the LastRiskEvaluationResource without giving 
 it a person id, I get a 404.

 I'm just running the http server locally, and so the url I'm using is: 
 http://localhost:8182/lastRiskEval/

 However, I get a 404.  I traced it down to where the Decoder.handle() tries 
 to getNext() and doesn't find the 'next' because when getting routes, it 
 uses the BEST method, but never matches my URI.  I'm using 1.0.9, does 
 anyone have a clue on what I should try?

 I've had this work before on another Application where I had 
 /results/{personid} and it'd work

Calling a resource from another resource

2008-05-14 Thread Bao,Sam
Is it possible to call a resource from within another resource?  The reasoning 
behind this is I want to create a Check Setup Resource, where a user can go to 
this resource, and it will run a test GET, POST, PUT, and DELETE on the other 
resources to make sure that everything is set up, configured, deployed, and 
running correctly.

 Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
 PROTECTED] | www.cerner.com
 

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.

RE: Re: Calling a resource from another resource

2008-05-14 Thread Bao,Sam
Ok, I was thinking of the latter solution, but I guess I was wondering if there 
is a more elegant/proper way of doing it.  I'll try the former and call the 
handle method.  Thanks. 


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 14, 2008 3:00 PM
To: discuss@restlet.tigris.org
Subject: Re: Calling a resource from another resource

Hi Sam,

You could directly call the handle method of the Application, Router or 
whatever. You must ensure, that you set the right base ref of the Reference.
Otherwise you could create a Client and send a request to the own server.

best regards
   Stephan

Bao,Sam schrieb:

 Is it possible to call a resource from within another resource?  The 
 reasoning behind this is I want to create a Check Setup Resource, 
 where a user can go to this resource, and it will run a test GET, 
 POST, PUT, and DELETE on the other resources to make sure that 
 everything is set up, configured, deployed, and running correctly.


--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


RE: Re: Calling a resource from another resource

2008-05-14 Thread Bao,Sam
Ah, this is more in lines with what I was thinking.  I'll give this a shot.
 

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] mailto:[EMAIL PROTECTED]  | www.cerner.com 
http://www.cerner.com/  

 



From: Rob Heittman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 14, 2008 3:07 PM
To: discuss@restlet.tigris.org
Subject: Re: Calling a resource from another resource


You almost certainly want to use the Restlet Internal Application Protocol 
(RIAP) 
http://wiki.restlet.org/docs_1.1/g1/13-restlet/48-restlet/86-restlet/90-restlet/45-restlet.html

This avoids either the overhead of an external HTTP call or the risk of error 
and tight bindings associated with directly calling between objects.  RIAP gets 
heavy exercise by my company and Marc Portier's, even if nobody else really 
knows about it yet  :-)

- Rob


--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.

RE: Re: Calling a resource from another resource

2008-05-14 Thread Bao,Sam
Do you have any sample code that demonstrates the proper usage of the riap?  
I'm running 1.0.9 so not all of the methods translate directly over to me, but 
this is what I'm doing inside of my Check Status Resource: 

// Create a new Component.

Component component = new Component();

// Attach the results application.

component.getDefaultHost().attach(/conditions, ConditionsResource.class);

component.getContext().getDispatcher().get(riap://conditions);

I'm attach condition resource class to the /conditions path, and then calling 
a get on it right?

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] mailto:[EMAIL PROTECTED]  | www.cerner.com 
http://www.cerner.com/  

 



From: Rob Heittman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 14, 2008 3:07 PM
To: discuss@restlet.tigris.org
Subject: Re: Calling a resource from another resource


You almost certainly want to use the Restlet Internal Application Protocol 
(RIAP) 
http://wiki.restlet.org/docs_1.1/g1/13-restlet/48-restlet/86-restlet/90-restlet/45-restlet.html

This avoids either the overhead of an external HTTP call or the risk of error 
and tight bindings associated with directly calling between objects.  RIAP gets 
heavy exercise by my company and Marc Portier's, even if nobody else really 
knows about it yet  :-)

- Rob


--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.

RE: Re: Re: Calling a resource from another resource

2008-05-14 Thread Bao,Sam
I'm sorry, but I'm not able to get this to work with 1.0.9.  I don't have a 
getServerDispatcher(), where is this?  On the context, I have just 
getDispatcher(), but that doesn't seem to be able to find a resource.
 
For now, I tried creating a client and calling the server, which works, but 
requires me to know the host and port, which locally I know, but when deployed, 
I will not know.  How to dynamically determine the app's host and port?
 
I think I'm going to try porting over to 1.1 and see if it'll work, but I have 
a feeling, my request will be rejected and we'll be using 1.0.9 till 1.1 is 
fully released.
 

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] mailto:[EMAIL PROTECTED]  | www.cerner.com 
http://www.cerner.com/  

 



From: Rob Heittman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 14, 2008 4:12 PM
To: discuss@restlet.tigris.org
Subject: Re: Re: Calling a resource from another resource


Oops, RIAP may be introduced only in 1.1, I can't remember.  Certainly I quoted 
the 1.1 wiki docs.

Besides that, you'll need to substitute something like 
riap://application/conditions for just riap://conditions  The host part of 
the riap: pseudoprotocol is used to say whether the reference should be 
resolved relative to the context's Component, Application, or (now in trunk) 
VirtualHost.

Note that these are relative to the Context from which you get the dispatcher, 
so you may not be able to say //application if you are explicitly fetching the 
Component's context.  getContext().getClientDispatcher() is the usual way.

In the 1.0 tree, you'd need at least the ability to address the server 
dispatcher (getServerDispatcher()) to make an internal call of any sort.  Most 
of this internal-call goodness came about as the 1.1 effort was starting up 
though, so I don't rightly remember what's actually exposed in 1.0.x.

It is pretty straightforward to develop your solution with HTTP calls in 1.0 
and know you can trivially change them to RIAP calls for efficiency when you 
update to 1.1.

- Rob



On Wed, May 14, 2008 at 4:58 PM, Bao,Sam [EMAIL PROTECTED] wrote:


Do you have any sample code that demonstrates the proper usage of the 
riap?  I'm running 1.0.9 so not all of the methods translate directly over to 
me, but this is what I'm doing inside of my Check Status Resource: 

// Create a new Component.

Component component = 

new Component(); 





// Attach the results application. 

component.getDefaultHost().attach(

/conditions, ConditionsResource.class); 



component.getContext().getDispatcher().get(

riap://conditions);
I'm attach condition resource class to the /conditions path, and then 
calling a get on it right?

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  | www.cerner.com 
http://www.cerner.com/  

 



From: Rob Heittman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 14, 2008 3:07 PM
To: discuss@restlet.tigris.org
Subject: Re: Calling a resource from another resource


You almost certainly want to use the Restlet Internal Application 
Protocol (RIAP) 
http://wiki.restlet.org/docs_1.1/g1/13-restlet/48-restlet/86-restlet/90-restlet/45-restlet.html

This avoids either the overhead of an external HTTP call or the risk of 
error and tight bindings associated with directly calling between objects.  
RIAP gets heavy exercise by my company and Marc Portier's, even if nobody else 
really knows about it yet  :-)

- Rob




CONFIDENTIALITY NOTICE This message and any included attachments are 
from Cerner Corporation and are intended only for the addressee. The 
information contained in this message is confidential and may constitute inside 
or non-public information under international, federal, or state securities 
laws. Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.





URI won't match what's attached to the router

2008-05-13 Thread Bao,Sam
I've got the following resource attached to my router:

Router router = new Router(getContext());
router.attach(/conditions, ConditionsResource.class);
router.attach(/facts, FactsResource.class);
router.attach(/risks, RisksResource.class);
router.attach(/riskEval, RiskEvaluationResource.class);
router.attach(/lastRiskEval/{personid}, 
LastRiskEvaluationResource.class);

However, when I try to go to the LastRiskEvaluationResource without giving it a 
person id, I get a 404.

I'm just running the http server locally, and so the url I'm using is: 
http://localhost:8182/lastRiskEval/

However, I get a 404.  I traced it down to where the Decoder.handle() tries to 
getNext() and doesn't find the 'next' because when getting routes, it uses the 
BEST method, but never matches my URI.  I'm using 1.0.9, does anyone have a 
clue on what I should try?

I've had this work before on another Application where I had 
/results/{personid} and it'd work.

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


RE: Re: URI won't match what's attached to the router

2008-05-13 Thread Bao,Sam
I can try this, but I'm curious as to am I declaring the variable wrong?  Is 
the example below the proper way to do that?  Thanks. 


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: Thierry Boileau [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 13, 2008 10:03 AM
To: discuss@restlet.tigris.org
Subject: Re: URI won't match what's attached to the router

Hello Sam,

you can update the personid variable in order to make it facultative:

Route route = router.attach(/lastRiskEval/{personid},
LastRiskEvaluationResource.class);
// You can use other Variable.TYPE_...
Variable variable = new Variable(Variable.TYPE_ALPHA_DIGIT, , false, false); 
route.getTemplate().getVariables().put(personid, variable);


best regards,
Thierry Boileau

 I've got the following resource attached to my router:

 Router router = new Router(getContext());
 router.attach(/conditions, ConditionsResource.class);
 router.attach(/facts, FactsResource.class);
 router.attach(/risks, RisksResource.class);
 router.attach(/riskEval, RiskEvaluationResource.class);
 router.attach(/lastRiskEval/{personid}, 
 LastRiskEvaluationResource.class);

 However, when I try to go to the LastRiskEvaluationResource without giving it 
 a person id, I get a 404.

 I'm just running the http server locally, and so the url I'm using is: 
 http://localhost:8182/lastRiskEval/

 However, I get a 404.  I traced it down to where the Decoder.handle() tries 
 to getNext() and doesn't find the 'next' because when getting routes, it uses 
 the BEST method, but never matches my URI.  I'm using 1.0.9, does anyone have 
 a clue on what I should try?

 I've had this work before on another Application where I had 
 /results/{personid} and it'd work.

 --
 CONFIDENTIALITY NOTICE This message and any included attachments are from 
 Cerner Corporation and are intended only for the addressee. The information 
 contained in this message is confidential and may constitute inside or 
 non-public information under international, federal, or state securities 
 laws. Unauthorized forwarding, printing, copying, distribution, or use of 
 such information is strictly prohibited and may be unlawful. If you are not 
 the addressee, please promptly delete this message and notify the sender of 
 the delivery error by e-mail or you may call Cerner's corporate offices in 
 Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

   



RE: Re: URI won't match what's attached to the router

2008-05-13 Thread Bao,Sam
Ah, I gotcha.  My previous application could match because I actually had  
/results/ that was attached to a resource.  In this case /lastRiskEval/ is 
not attached to any resource.  LastRiskEvaluationResource only supports GET 
when given a 'personid', nothing else, so I didn't think there would be a need 
to attach the uri pattern /lastRiskEva/ to anything.  That makes sense to me 
now.  Thanks.


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: Thierry Boileau [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 13, 2008 10:42 AM
To: discuss@restlet.tigris.org
Subject: Re: URI won't match what's attached to the router

Hi Sam,

by default a variable is supposed to eat at least one character. In your 
case, the route /lastRiskEval/{personid} cannot match the URI 
/lastRiskEval/.
Another question is what is the resource behind /lastRiskEval/? Does this URI 
really correspond to a LastRiskEvaluationResource instance?

best regards,
Thierry Boileau

 I can try this, but I'm curious as to am I declaring the variable wrong?  Is 
 the example below the proper way to do that?  Thanks. 

   
 Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | 
 [EMAIL PROTECTED] | www.cerner.com
 

 -Original Message-
 From: Thierry Boileau [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 13, 2008 10:03 AM
 To: discuss@restlet.tigris.org
 Subject: Re: URI won't match what's attached to the router

 Hello Sam,

 you can update the personid variable in order to make it facultative:

 Route route = router.attach(/lastRiskEval/{personid},
 LastRiskEvaluationResource.class);
 // You can use other Variable.TYPE_...
 Variable variable = new Variable(Variable.TYPE_ALPHA_DIGIT, , false, 
 false); route.getTemplate().getVariables().put(personid, variable);


 best regards,
 Thierry Boileau

   
 I've got the following resource attached to my router:

 Router router = new Router(getContext());
 router.attach(/conditions, ConditionsResource.class);
 router.attach(/facts, FactsResource.class);
 router.attach(/risks, RisksResource.class);
 router.attach(/riskEval, RiskEvaluationResource.class);
 router.attach(/lastRiskEval/{personid},
 LastRiskEvaluationResource.class);

 However, when I try to go to the LastRiskEvaluationResource without giving 
 it a person id, I get a 404.

 I'm just running the http server locally, and so the url I'm using is: 
 http://localhost:8182/lastRiskEval/

 However, I get a 404.  I traced it down to where the Decoder.handle() tries 
 to getNext() and doesn't find the 'next' because when getting routes, it 
 uses the BEST method, but never matches my URI.  I'm using 1.0.9, does 
 anyone have a clue on what I should try?

 I've had this work before on another Application where I had 
 /results/{personid} and it'd work.

 -
 - CONFIDENTIALITY NOTICE This message and any included attachments 
 are from Cerner Corporation and are intended only for the addressee. The 
 information contained in this message is confidential and may constitute 
 inside or non-public information under international, federal, or state 
 securities laws. Unauthorized forwarding, printing, copying, distribution, 
 or use of such information is strictly prohibited and may be unlawful. If 
 you are not the addressee, please promptly delete this message and notify 
 the sender of the delivery error by e-mail or you may call Cerner's 
 corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

   
 


   



RE: Re: URI won't match what's attached to the router

2008-05-13 Thread Bao,Sam
Thanks Stephan,  That had been my original thought on the project, but our 
design has been trimmed so that we limit a single request to a single person 
id, as there is not usecase (yet) for wanting to retrieve info for more than 
one person. 


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 13, 2008 10:52 AM
To: discuss@restlet.tigris.org
Subject: Re: URI won't match what's attached to the router

Hi Sam,

you could also create a resource for /lastRiskEval (without slash at the
end) that handles the requests for the collection of persons.

best regards
   Stephan

Bao,Sam schrieb:
 Ah, I gotcha.  My previous application could match because I actually had  
 /results/ that was attached to a resource.  In this case /lastRiskEval/ 
 is not attached to any resource.  LastRiskEvaluationResource only supports 
 GET when given a 'personid', nothing else, so I didn't think there would be a 
 need to attach the uri pattern /lastRiskEva/ to anything.  That makes sense 
 to me now.  Thanks.
   
 -Original Message-
 From: Thierry Boileau [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 13, 2008 10:42 AM
 To: discuss@restlet.tigris.org
 Subject: Re: URI won't match what's attached to the router

 Hi Sam,

 by default a variable is supposed to eat at least one character. In your 
 case, the route /lastRiskEval/{personid} cannot match the URI 
 /lastRiskEval/.
 Another question is what is the resource behind /lastRiskEval/? Does this 
 URI really correspond to a LastRiskEvaluationResource instance?

 best regards,
 Thierry Boileau

   
 I can try this, but I'm curious as to am I declaring the variable wrong?  Is 
 the example below the proper way to do that?  Thanks. 
 
 -Original Message-
 From: Thierry Boileau [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 13, 2008 10:03 AM
 To: discuss@restlet.tigris.org
 Subject: Re: URI won't match what's attached to the router

 Hello Sam,

 you can update the personid variable in order to make it facultative:

 Route route = router.attach(/lastRiskEval/{personid},
 LastRiskEvaluationResource.class);
 // You can use other Variable.TYPE_...
 Variable variable = new Variable(Variable.TYPE_ALPHA_DIGIT, , 
 false, false); route.getTemplate().getVariables().put(personid, 
 variable);

 best regards,
 Thierry Boileau
 
 I've got the following resource attached to my router:

 Router router = new Router(getContext());
 router.attach(/conditions, ConditionsResource.class);
 router.attach(/facts, FactsResource.class);
 router.attach(/risks, RisksResource.class);
 router.attach(/riskEval, RiskEvaluationResource.class);
 router.attach(/lastRiskEval/{personid},
 LastRiskEvaluationResource.class);

 However, when I try to go to the LastRiskEvaluationResource without giving 
 it a person id, I get a 404.

 I'm just running the http server locally, and so the url I'm using is: 
 http://localhost:8182/lastRiskEval/

 However, I get a 404.  I traced it down to where the Decoder.handle() tries 
 to getNext() and doesn't find the 'next' because when getting routes, it 
 uses the BEST method, but never matches my URI.  I'm using 1.0.9, does 
 anyone have a clue on what I should try?

 I've had this work before on another Application where I had 
 /results/{personid} and it'd work.
   

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


RE: RE: 'method' parameter

2008-04-17 Thread Bao,Sam
Jerome,

Did you receive my last two replies?


I don't know if you remember about a week ago I was using a POST-GET hack to 
get around the fact that the Pattern that was generated around the really long 
(1400+ characters) attribute string would cause an StackOverflowException.  So 
I ended up parsing the attribute string myself.  However, we determined that we 
still would keep the post hack due to other limitations that other applications 
we use may impose on the uri length such as proxies, app servers, browsers, 
etc...  So we post with a method parameter telling us of what we should be 
doing.


So now the problem I face is when I'm in the getRepresentation, I'm not sure if 
I'm dealing with a true get or a post-get.  I'm able to get away with the fact 
that when a user is using get, they're required to pass us an id attribute, if 
that's null or empty, then I assume that we're dealing with a post-get.  This 
isn't ideal because I'd like to be able to return a status 400 when I don't get 
an id attribute, rather than go on to run the post get hack.  


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: Noelios Consulting [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 17, 2008 1:57 AM
To: discuss@restlet.tigris.org
Subject: RE: 'method' parameter


Hi Sam, 

In addition, it would be interesting to know why you would need to know whether 
it is a true GET or a POST-GET. 

The goal of the tunnel service is to be as transparent as possible for the 
applications so that they can run in more situation without any specific 
changes.

Best regards,
Jerome  

 -Message d'origine-
 De : Thierry Boileau [mailto:[EMAIL PROTECTED] Envoyé : mercredi 16 
 avril 2008 22:25 À : discuss@restlet.tigris.org Objet : Re: 'method' 
 parameter
 
 Hello Sam,
 
 I'm not sure it was designed to do so. Could you explain us why you 
 need to update the request's method?
 
 best regards,
 Thierry Boileau
 
  On a POST, I'm using the method parameter and just happened
 to set it 'GET', and noticed that the resource will run the
 getRepresentation() method rather than the post() method.  If I do 
 something like this, is there a way to tell inside of the 
 getRepresentation() method to know if we're dealing with a true GET or 
 a POST-GET?
 
  Sam Bao | Software Engineer | Cerner Corporation |
 816.201.8242 | [EMAIL PROTECTED] | www.cerner.com
 
  
 --
  CONFIDENTIALITY NOTICE This message and any included
 attachments are from Cerner Corporation and are intended only for the 
 addressee. The information contained in this message is confidential 
 and may constitute inside or non-public information under 
 international, federal, or state securities laws. Unauthorized 
 forwarding, printing, copying, distribution, or use of such 
 information is strictly prohibited and may be unlawful. If you are not 
 the addressee, please promptly delete this message and notify the 
 sender of the delivery error by e-mail or you may call Cerner's 
 corporate offices in Kansas City, Missouri, U.S.A at (+1) 
 (816)221-1024.
 

 

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


RE: Re: 'method' parameter

2008-04-17 Thread Bao,Sam
Yes, I did modify the long variable, and that helps so that we're not so 
limited to a unuseable short attribute.  However, I've still got a concern over 
unknown limitations somewhere in our software stack that may cause problem such 
as appServer, proxies, browsers, etc...

As for the checking against the entity.  I tried that and noticed that I still 
get an InputRepresentation even on a 'real' GET, just as I do when it's a 
'post' GET.  However, I see that I can check against the size or the media 
type.  If I check against the size, on a 'real' GET, is it always guaranteed to 
be -1?

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: Thierry Boileau [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 17, 2008 9:05 AM
To: discuss@restlet.tigris.org
Subject: Re: 'method' parameter

Hi Sam,

did you try to update your URI templates to catch long variables?
Route route = router.attach(/result/{yourVar}, Restlet instance or Resource 
class); route.getTemplate().getVariables().put(yourVar, new 
Variable(Variable.TYPE_ALL));

Otherwise, you can check the entity of the request (getRequest().getEntity()). 
A real GET request does not have such entity instead of a POST-GET.

best regards,
Thierry Boileau

 Thierry,

 I don't know if you remember about a week ago I was using a POST-GET hack to 
 get around the fact that the Pattern that was generated around the really 
 long (1400+ characters) attribute string would cause an 
 StackOverflowException.  So I ended up parsing the attribute string myself.  
 However, we determined that we still would keep the post hack due to other 
 limitations that other applications we use may impose on the uri length such 
 as proxies, app servers, browsers, etc...  So we post with a method parameter 
 telling us of what we should be doing.


   
 Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | 
 [EMAIL PROTECTED] | www.cerner.com
 

 -Original Message-
 From: Thierry Boileau [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 16, 2008 3:25 PM
 To: discuss@restlet.tigris.org
 Subject: Re: 'method' parameter

 Hello Sam,

 I'm not sure it was designed to do so. Could you explain us why you need to 
 update the request's method?

 best regards,
 Thierry Boileau

   
 On a POST, I'm using the method parameter and just happened to set it 'GET', 
 and noticed that the resource will run the getRepresentation() method rather 
 than the post() method.  If I do something like this, is there a way to tell 
 inside of the getRepresentation() method to know if we're dealing with a 
 true GET or a POST-GET?

 Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | 
 [EMAIL PROTECTED] | www.cerner.com

 -
 - CONFIDENTIALITY NOTICE This message and any included attachments 
 are from Cerner Corporation and are intended only for the addressee. The 
 information contained in this message is confidential and may constitute 
 inside or non-public information under international, federal, or state 
 securities laws. Unauthorized forwarding, printing, copying, distribution, 
 or use of such information is strictly prohibited and may be unlawful. If 
 you are not the addressee, please promptly delete this message and notify 
 the sender of the delivery error by e-mail or you may call Cerner's 
 corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

   
 


   



getRepresentation(Variant variant)

2008-04-17 Thread Bao,Sam
I know that this is a 1.0.9 method, but I believe in 1.1 there's still the 
represent(Variant variant) method.  I was wondering how do you set the 
variant's media type if I'm calling GET using the org.restlet.Client?  Like say 
I want to be able to call GET and request the response come back as TEXT or 
TEXT_XML, and that's it.  Thanks.

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


RE: Re: 'method' parameter

2008-04-16 Thread Bao,Sam
Theirry,

I don't know if you remember about a week ago I was using a POST-GET hack to 
get around the fact that the Pattern that was generated around the really long 
(1400+ characters) attribute string would cause an StackOverflowException.  So 
I ended up parsing the attribute string myself.  However, we determined that we 
still would keep the post hack due to other limitations that other applications 
we use may impose on the uri length such as proxies, app servers, browsers, 
etc...  So we post with a method parameter telling us of what we should be 
doing.


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: Thierry Boileau [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 16, 2008 3:25 PM
To: discuss@restlet.tigris.org
Subject: Re: 'method' parameter

Hello Sam,

I'm not sure it was designed to do so. Could you explain us why you need to 
update the request's method?

best regards,
Thierry Boileau

 On a POST, I'm using the method parameter and just happened to set it 'GET', 
 and noticed that the resource will run the getRepresentation() method rather 
 than the post() method.  If I do something like this, is there a way to tell 
 inside of the getRepresentation() method to know if we're dealing with a true 
 GET or a POST-GET?

 Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | 
 [EMAIL PROTECTED] | www.cerner.com

 --
 CONFIDENTIALITY NOTICE This message and any included attachments are from 
 Cerner Corporation and are intended only for the addressee. The information 
 contained in this message is confidential and may constitute inside or 
 non-public information under international, federal, or state securities 
 laws. Unauthorized forwarding, printing, copying, distribution, or use of 
 such information is strictly prohibited and may be unlawful. If you are not 
 the addressee, please promptly delete this message and notify the sender of 
 the delivery error by e-mail or you may call Cerner's corporate offices in 
 Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

   



RE: Re: Unit testing code coverage

2008-04-15 Thread Bao,Sam
Stephan,

I've just got to looking at the RestletServerTestCase, and it seems I'm getting 
some errors that I'm thinking may be because I'm using the 1.0.9 version.  
These are the errors I'm seeing:

1. Line 293. On the request, I don't have a setConditions() method.
2. Line 328 and 357, On my WrapperRepresentation, I lack the getReader() and 
write(Writer) methods.

Are these methods new to 1.1?  If so, are there deprecated methods in 1.0.9?

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 14, 2008 6:40 AM
To: discuss@restlet.tigris.org
Subject: Re: Unit testing code coverage

Hi Sam,

I've just refactored my JUnit TestCase base class to be used independently of 
JAX-RS. Take a look at project org.restlet.test (only in SVN trunk), class 
org.restlet.test.jaxrs.server.RestletServerTestCase. You don't need to take a 
look into the other classes in this package.

Subclass RestletServerTestCase and wrote test* methods as for every JUnit test. 
You may use #setUseTcp(true / false) to indicate, if you want real tcp access 
(slow) or direct application access (sometimes only nearly real). You may also 
change the initial value in RestletServerTestCase.
You should use the accessServer methods to access the server.
So, if you don't understand the result, test with real TCP; if you found a bug 
in the RestletServerTestCase, let me know, at the best with a test case 
reproducing it.

The setUp() method automaticly starts the server for every method and
tearDown() will stop it. So you must ensure to call super.setUp() /
super.tearDown() if you override them.

Take a look into it and let me know, what is not clear, so I will add more 
javadoc to methods with not enough javadoc ... I'll be happy about feedback. 
Perhaps I can not answer the rest of today, but tomorrow I have time for it.

best regards
   Stephan

Stephan Koops wrote:
 [...]

 BTW: It's not required that you use a real TCP client for testing: You can 
 give the application directly your requests. So you save a LOT of time, 
 because you save the time to start the TCP-ServerSocket, serializing requests 
 and so on.
 I should refactor that out of my JAX-RS test case class, because it is 
 combined with services for JAX-RS testing.

 best regards
Stephan

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


RE: Re: Unit testing code coverage

2008-04-15 Thread Bao,Sam
Thanks, I will be sticking to the 1.0.9 until 1.1 goes to release.  So I'll try 
modifying the RestletServerTestCase, and see what happens.  Thanks. 


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 15, 2008 9:57 AM
To: discuss@restlet.tigris.org
Subject: Re: Unit testing code coverage

Hi Sam,

I'm only using the current version from the svn trunk. You are right, the 
method does not exist in 1.0

You can try the milestone 1.1 M3 (www.restlet.org/downloads).

Another possibility is to change the line 293: use getConditions and copy all 
attributes from the method parameter to the request Conditions.
If the methods for Reader and writer you can just delete these methods. 
They are only available to ensure, that the entity is not available, if the 
request was a HEAD request

best regards
Stephan

Bao,Sam schrieb:
 Stephan,

 I've just got to looking at the RestletServerTestCase, and it seems I'm 
 getting some errors that I'm thinking may be because I'm using the 1.0.9 
 version.  These are the errors I'm seeing:

 1. Line 293. On the request, I don't have a setConditions() method.
 2. Line 328 and 357, On my WrapperRepresentation, I lack the getReader() and 
 write(Writer) methods.

 Are these methods new to 1.1?  If so, are there deprecated methods in 1.0.9?
   
 Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | 
 [EMAIL PROTECTED] | www.cerner.com
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Monday, April 14, 2008 6:40 AM
 To: discuss@restlet.tigris.org
 Subject: Re: Unit testing code coverage

 Hi Sam,

 I've just refactored my JUnit TestCase base class to be used independently of 
 JAX-RS. Take a look at project org.restlet.test (only in SVN trunk), class 
 org.restlet.test.jaxrs.server.RestletServerTestCase. You don't need to take a 
 look into the other classes in this package.

 Subclass RestletServerTestCase and wrote test* methods as for every JUnit 
 test. You may use #setUseTcp(true / false) to indicate, if you want real tcp 
 access (slow) or direct application access (sometimes only nearly real). You 
 may also change the initial value in RestletServerTestCase.
 You should use the accessServer methods to access the server.
 So, if you don't understand the result, test with real TCP; if you found a 
 bug in the RestletServerTestCase, let me know, at the best with a test case 
 reproducing it.

 The setUp() method automaticly starts the server for every method and
 tearDown() will stop it. So you must ensure to call super.setUp() /
 super.tearDown() if you override them.

 Take a look into it and let me know, what is not clear, so I will add more 
 javadoc to methods with not enough javadoc ... I'll be happy about feedback. 
 Perhaps I can not answer the rest of today, but tomorrow I have time for it.

 best regards
Stephan

 Stephan Koops wrote:
   
 [...]

 BTW: It's not required that you use a real TCP client for testing: You can 
 give the application directly your requests. So you save a LOT of time, 
 because you save the time to start the TCP-ServerSocket, serializing 
 requests and so on.
 I should refactor that out of my JAX-RS test case class, because it is 
 combined with services for JAX-RS testing.

 best regards
Stephan

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


RE: Re: Attribute and URI patterns

2008-04-15 Thread Bao,Sam
Thats it.  Thanks.
 

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] mailto:[EMAIL PROTECTED]  | www.cerner.com 
http://www.cerner.com/  

 



From: keke [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 14, 2008 5:08 AM
To: discuss@restlet.tigris.org
Subject: Re: Attribute and URI patterns


Hi 

Have you tried to remove the last question mark in your DELETE router uri 
template?

Actually, it is not necessary to declare the query part (anything after ?) in 
the uri template. If you do not do this, you can still get the query name and 
value from Resource of request.getResourceRef().




On Sat, Apr 12, 2008 at 3:54 AM, Bao,Sam [EMAIL PROTECTED] wrote:


I'm trying to attach two different URI patterns to the same resource so 
that I can use different patterns for GET, POST, PUT, DELETE However, what I'm 
currently doing only GET works, and the attributes are null in DELETE.  I'm 
using the representations in the POST and PUT, so that part seems fine to me 
right now.  Any advice for GET and DELETE?  This is what I'm doing right now

Router resultRouter = new Router(getContext());
resultRouter.attach(/result, ResultResource.class); //initial route
resultRouter.attach(/result/{getId}, ResultResource.class);  //route 
for GET with a getId attribute
resultRouter.attach(/result/{deleteId}/{deleteVersion}?, 
ResultResource.class); //route DELETE with a deleteId and a deleteVersion 
attribute
resultRouter.attach(/result?{method}, ResultResource.class); //route 
for POST with a method attribute

With the above code, in the GET, I'm able to use the getId attribute, 
but in the DELETE, the deleteId and deleteVersion attributes don't exist, and 
thus null.

Any help or point me in the right direction, would be mucho 
appreciated.  Thanks.

--
CONFIDENTIALITY NOTICE This message and any included attachments are 
from Cerner Corporation and are intended only for the addressee. The 
information contained in this message is confidential and may constitute inside 
or non-public information under international, federal, or state securities 
laws. Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.





-- 
Cheers,
Keke
-
We paranoid love life 

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.

RE: Re: Unit testing code coverage

2008-04-11 Thread Bao,Sam
Thanks.  I'll check it out. 


Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 11, 2008 6:07 AM
To: discuss@restlet.tigris.org
Subject: Re: Unit testing code coverage

Hi Sam,

it is available in the Restlet SVN trunk, module org.restlet.test, class 
org.restlet.test.jaxrs.services.tests.JaxRsTestCase together with the classes 
in package org.restlet.test.jaxrs.server

you can call e.g. Applicaton.handle(Request, Response). You must ensure that 
the Reference in the request with its baseRef is correct (same as if it somes 
from the net). If you need the host header, you have to set it manually before 
calling the application.

I hope that I can refactor this to have a class independent of JAX-RS today 
afternoon or on monday.

best regards
   Stephan

Bao,Sam schrieb:
 I had thought about not using the client, and just calling the methods on the 
 resources directly, but I was wanting to test as if going through a browser.  
 Is your JAX-RS test classes available for studying somewhere?

 I'm not just checking to make sure all code is covered, but rather I'd like 
 to see how much is covered, and how much is not by my current tests.  It's a 
 practice we try to promote so that there's not a lot of wasteful code.

 If I wanted to run the app as a server, and test using a client, is there any 
 good methods for doing that?

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 10, 2008 5:18 PM
 To: discuss@restlet.tigris.org
 Subject: Re: Unit testing code coverage

 Hi Sam,

 as you perhaps know, I'm implementing the JAX-RS extension and wrote a lot of 
 unit tests. But I do not check, if all code is covered.

 BTW: It's not required that you use a real TCP client for testing: You can 
 give the application directly your requests. So you save a LOT of time, 
 because you save the time to start the TCP-ServerSocket, serializing requests 
 and so on.
 I should refactor that out of my JAX-RS test case class, because it is 
 combined with services for JAX-RS testing.

 best regards
Stephan

 Bao,Sam schrieb:
   
 I was wondering how are you guys unit testing for code coverage with restlet 
 applications and resources?  I ask this because, I've tried using a couple 
 of different code coverage eclipse plugins, and using restlet Client over 
 Http, I can unit test my application, but I can not achieve any kind of code 
 coverage.  I've googled around on this topic and did not see anything 
 helpful.  So, what are you guys doing?
   
 

 --
 CONFIDENTIALITY NOTICE This message and any included attachments are from 
 Cerner Corporation and are intended only for the addressee. The information 
 contained in this message is confidential and may constitute inside or 
 non-public information under international, federal, or state securities 
 laws. Unauthorized forwarding, printing, copying, distribution, or use of 
 such information is strictly prohibited and may be unlawful. If you are not 
 the addressee, please promptly delete this message and notify the sender of 
 the delivery error by e-mail or you may call Cerner's corporate offices in 
 Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
   

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


Attribute and URI patterns

2008-04-11 Thread Bao,Sam
I'm trying to attach two different URI patterns to the same resource so that I 
can use different patterns for GET, POST, PUT, DELETE However, what I'm 
currently doing only GET works, and the attributes are null in DELETE.  I'm 
using the representations in the POST and PUT, so that part seems fine to me 
right now.  Any advice for GET and DELETE?  This is what I'm doing right now

Router resultRouter = new Router(getContext());
resultRouter.attach(/result, ResultResource.class); //initial route
resultRouter.attach(/result/{getId}, ResultResource.class);  //route for GET 
with a getId attribute
resultRouter.attach(/result/{deleteId}/{deleteVersion}?, 
ResultResource.class); //route DELETE with a deleteId and a deleteVersion 
attribute
resultRouter.attach(/result?{method}, ResultResource.class); //route for POST 
with a method attribute

With the above code, in the GET, I'm able to use the getId attribute, but in 
the DELETE, the deleteId and deleteVersion attributes don't exist, and thus 
null.

Any help or point me in the right direction, would be mucho appreciated.  
Thanks.

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


Unit testing code coverage

2008-04-10 Thread Bao,Sam
I was wondering how are you guys unit testing for code coverage with restlet 
applications and resources?  I ask this because, I've tried using a couple of 
different code coverage eclipse plugins, and using restlet Client over Http, I 
can unit test my application, but I can not achieve any kind of code coverage.  
I've googled around on this topic and did not see anything helpful.  So, what 
are you guys doing?

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


RE: Re: StackOverFlow warning

2008-04-09 Thread Bao,Sam
Thiery,

I had figured it was something to do with the Pattern class not being able to 
handle the regex that was generated.  I was hoping there was a workaround such 
as you provided.  I'll give it a try.  Thanks.

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] | www.cerner.com

-Original Message-
From: Thierry Boileau [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 09, 2008 3:29 AM
To: discuss@restlet.tigris.org
Subject: Re: StackOverFlow warning

Hello all,

this problem has already been encoutered and seems to be related to this bug 
affecting the java.util.regex.Pattern class:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6337993.

As a workaround, you can update your code like that:

Route route = router.attach(/result/{yourVar}, Restlet instance or Resource 
class); route.getTemplate().getVariables().put(yourVar, new 
Variable(Variable.TYPE_ALL));


best regards,
Thierry Boileau

 Hi,

 I've seen a couple of other discussion about this in the past, but 
 didn't know if there's been any progress.  Anyways, I've encountered a 
 java.lang.StackOverflowError when sending in a long attribute.  Here's 
 the warning I'm getting:

 Apr 8, 2008 10:59:58 AM org.restlet.util.Template match
 WARNING: StackOverflowError exception encountered while matching this 
 string :
 /result/c045d791-11b0-408e-8d60-b2f6ce6c117d,af3e28f4-2bdf-4b34-a74a-4
 8f6c638a9b8,b242e13a-7083-45d6-a4db-5961883690db,a315b9cb-743c-422e-bb
 1b-bedfa93957bd,ac399b7f-5a2a-4ddc-8a7b-d1106e1e28f4,ffe736ef-5dbf-420
 4-a69c-b1599e012b75,1b876179-e897-4eb9-a5ae-b124fd69cbcb,b1c5abc4-b69c
 -4d5a-85fe-b320adab8f29,44efad37-ed0a-4bf0-80c8-55a82dfe89d3,bd43c7c4-
 0949-40a3-998b-b6cf0d895cc9,45b046c1-a509-4835-a801-c5bca0855d49,8260a
 9fd-9773-4803-8218-2de29082ef7a,2acd118a-5721-4aee-afcc-a28b3dd8bcbd,8
 943d432-a147-4393-afbf-5de3bbfb3f28,3db028ad-4f8c-4355-a7ca-ac4af7a712
 be,d00faab9-0c2d-4b5b-84bf-810e375ec38f,c8780a2a-a7be-458e-a6ef-9f7392
 2b0ca7,16525506-0df4-453e-b930-d9fd46e08b72,a50839f2-e3b2-4604-86bf-64
 6af2ca048d,5383406a-c566-455b-8725-2c81aba82db0,ae3ceaa9-a495-4311-8e6
 5-4e83aa02b2ad,0cfc54f9-9852-451e-9856-a63689cbb4e3,2faaa074-b21c-4c40
 -a632-b5e8e84aa09a,ec4f38de-e0de-437e-9e3f-19db4576f177,185b9d55-237f-
 42b3-ba8a-bb005db09f2a,887ffc64-c190-439e-a9b2-261f55ea18e3,97683f00-1
 51e-4508-8b77-5d34d1048843,1cfde617-ad79-4f81-bc30-bf017ecb5636,c4551d
 09-b558-40a1-96ca-eea503d72815,2fa39dc8-d375-42a6-bc11-e8cf4a91ceb8,e2
 198d2c-86c8-49e2-95c3-b6e88901cd68,f32600d5-1f27-4a4c-ae87-25caf0d91bd
 d,5156d109-aa69-4cf6-813c-7682b55d139e,b360f697-af9f-4e1e-8aff-e3d2fd5
 10b0e,07f1db89-5b7f-4c9a-a177-003dffda8206,bc1103d2-7f0a-412e-9dc3-8c3
 11c66c16b,2cefe92b-92ce-430f-89ee-8f2713afff2b,85cf0fb2-06d6-4d86-9146
 -4e8c951682b7,7acbaa77-d6bf-4271-a6b9-965ba5b83637,6ed9b90b-a533-4925-
 9019-282f27c32f86,4447c1b8-7333-4be1-ad37-9a552aed8243,d1e0593e-c340-4
 526-bc61-e98b74e2796b

 I'm trying to call a GET at the result resource using a list of comma 
 delimited uuids.  When it gets to the match(String formattedString) 
 method and it calls getRegexPattern().match(formattedString) on the 
 string above, it produces a Matcher with this regex:
 /result/((?:[a-zA-Z0-9\\-\\.\\_\\~\\!\\$'\\(\\)\\*\\+\\,\\;\\=\\
 :[EMAIL PROTECTED]|(?:\\%[0-9ABCDEFabcdef][0-9ABCDEFabcdef]))+),
 and I get the stack overflow when matcher.lookingAt() is called.

 I've tried just matching on the above string with the regex 
 standalone, and it looks to be recursively calling pattern.match, and 
 causing the StackOverflowError.

 String s =
 /result/c045d791-11b0-408e-8d60-b2f6ce6c117d,af3e28f4-2bdf-4b34-a74a-
 48f6c638a9b8,b242e13a-7083-45d6-a4db-5961883690db,a315b9cb-743c-422e-b
 b1b-bedfa93957bd,ac399b7f-5a2a-4ddc-8a7b-d1106e1e28f4,ffe736ef-5dbf-42
 04-a69c-b1599e012b75,1b876179-e897-4eb9-a5ae-b124fd69cbcb,b1c5abc4-b69
 c-4d5a-85fe-b320adab8f29,44efad37-ed0a-4bf0-80c8-55a82dfe89d3,bd43c7c4
 -0949-40a3-998b-b6cf0d895cc9,45b046c1-a509-4835-a801-c5bca0855d49,8260
 a9fd-9773-4803-8218-2de29082ef7a,2acd118a-5721-4aee-afcc-a28b3dd8bcbd,
 8943d432-a147-4393-afbf-5de3bbfb3f28,3db028ad-4f8c-4355-a7ca-ac4af7a71
 2be,d00faab9-0c2d-4b5b-84bf-810e375ec38f,c8780a2a-a7be-458e-a6ef-9f739
 22b0ca7,16525506-0df4-453e-b930-d9fd46e08b72,a50839f2-e3b2-4604-86bf-6
 46af2ca048d,5383406a-c566-455b-8725-2c81aba82db0,ae3ceaa9-a495-4311-8e
 65-4e83aa02b2ad,0cfc54f9-9852-451e-9856-a63689cbb4e3,2faaa074-b21c-4c4
 0-a632-b5e8e84aa09a,ec4f38de-e0de-437e-9e3f-19db4576f177,185b9d55-237f
 -42b3-ba8a-bb005db09f2a,887ffc64-c190-439e-a9b2-261f55ea18e3,97683f00-
 151e-4508-8b77-5d34d1048843,1cfde617-ad79-4f81-bc30-bf017ecb5636,c4551
 d09-b558-40a1-96ca-eea503d72815,2fa39dc8-d375-42a6-bc11-e8cf4a91ceb8,e
 2198d2c-86c8-49e2-95c3-b6e88901cd68,f32600d5-1f27-4a4c-ae87-25caf0d91b
 dd,5156d109-aa69-4cf6-813c-7682b55d139e,b360f697-af9f-4e1e-8aff-e3d2fd
 510b0e,07f1db89-5b7f-4c9a-a177-003dffda8206,bc1103d2-7f0a-412e-9dc3-8c
 311c66c16b,2cefe92b-92ce-430f

Restlet 1.1 release date?

2008-04-09 Thread Bao,Sam
How far along is 1.1 to a stable release?

Sam

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.


StackOverFlow warning

2008-04-08 Thread Bao,Sam
Hi,

I've seen a couple of other discussion about this in the past, but didn't know 
if there's been any progress.  Anyways, I've encountered a 
java.lang.StackOverflowError when sending in a long attribute.  Here's the 
warning I'm getting:

Apr 8, 2008 10:59:58 AM org.restlet.util.Template match
WARNING: StackOverflowError exception encountered while matching this string : 
/result/c045d791-11b0-408e-8d60-b2f6ce6c117d,af3e28f4-2bdf-4b34-a74a-48f6c638a9b8,b242e13a-7083-45d6-a4db-5961883690db,a315b9cb-743c-422e-bb1b-bedfa93957bd,ac399b7f-5a2a-4ddc-8a7b-d1106e1e28f4,ffe736ef-5dbf-4204-a69c-b1599e012b75,1b876179-e897-4eb9-a5ae-b124fd69cbcb,b1c5abc4-b69c-4d5a-85fe-b320adab8f29,44efad37-ed0a-4bf0-80c8-55a82dfe89d3,bd43c7c4-0949-40a3-998b-b6cf0d895cc9,45b046c1-a509-4835-a801-c5bca0855d49,8260a9fd-9773-4803-8218-2de29082ef7a,2acd118a-5721-4aee-afcc-a28b3dd8bcbd,8943d432-a147-4393-afbf-5de3bbfb3f28,3db028ad-4f8c-4355-a7ca-ac4af7a712be,d00faab9-0c2d-4b5b-84bf-810e375ec38f,c8780a2a-a7be-458e-a6ef-9f73922b0ca7,16525506-0df4-453e-b930-d9fd46e08b72,a50839f2-e3b2-4604-86bf-646af2ca048d,5383406a-c566-455b-8725-2c81aba82db0,ae3ceaa9-a495-4311-8e65-4e83aa02b2ad,0cfc54f9-9852-451e-9856-a63689cbb4e3,2faaa074-b21c-4c40-a632-b5e8e84aa09a,ec4f38de-e0de-437e-9e3f-19db4576f177,185b9d55-237f-42b3-ba8a-bb005db09f2a,887ffc64-c190-439e-a9b2-261f55ea18e3,97683f00-151e-4508-8b77-5d34d1048843,1cfde617-ad79-4f81-bc30-bf017ecb5636,c4551d09-b558-40a1-96ca-eea503d72815,2fa39dc8-d375-42a6-bc11-e8cf4a91ceb8,e2198d2c-86c8-49e2-95c3-b6e88901cd68,f32600d5-1f27-4a4c-ae87-25caf0d91bdd,5156d109-aa69-4cf6-813c-7682b55d139e,b360f697-af9f-4e1e-8aff-e3d2fd510b0e,07f1db89-5b7f-4c9a-a177-003dffda8206,bc1103d2-7f0a-412e-9dc3-8c311c66c16b,2cefe92b-92ce-430f-89ee-8f2713afff2b,85cf0fb2-06d6-4d86-9146-4e8c951682b7,7acbaa77-d6bf-4271-a6b9-965ba5b83637,6ed9b90b-a533-4925-9019-282f27c32f86,4447c1b8-7333-4be1-ad37-9a552aed8243,d1e0593e-c340-4526-bc61-e98b74e2796b

I'm trying to call a GET at the result resource using a list of comma delimited 
uuids.  When it gets to the match(String formattedString) method and it calls 
getRegexPattern().match(formattedString) on the string above, it produces a 
Matcher with this regex: 
/result/((?:[a-zA-Z0-9\\-\\.\\_\\~\\!\\$'\\(\\)\\*\\+\\,\\;\\=\\:[EMAIL 
PROTECTED]|(?:\\%[0-9ABCDEFabcdef][0-9ABCDEFabcdef]))+), and I get the stack 
overflow when matcher.lookingAt() is called.

I've tried just matching on the above string with the regex standalone, and it 
looks to be recursively calling pattern.match, and causing the 
StackOverflowError.

String s = 
/result/c045d791-11b0-408e-8d60-b2f6ce6c117d,af3e28f4-2bdf-4b34-a74a-48f6c638a9b8,b242e13a-7083-45d6-a4db-5961883690db,a315b9cb-743c-422e-bb1b-bedfa93957bd,ac399b7f-5a2a-4ddc-8a7b-d1106e1e28f4,ffe736ef-5dbf-4204-a69c-b1599e012b75,1b876179-e897-4eb9-a5ae-b124fd69cbcb,b1c5abc4-b69c-4d5a-85fe-b320adab8f29,44efad37-ed0a-4bf0-80c8-55a82dfe89d3,bd43c7c4-0949-40a3-998b-b6cf0d895cc9,45b046c1-a509-4835-a801-c5bca0855d49,8260a9fd-9773-4803-8218-2de29082ef7a,2acd118a-5721-4aee-afcc-a28b3dd8bcbd,8943d432-a147-4393-afbf-5de3bbfb3f28,3db028ad-4f8c-4355-a7ca-ac4af7a712be,d00faab9-0c2d-4b5b-84bf-810e375ec38f,c8780a2a-a7be-458e-a6ef-9f73922b0ca7,16525506-0df4-453e-b930-d9fd46e08b72,a50839f2-e3b2-4604-86bf-646af2ca048d,5383406a-c566-455b-8725-2c81aba82db0,ae3ceaa9-a495-4311-8e65-4e83aa02b2ad,0cfc54f9-9852-451e-9856-a63689cbb4e3,2faaa074-b21c-4c40-a632-b5e8e84aa09a,ec4f38de-e0de-437e-9e3f-19db4576f177,185b9d55-237f-42b3-ba8a-bb005db09f2a,887ffc64-c190-439e-a9b2-261f55ea18e3,97683f00-151e-4508-8b77-5d34d1048843,1cfde617-ad79-4f81-bc30-bf017ecb5636,c4551d09-b558-40a1-96ca-eea503d72815,2fa39dc8-d375-42a6-bc11-e8cf4a91ceb8,e2198d2c-86c8-49e2-95c3-b6e88901cd68,f32600d5-1f27-4a4c-ae87-25caf0d91bdd,5156d109-aa69-4cf6-813c-7682b55d139e,b360f697-af9f-4e1e-8aff-e3d2fd510b0e,07f1db89-5b7f-4c9a-a177-003dffda8206,bc1103d2-7f0a-412e-9dc3-8c311c66c16b,2cefe92b-92ce-430f-89ee-8f2713afff2b,85cf0fb2-06d6-4d86-9146-4e8c951682b7,7acbaa77-d6bf-4271-a6b9-965ba5b83637,6ed9b90b-a533-4925-9019-282f27c32f86,4447c1b8-7333-4be1-ad37-9a552aed8243,d1e0593e-c340-4526-bc61-e98b74e2796b;
Pattern p = 
Pattern.compile(/result/((?:[a-zA-Z0-9\\-\\.\\_\\~\\!\\$'\\(\\)\\*\\+\\,\\;\\=\\:[EMAIL
 PROTECTED]|(?:\\%[0-9ABCDEFabcdef][0-9ABCDEFabcdef]))+));
Matcher m = p.matcher(s);
m.matches();
m.lookingAt();

Due to this problem, we're having to hack a solution of using the POST method 
for doing gets (as well as deletes) when operating on a large batch.  This 
works, but still a hack for what I presume to be a poorly generated regex 
that's preventing us for truly using a GET to do a get and a DELETE to do 
deletes.  I just wanted to bring this to people's attention, and to probe for 
any answers.  Has there been any fix for this, or will there be a fix for this 
in the future?  Thanks.

Sam

--
CONFIDENTIALITY NOTICE This message and any included attachments

RE: Re: StackOverFlow warning

2008-04-08 Thread Bao,Sam
Ah, that seems to get through all the template stuff, and at that point, I can 
indeed extract the attributes myself.  I agree it's a roundabout way to do it 
instead of using the router functionality, but no more hackish than using the 
post to do a get.  I'll keep going down this path and see what happens.  thanks.
 

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] mailto:[EMAIL PROTECTED]  | www.cerner.com 
http://www.cerner.com/  

 



From: William Pietri [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 08, 2008 6:15 PM
To: discuss@restlet.tigris.org
Subject: Re: StackOverFlow warning


Bao,Sam wrote: 

I'm sorry, but I don't set up the template at all.  Is that where I'm 
going wrong?  Should I be setting a template?
 
I'm just using createRoot() to init the router, and register my 
resource as such:
 
public synchronized Restlet createRoot()

{

Router router = new Router(getContext());

router.attach(/result, ResultResource.class);

router.attach(/result/{id}, ResultResource.class);

router.attach(/result?{method}, ResultResource.class);


I'm no expert, but have you tried removing  the {id} and {method} bits, and 
just parsing the URL yourself instead of using Router to extract the 
attributes? From my hazy memory of the routing stuff, that might work better 
for you, and would be less of a distortion to your app design until this bug is 
fixed.

I do agree that it's a bug, though; a 1500-character URL is big, but not 
unreasonably so.

William

--
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.