Package org.jboss.resteasy.spi

Examples of org.jboss.resteasy.spi.DefaultOptionsMethodException


            }

            if (httpMethod.equals("OPTIONS"))
            {
               Response res = Response.ok().header(HttpHeaderNames.ALLOW, allowHeaderValue).build();
               throw new DefaultOptionsMethodException("No resource method found for options, return OK with Allow header", res);
            }
            else
            {
               Response res = Response.status(HttpResponseCodes.SC_METHOD_NOT_ALLOWED).header(HttpHeaderNames.ALLOW, allowHeaderValue).build();
               throw new MethodNotAllowedException("No resource method found for " + httpMethod + ", return 405 with Allow header", res);
View Full Code Here


            }

            if (httpMethod.equals("OPTIONS"))
            {
               Response res = Response.ok().header(HttpHeaderNames.ALLOW, allowHeaderValue).build();
               throw new DefaultOptionsMethodException("No resource method found for options, return OK with Allow header", res);
            }
            else
            {
               Response res = Response.status(HttpResponseCodes.SC_METHOD_NOT_ALLOWED).header(HttpHeaderNames.ALLOW, allowHeaderValue).build();
               throw new MethodNotAllowedException("No resource method found for " + httpMethod + ", return 405 with Allow header", res);
View Full Code Here

    @Test
    public void defaultOptionsException() {
        Response forex = mock(Response.class);
        when(req.getHeader(HttpHeaderNames.ACCEPT)).thenReturn("application/json");

        Response r = rem.toResponse(new DefaultOptionsMethodException("", forex));
        assertEquals(forex, r);
    }
View Full Code Here

            }

            if (httpMethod.equals("OPTIONS"))
            {
               Response res = Response.ok(allowHeaderValue,  MediaType.TEXT_PLAIN_TYPE).header(HttpHeaderNames.ALLOW, allowHeaderValue).build();
               throw new DefaultOptionsMethodException("No resource method found for options, return OK with Allow header", res);
            }
            else
            {
               Response res = Response.status(HttpResponseCodes.SC_METHOD_NOT_ALLOWED).header(HttpHeaderNames.ALLOW, allowHeaderValue).build();
               throw new NotAllowedException("No resource method found for " + httpMethod + ", return 405 with Allow header", res);
View Full Code Here

    @Test
    public void exceptionWithResponse() {
        Response mockr = mock(Response.class);
        when(mockr.getStatus()).thenReturn(500);
        DefaultOptionsMethodException dome =
            new DefaultOptionsMethodException("oops", mockr);
        DefaultOptionsMethodExceptionMapper domem =
            injector.getInstance(DefaultOptionsMethodExceptionMapper.class);
        Response r = domem.toResponse(dome);
        assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus());
        assertEquals(mockr, r);
        assertEquals("oops", dome.getMessage());
    }
View Full Code Here

        assertEquals("oops", dome.getMessage());
    }

    @Test
    public void verifyResponse() {
        DefaultOptionsMethodException dome =
            new DefaultOptionsMethodException("oops", null);
        DefaultOptionsMethodExceptionMapper domem =
            injector.getInstance(DefaultOptionsMethodExceptionMapper.class);
        Response r = domem.toResponse(dome);
        assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus());
        verifyMessage(r, rtmsg("oops"));
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.spi.DefaultOptionsMethodException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.