Example usage for io.netty.handler.codec.http HttpMethod DELETE

List of usage examples for io.netty.handler.codec.http HttpMethod DELETE

Introduction

In this page you can find the example usage for io.netty.handler.codec.http HttpMethod DELETE.

Prototype

HttpMethod DELETE

To view the source code for io.netty.handler.codec.http HttpMethod DELETE.

Click Source Link

Document

The DELETE method requests that the origin server delete the resource identified by the Request-URI.

Usage

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapDeleteInRawJsonUsingQueryString() {
    sendEvent(HttpMethod.DELETE, "/normal_delete?format=json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("\"Normal DELETE action\"", httpResponse.toString());
}

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapDeleteInRawXml() {
    sendEvent(HttpMethod.DELETE, "/normal_delete.xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("<string>Normal DELETE action</string>", httpResponse.toString());
}

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapDeleteInRawXmlUsingQueryString() {
    sendEvent(HttpMethod.DELETE, "/normal_delete?format=xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("<string>Normal DELETE action</string>", httpResponse.toString());
}

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldDeleteWithoutContent() {
    sendEvent(HttpMethod.DELETE, "/no_content_delete.json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("null", httpResponse.toString());
}

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldThrowExceptionOnDeleteNoContentContainingBody() {
    sendEvent(HttpMethod.DELETE, "/no_content_with_body_delete.json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
}

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldDeleteIgnoringJsonp() {
    sendEvent(HttpMethod.DELETE, "/normal_delete.json?jsonp=jsonp_callback", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("\"Normal DELETE action\"", httpResponse.toString());
}

From source file:org.restexpress.Request.java

License:Apache License

public boolean isMethodDelete() {
    return getEffectiveHttpMethod().equals(HttpMethod.DELETE);
}

From source file:org.restexpress.RequestTest.java

License:Apache License

@Test
public void shouldBeDeleteRequest() {
    Request deleteRequest = new Request(
            new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.DELETE, "/foo"), null);
    assertEquals(HttpMethod.DELETE, deleteRequest.getHttpMethod());
    assertEquals(HttpMethod.DELETE, deleteRequest.getEffectiveHttpMethod());
}

From source file:org.restexpress.RequestTest.java

License:Apache License

@Test
public void shouldBeEffectiveDeleteRequest() {
    Request deleteRequest = new Request(
            new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/foo?_method=DeLeTe"), null);
    assertEquals(HttpMethod.POST, deleteRequest.getHttpMethod());
    assertEquals(HttpMethod.DELETE, deleteRequest.getEffectiveHttpMethod());
}

From source file:org.restexpress.route.RouteMapping.java

License:Apache License

public RouteMapping() {
    super();/*from   w ww .j  a  v a 2 s  . com*/
    routes = new HashMap<HttpMethod, List<Route>>();
    routes.put(HttpMethod.DELETE, deleteRoutes);
    routes.put(HttpMethod.GET, getRoutes);
    routes.put(HttpMethod.POST, postRoutes);
    routes.put(HttpMethod.PUT, putRoutes);
    routes.put(HttpMethod.HEAD, headRoutes);
    routes.put(HttpMethod.OPTIONS, optionRoutes);
}