JBoss Version: 4.2.3GA. This works in apache tomcat 6.0. In JBoss, I had to add the following setting: -Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false
to
After getting some help from another location, I realized that I was connecting my JSP and restlet in a funny way, and what I really wanted to do was use a Viewable. This also works way better in JBoss. Here is a summary of what I ended up with:
import javax.ws.rs.core.Context;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import com.sun.jersey.api.view.Viewable;
@GET
@Path("/index")
public Viewable index(
@Context HttpServletRequest request,
@Context HttpServletResponse response) throws Exception
{
request.setAttribute("key", "value");
return new Viewable("/jsps/someJsp.jsp", null);
}
If you are not using Jersey, you may want to do this:
@Path("")
@ApplicationPath("blog")
@Stateless
public class BlogApplication extends Application {
@EJB private PostEJB postEJB;
@GET
public void getHome(@Context HttpServletRequest request,
@Context HttpServletResponse response) {
request.setAttribute("posts", postEJB.getPosts());
request.getRequestDispatcher("/WEB-INF/pages/blog/home.jsp")
.forward(request, response);
}
@Override
public Set<Class<?>> getClasses() {
return new HashSet<Class<?>>(Arrays.asList(BlogApplication.class));
}
}