You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "kirys.it" <ki...@neoteroi.org> on 2015/05/17 19:04:58 UTC

JSF and Jax-rs ->welcome-file ingored

Hi all
I'm studing jee using tomee (plume) as engine.
Everything worked fine till I've tried some rest experiments, since the 
insert of the rest ejb some how jaxrs seems to have priority over the 
rest ignoring the welcome-file that point to the home facelet.

resulting in

WARNING: No root resource matching request path /testHome/ has been 
found, Relative Path: /. Please enable FINE/TRACE log level for more 
details.
May 17, 2015 6:53:59 PM 
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: javax.ws.rs.WebApplicationException

Can you help me
Thank You
K.

The ejb is:


package it.kirys.test.home.controller;

import it.kirys.test.home.charts.ChartData;
import it.kirys.test.home.charts.DataSet;
import it.kirys.test.home.dao.TelefonateDAO;
import it.kirys.test.home.telefono.SommarioTelefonate;
import java.math.BigDecimal;
import java.util.Collection;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jooq.Record2;
import org.jooq.Record3;
import org.jooq.Result;


@Stateless
@LocalBean
@Path("/rest/telefono")
public class TelefonateRest {


     @GET
     @Produces(MediaType.APPLICATION_JSON)
     @Path("/test")
     public int test() {
         return 0;
     }



}


