@Get annotation not being detected under a particular circumstance

2010-05-13 Thread kevinpauli
I've created an interface to mark all Resources that are gettable as html:

public interface GettableAsHtml {

  @Get(html)
  Representation getAsHtml();
}

For concrete Resource classes that implement this method, the annotation is
detected and it works great.

However, I've created an abstract base for all my freemarker resources that
centralizes handling of freemarker and puts in some common templates like
headers, footers, etc, and that implements my interface:

public abstract class FreemarkerResource extends ServerResource implements
GettableAsHtml {
  @Override
  public Representation getAsHtml() {
...
String templateName = getTemplateName();
...
  }
  protected abstract String getTemplateName();
}

This superclass then delegates the choice of which template to instantiate
to concrete subclasses.  I consider it a nice design, however it seems that
concrete sublcasses of this class are not having the annotation discovered
by the AnnotationUitls.

An example is my home page resource:

public class HomeResource extends FreemarkerResource {
  @Override
  protected String getTemplateName() {
return home.ftl;
  }
}

I stepped through the code, and AnnotationUtils at line 202 is looking for
interfaces that are directly implemented by this class, but NOT recursively
looking at interfaces imlemented by superclasses. 

I am working around the issue by having HomeResource redundantly declare
that it implements the GettableAsHtml interface:

public class HomeResource extends FreemarkerResource implements
GettableAsHtml {

Thankfully the compiler is smart enough to realize that getAsHtml() is
already implemented in a superclass, so it doesn't require me to reimplement
it with a call to super.getAsHtml().  That would have been ugly.

Despite the fairly innocuous workaround available, I think this behavior
should be considered a bug.  Seems to me that a concrete subclass should
have annotations discovered that are declared on interfaces implemented by
its superclass, since the instance of the sublcass  is-a instance of the
superclass too.
-- 
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Get-annotation-not-being-detected-under-a-particular-circumstance-tp5046433p5046433.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Bug in Atom extension Readers

2010-05-13 Thread Martin Svensson
Hi, I am using both the FeedContentReader and EntryContentReader. When inline 
content is detected the type will never be set, hence setting it to text.

Code snippet
..
else if (localName.equalsIgnoreCase(content)) {
if (this.state == State.FEED_ENTRY_CONTENT) {
if (!this.currentEntry.getContent().isExternal()) {
String content = this.currentContentWriter.getWriter()
.toString().trim();
contentDepth = -1;
if (.equals(content)) {
this.currentEntry.setContent(null);
} else {
currentContent
.setInlineContent(new StringRepresentation(
content));
}
}

this.state = State.FEED_ENTRY;
}

I guess the SringRepresentation needs to be set with correct content type as 
well.

Thanks,

martin

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


Re: Spring configuration and MatchingMode for the router

2010-05-13 Thread Rhett Sutphin
Hi Jean-Christophe,

On May 10, 2010, at 6:22 PM, Jean-Christophe Malapert wrote:

 Hello,
 
 I am new in Spring configuration. I managed to configure my whole application 
 using Spring. Nevertheless, I do not know how to set the equivalent of  
 setMatchingMode(Template.MODE_STARTS_WITH) in Spring configuration. 
 In other words, what is the equivalent of the following code in Spring 
 configuration ? 
router.attach(/search/, new 
 RedirectorFtp(getContext(),ftp://193.190.231.123/,6)).setMatchingMode(Template.MODE_STARTS_WITH);
 
 Could you help me please ?

This isn't supported.  If you need fine-grained control over your routes, 
please configure them in code.

If this is a feature you'd like to add to Restlet, feel free to submit a patch.

Rhett

 
 J-Christophe

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


Re: Amazon S3 Auth

2010-05-13 Thread Jean-Philippe Steinmetz
During our conversion to Restlet 2.0 i've gone ahead and implemented a
SecretVerifier to be used for server side AWS authentication. I've
abstracted out the common functionality into a utility class so that both
the current HttpAwsS3Helper and my verifier can ensure consistency. The
utility class is lifted from a submission I made to Apache's HTTPClient
project (https://issues.apache.org/jira/browse/HTTPCLIENT-926) not so long
ago but with changes made to conform to restlet's API. I took it over the
existing functionality in restlet as it is a more complete implementation of
Amazon's spec.

Now that I have all the pieces i'm ready to plug it in for testing and
ultimately submission to the project. I've been digging around a lot but am
so far unable the location where the correct verifier is
selected/instantiated for a given ChallengeScheme. Can you point me in the
right direction? Ultimately it would be great if it just worked. Any help
on plugging this is would be greatly appreciated.

On Sun, May 9, 2010 at 2:39 AM, Thierry Boileau thierry.boil...@noelios.com
 wrote:

  Hello Jean-Philippe,

 unfortunately the server side has been implemented for the moment.

 Best regards,
 Thierry Boileau


 Hi,

 I'm using Amazon S3 authentication in my web application. I'm looking to
 moving to restlet 2.0 from 1.1 and was wondering if there is finally a
 server side implementation of the authentication protocol?

 Jean-Philippe Steinmetz



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

client-side parsing of XML in GWT

2010-05-13 Thread allan clarke
Greetings! I am new to Restlet and am trying to figure out what options are 
available to me for parsing XML I received from a server. The server is written 
in another technology and I have no control over the format of the XML. 

How are people mapping XML to POJO's on the client? I am aware of Piriti. I 
know there is a transparent mapping in Restlet 2.0, but it assumes you have 
control over both client and server.

I really dred having to work with the DOM representation and manually mapping 
values.

Any pointers would be greatly appreciated.

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