Search in sources :

Example 6 with FacesServlet

use of jakarta.faces.webapp.FacesServlet in project mojarra by eclipse-ee4j.

the class FacesServletTestCase method testNegativeInitWithContextParamsOfWildcardHttpMethods.

public void testNegativeInitWithContextParamsOfWildcardHttpMethods() throws Exception {
    FacesServlet me = new FacesServlet();
    servletContext.addInitParameter(ALLOWED_HTTP_METHODS_ATTR_COPY, "* * * *");
    me.init(config);
    this.sendRequest(me, "OPTIONS");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "GET");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "HEAD");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "POST");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "PUT");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "DELETE");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "TRACE");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "CONNECT");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "BOO_YA");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
}
Also used : FacesServlet(jakarta.faces.webapp.FacesServlet)

Example 7 with FacesServlet

use of jakarta.faces.webapp.FacesServlet in project mojarra by eclipse-ee4j.

the class FacesInitializer method handleMappingConcerns.

private static void handleMappingConcerns(ServletContext servletContext) throws ServletException {
    ServletRegistration existingFacesServletRegistration = getExistingFacesServletRegistration(servletContext);
    if (existingFacesServletRegistration != null) {
        // FacesServlet has already been defined, so we're not going to add additional mappings.
        servletContext.setAttribute(FACES_SERVLET_REGISTRATION, existingFacesServletRegistration);
        return;
    }
    ServletRegistration newFacesServletRegistration = servletContext.addServlet(FacesServlet.class.getSimpleName(), FACES_SERVLET_CLASS_NAME);
    if (parseBoolean(servletContext.getInitParameter(FacesServlet.DISABLE_FACESSERVLET_TO_XHTML_PARAM_NAME))) {
        newFacesServletRegistration.addMapping(FACES_SERVLET_MAPPINGS_WITHOUT_XHTML);
    } else {
        newFacesServletRegistration.addMapping(FACES_SERVLET_MAPPINGS_WITH_XHTML);
    }
    servletContext.setAttribute(FACES_SERVLET_MAPPINGS, newFacesServletRegistration.getMappings());
    servletContext.setAttribute(FACES_SERVLET_REGISTRATION, newFacesServletRegistration);
}
Also used : ServletRegistration(jakarta.servlet.ServletRegistration) FacesServlet(jakarta.faces.webapp.FacesServlet)

Example 8 with FacesServlet

use of jakarta.faces.webapp.FacesServlet in project mojarra by eclipse-ee4j.

the class FacesServletTestCase method testPositiveInitWithContextParamsOfKnownHttpMethods.

public void testPositiveInitWithContextParamsOfKnownHttpMethods() throws Exception {
    FacesServlet me = new FacesServlet();
    servletContext.addInitParameter(ALLOWED_HTTP_METHODS_ATTR_COPY, "GET   POST");
    me.init(config);
    this.sendRequest(me, "OPTIONS");
    assertEquals(HttpServletResponse.SC_BAD_REQUEST, response.getStatus());
    this.sendRequest(me, "GET");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "HEAD");
    assertEquals(HttpServletResponse.SC_BAD_REQUEST, response.getStatus());
    this.sendRequest(me, "POST");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "PUT");
    assertEquals(HttpServletResponse.SC_BAD_REQUEST, response.getStatus());
    this.sendRequest(me, "DELETE");
    assertEquals(HttpServletResponse.SC_BAD_REQUEST, response.getStatus());
    this.sendRequest(me, "TRACE");
    assertEquals(HttpServletResponse.SC_BAD_REQUEST, response.getStatus());
    this.sendRequest(me, "CONNECT");
    assertEquals(HttpServletResponse.SC_BAD_REQUEST, response.getStatus());
}
Also used : FacesServlet(jakarta.faces.webapp.FacesServlet)

Example 9 with FacesServlet

use of jakarta.faces.webapp.FacesServlet in project mojarra by eclipse-ee4j.

the class FacesServletTestCase method testPositiveInitWithContextParamsOfWildcardHttpMethods.

public void testPositiveInitWithContextParamsOfWildcardHttpMethods() throws Exception {
    FacesServlet me = new FacesServlet();
    servletContext.addInitParameter(ALLOWED_HTTP_METHODS_ATTR_COPY, "*");
    me.init(config);
    this.sendRequest(me, "OPTIONS");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "GET");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "HEAD");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "POST");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "PUT");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "DELETE");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "TRACE");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "CONNECT");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    this.sendRequest(me, "BOO_YA");
    assertEquals(HttpServletResponse.SC_OK, response.getStatus());
}
Also used : FacesServlet(jakarta.faces.webapp.FacesServlet)

Aggregations

FacesServlet (jakarta.faces.webapp.FacesServlet)9 ProjectStage (jakarta.faces.application.ProjectStage)2 FacesContext (jakarta.faces.context.FacesContext)2 IOException (java.io.IOException)2 List (java.util.List)2 MyFacesContainerInitializer (org.apache.myfaces.webapp.MyFacesContainerInitializer)2 StartupServletContextListener (org.apache.myfaces.webapp.StartupServletContextListener)2 StringUtil (com.ibm.commons.util.StringUtil)1 NotesAPIException (com.ibm.designer.domino.napi.NotesAPIException)1 ComponentModule (com.ibm.designer.runtime.domino.adapter.ComponentModule)1 XSPErrorPage (com.ibm.designer.runtime.domino.adapter.util.XSPErrorPage)1 NSFComponentModule (com.ibm.domino.xsp.module.nsf.NSFComponentModule)1 NotesContext (com.ibm.domino.xsp.module.nsf.NotesContext)1 AdditionalBeanBuildItem (io.quarkus.arc.deployment.AdditionalBeanBuildItem)1 BeanDefiningAnnotationBuildItem (io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem)1 BeanRegistrarBuildItem (io.quarkus.arc.deployment.BeanRegistrarBuildItem)1 BeanRegistrationPhaseBuildItem (io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem)1 ContextRegistrarBuildItem (io.quarkus.arc.deployment.ContextRegistrarBuildItem)1 BuildProducer (io.quarkus.deployment.annotations.BuildProducer)1 BuildStep (io.quarkus.deployment.annotations.BuildStep)1