Web xml is:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
     http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
     id="testHome" version="3.0">

     <display-name>test Home</display-name>

     <distributable/>

     <listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
     </listener>

     <filter>
         <filter-name>shiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
     </filter>
     <filter-mapping>
         <filter-name>shiroFilter</filter-name>
         <url-pattern>/*</url-pattern>
         <dispatcher>REQUEST</dispatcher>
         <dispatcher>FORWARD</dispatcher>
         <dispatcher>INCLUDE</dispatcher>
         <dispatcher>ERROR</dispatcher>
     </filter-mapping>

     <context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
         <param-value>Development</param-value>
     </context-param>


     <context-param>
         <param-name>BootsFaces_USETHEME</param-name>
         <param-value>true</param-value>
     </context-param>

     <servlet>
         <servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
         <load-on-startup>1</load-on-startup>
     </servlet>


     <servlet-mapping>
         <servlet-name>Faces Servlet</servlet-name>
         <url-pattern>/a/*</url-pattern>
         <url-pattern>*.xhtml</url-pattern>
<url-pattern>/javax.faces.resource/*</url-pattern>
     </servlet-mapping>

     <welcome-file-list>
         <welcome-file>a/index.xhtml</welcome-file>
     </welcome-file-list>

</web-app>


Re: JSF and Jax-rs ->welcome-file ingored

Posted by Romain Manni-Bucau <rm...@gmail.com>.
@AppPath = jaxrs servlet mapping


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-18 21:02 GMT+02:00 kirys.it <ki...@neoteroi.org>:

> On 05/18/2015 07:23 PM, Romain Manni-Bucau wrote:
>
>> For the same endpoint no, both are servlets
>>
>>  But once the application is created with a different base path is it ok?
>
> The only code i added is this class:
>
> import javax.ws.rs.ApplicationPath;
> import javax.ws.rs.core.Application;
>
> @ApplicationPath("/rest")
> public class WebApp extends Application {
>     //yes it is empty....
> }
>
> and it seems to work (It is just a demo app so non sure if there are
> issues that simply do not show yet)
>
> Is this correct or I should do a more explicit setup (like declaring it
> into the web.xml or more)?
> It just seems too easy!
> Bye
> K.
>

Re: JSF and Jax-rs ->welcome-file ingored

Posted by "kirys.it" <ki...@neoteroi.org>.
On 05/18/2015 07:23 PM, Romain Manni-Bucau wrote:
> For the same endpoint no, both are servlets
>
But once the application is created with a different base path is it ok?

The only code i added is this class:

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("/rest")
public class WebApp extends Application {
     //yes it is empty....
}

and it seems to work (It is just a demo app so non sure if there are 
issues that simply do not show yet)

Is this correct or I should do a more explicit setup (like declaring it 
into the web.xml or more)?
It just seems too easy!
Bye
K.

Re: JSF and Jax-rs ->welcome-file ingored

Posted by Romain Manni-Bucau <rm...@gmail.com>.
For the same endpoint no, both are servlets
Le 18 mai 2015 19:18, "Kirys" <ki...@neoteroi.org> a écrit :

> So is not standard to have both jsf and jax?
> On 18 May 2015 18:53, "Romain Manni-Bucau" <rm...@gmail.com> wrote:
>
> > cause it still matches the jaxrs servlet ;)
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-05-18 18:35 GMT+02:00 Kirys <ki...@neoteroi.org>:
> >
> > > Ok got it
> > > I've used the application way. And it works as expected :)  thank you.
> > > But the only fishy thing is that no 404 page is shown when the path has
> > no
> > > processor,  not sure if this is correct.
> > > Bye
> > > K.
> > >  On 18 May 2015 08:28, "Romain Manni-Bucau" <rm...@gmail.com>
> > wrote:
> > >
> > > > Le 18 mai 2015 07:47, "Kirys" <ki...@neoteroi.org> a écrit :
> > > > >
> > > > > On 17 May 2015 19:45, "Romain Manni-Bucau" <rm...@gmail.com>
> > > > wrote:
> > > > > >
> > > > > > Hi
> > > > > >
> > > > > > This is "fixed" on coming version but good way to solve it is to
> > > bind
> > > > > > jaxrs endpoints to a subpath. See @ApplicationPath
> > > > >
> > > > > I'll look at it
> > > > > Is the fix going to a minor release, or into 2.0?
> > > >
> > > > Both but once again this is not a standard feature so not sure you
> want
> > > to
> > > > rely on it.
> > > >
> > > > > Thank you
> > > > > K.
> > > >
> > >
> >
>

Re: JSF and Jax-rs ->welcome-file ingored

Posted by Kirys <ki...@neoteroi.org>.
So is not standard to have both jsf and jax?
On 18 May 2015 18:53, "Romain Manni-Bucau" <rm...@gmail.com> wrote:

> cause it still matches the jaxrs servlet ;)
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-05-18 18:35 GMT+02:00 Kirys <ki...@neoteroi.org>:
>
> > Ok got it
> > I've used the application way. And it works as expected :)  thank you.
> > But the only fishy thing is that no 404 page is shown when the path has
> no
> > processor,  not sure if this is correct.
> > Bye
> > K.
> >  On 18 May 2015 08:28, "Romain Manni-Bucau" <rm...@gmail.com>
> wrote:
> >
> > > Le 18 mai 2015 07:47, "Kirys" <ki...@neoteroi.org> a écrit :
> > > >
> > > > On 17 May 2015 19:45, "Romain Manni-Bucau" <rm...@gmail.com>
> > > wrote:
> > > > >
> > > > > Hi
> > > > >
> > > > > This is "fixed" on coming version but good way to solve it is to
> > bind
> > > > > jaxrs endpoints to a subpath. See @ApplicationPath
> > > >
> > > > I'll look at it
> > > > Is the fix going to a minor release, or into 2.0?
> > >
> > > Both but once again this is not a standard feature so not sure you want
> > to
> > > rely on it.
> > >
> > > > Thank you
> > > > K.
> > >
> >
>

Re: JSF and Jax-rs ->welcome-file ingored

Posted by Romain Manni-Bucau <rm...@gmail.com>.
cause it still matches the jaxrs servlet ;)


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-18 18:35 GMT+02:00 Kirys <ki...@neoteroi.org>:

> Ok got it
> I've used the application way. And it works as expected :)  thank you.
> But the only fishy thing is that no 404 page is shown when the path has no
> processor,  not sure if this is correct.
> Bye
> K.
>  On 18 May 2015 08:28, "Romain Manni-Bucau" <rm...@gmail.com> wrote:
>
> > Le 18 mai 2015 07:47, "Kirys" <ki...@neoteroi.org> a écrit :
> > >
> > > On 17 May 2015 19:45, "Romain Manni-Bucau" <rm...@gmail.com>
> > wrote:
> > > >
> > > > Hi
> > > >
> > > > This is "fixed" on coming version but good way to solve it is to
> bind
> > > > jaxrs endpoints to a subpath. See @ApplicationPath
> > >
> > > I'll look at it
> > > Is the fix going to a minor release, or into 2.0?
> >
> > Both but once again this is not a standard feature so not sure you want
> to
> > rely on it.
> >
> > > Thank you
> > > K.
> >
>

Re: JSF and Jax-rs ->welcome-file ingored

Posted by Kirys <ki...@neoteroi.org>.
Ok got it
I've used the application way. And it works as expected :)  thank you.
But the only fishy thing is that no 404 page is shown when the path has no
processor,  not sure if this is correct.
Bye
K.
 On 18 May 2015 08:28, "Romain Manni-Bucau" <rm...@gmail.com> wrote:

> Le 18 mai 2015 07:47, "Kirys" <ki...@neoteroi.org> a écrit :
> >
> > On 17 May 2015 19:45, "Romain Manni-Bucau" <rm...@gmail.com>
> wrote:
> > >
> > > Hi
> > >
> > > This is "fixed" on coming version but good way to solve it is to  bind
> > > jaxrs endpoints to a subpath. See @ApplicationPath
> >
> > I'll look at it
> > Is the fix going to a minor release, or into 2.0?
>
> Both but once again this is not a standard feature so not sure you want to
> rely on it.
>
> > Thank you
> > K.
>

Re: JSF and Jax-rs ->welcome-file ingored

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 18 mai 2015 07:47, "Kirys" <ki...@neoteroi.org> a écrit :
>
> On 17 May 2015 19:45, "Romain Manni-Bucau" <rm...@gmail.com> wrote:
> >
> > Hi
> >
> > This is "fixed" on coming version but good way to solve it is to  bind
> > jaxrs endpoints to a subpath. See @ApplicationPath
>
> I'll look at it
> Is the fix going to a minor release, or into 2.0?

Both but once again this is not a standard feature so not sure you want to
rely on it.

> Thank you
> K.

Re: JSF and Jax-rs ->welcome-file ingored

Posted by Kirys <ki...@neoteroi.org>.
On 17 May 2015 19:45, "Romain Manni-Bucau" <rm...@gmail.com> wrote:
>
> Hi
>
> This is "fixed" on coming version but good way to solve it is to  bind
> jaxrs endpoints to a subpath. See @ApplicationPath

I'll look at it
Is the fix going to a minor release, or into 2.0?
Thank you
K.

Re: JSF and Jax-rs ->welcome-file ingored

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

This is "fixed" on coming version but good way to solve it is to  bind
jaxrs endpoints to a subpath. See @ApplicationPath
Le 17 mai 2015 19:05, "kirys.it" <ki...@neoteroi.org> a écrit :

> Hi all
> I'm studing jee using tomee (plume) as engine.
> Everything worked fine till I've tried some rest experiments, since the
> insert of the rest ejb some how jaxrs seems to have priority over the rest
> ignoring the welcome-file that point to the home facelet.
>
> resulting in
>
> WARNING: No root resource matching request path /testHome/ has been found,
> Relative Path: /. Please enable FINE/TRACE log level for more details.
> May 17, 2015 6:53:59 PM
> org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
> WARNING: javax.ws.rs.WebApplicationException
>
> Can you help me
> Thank You
> K.
>
> The ejb is:
>
>
> package it.kirys.test.home.controller;
>
> import it.kirys.test.home.charts.ChartData;
> import it.kirys.test.home.charts.DataSet;
> import it.kirys.test.home.dao.TelefonateDAO;
> import it.kirys.test.home.telefono.SommarioTelefonate;
> import java.math.BigDecimal;
> import java.util.Collection;
> import javax.ejb.LocalBean;
> import javax.ejb.Stateless;
> import javax.inject.Inject;
> import javax.ws.rs.ApplicationPath;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> import javax.ws.rs.core.MediaType;
> import org.jooq.Record2;
> import org.jooq.Record3;
> import org.jooq.Result;
>
>
> @Stateless
> @LocalBean
> @Path("/rest/telefono")
> public class TelefonateRest {
>
>
>     @GET
>     @Produces(MediaType.APPLICATION_JSON)
>     @Path("/test")
>     public int test() {
>         return 0;
>     }
>
>
>
> }
>
>
> Web xml is:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns="http://java.sun.com/xml/ns/javaee"
>     xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>     http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>     id="testHome" version="3.0">
>
>     <display-name>test Home</display-name>
>
>     <distributable/>
>
>     <listener>
>
> <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
>     </listener>
>
>     <filter>
>         <filter-name>shiroFilter</filter-name>
> <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
>     </filter>
>     <filter-mapping>
>         <filter-name>shiroFilter</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>         <dispatcher>INCLUDE</dispatcher>
>         <dispatcher>ERROR</dispatcher>
>     </filter-mapping>
>
>     <context-param>
> <param-name>javax.faces.PROJECT_STAGE</param-name>
>         <param-value>Development</param-value>
>     </context-param>
>
>
>     <context-param>
>         <param-name>BootsFaces_USETHEME</param-name>
>         <param-value>true</param-value>
>     </context-param>
>
>     <servlet>
>         <servlet-name>Faces Servlet</servlet-name>
> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>
>
>     <servlet-mapping>
>         <servlet-name>Faces Servlet</servlet-name>
>         <url-pattern>/a/*</url-pattern>
>         <url-pattern>*.xhtml</url-pattern>
> <url-pattern>/javax.faces.resource/*</url-pattern>
>     </servlet-mapping>
>
>     <welcome-file-list>
>         <welcome-file>a/index.xhtml</welcome-file>
>     </welcome-file-list>
>
> </web-app>
>
>