On Apr 28, 2009, at 11:17 AM, James Strachan wrote:
> 2009/4/28 Nabil Benothman <nabil.benothman_at_gmail.com>:
>>
>> Hello everyone,
>> I am starting with the framework jersey and I have a little problem
>> with the
>> explicit MVC. To use facelets (. xhtml), I had to go through a jsp
>> in which
>> I forward to the JSF. So my question is: « is there another
>> alternative to
>> do so without having to go through the jsp » ie instead of
>> returning « new
>> Viewable (" index.jsp ", entity);» we return directly «new
>> Viewable ("
>> index.jsf ", entity)».
>> the code is as follows :
>>
>> // resource
>> ....
>> @GET
>> @Produces(MediaType.TEXT_HTML)
>> public Viewable get() {
>> EntityManager em =
>> PersistenceService.getInstance().getEntityManager();
>>
>> Collection<UbikeUser> users = (Collection<UbikeUser>)
>> em.createNamedQuery(
>> "user.getAll").getResultList();
>>
>> return new Viewable("/usersInfo.jsp", users);
>
> You could probably write a JSFTemplateProcessor (see the source of
> JSPTemplateProcessor in jersey-server) and then change the above code
> to
>
> return new Viewable("/usersInfo.jsf", users);
>
> I've not used JSF so not sure if there's any gotchas though; but I'd
> have thought it should work?
>
See here for the code:
http://fisheye4.atlassian.com/browse/~raw,r=2281/jersey/trunk/jersey/
jersey-server/src/main/java/com/sun/jersey/server/impl/container/
servlet/JSPTemplateProcessor.java
If there exists a "index.jsf" file resolved according to the matching
resource then the JSP template processor should further resolve it,
see the following for the resolving code of JSPTemplateProcessor:
try {
if (servletContext.getResource(path) != null) {
return path;
}
if (!path.endsWith(".jsp")) {
path = path + ".jsp";
if (servletContext.getResource(path) != null) {
return path;
}
}
} catch (MalformedURLException ex) {
// TODO log
}
Where do the *.jsf files reside?
Paul.