Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCarlos Vallejo
11,821 PointsWhy my REST service redirect to login page?
Hi Team
I creating a web application using JSF framework, now i am developing some REST services with JAX-RS in order to be consume by android app, my issue is that when I want to consume my web service putting the URL, it redirects to login page, So i have to sign in and then I can consume my service, Why this happen? As I know JSF and JAX-RS works in servlet separated. Below is my web.xml.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<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>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>loginpage.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>primefaces.FONT_AWESOME</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>admin-1.0.0-RC11</param-value>
</context-param>
<servlet>
<servlet-name>My JAX-RS Resource</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>co.com.fourbits.modules.partners.services, com.fasterxml.jackson.jaxrs.json, co.com.fourbits.modules.users.services</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>My JAX-RS Resource</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
</web-app>