Package com.sun.jersey.spi.container

Examples of com.sun.jersey.spi.container.ContainerRequest


    verify(mock).getFormParameters();
    verifyNoMoreInteractions(mock);
  }

  public void test_filter_noActionOnPostFormPut() {
    ContainerRequest mock = Mockito.mock(ContainerRequest.class);
    when(mock.getMethod()).thenReturn("POST");
    Form form = new Form();
    form.put("method", Arrays.asList("PUT"));
    when(mock.getFormParameters()).thenReturn(form);
   
    HttpMethodFilter test = new HttpMethodFilter();
    ContainerRequest result = test.filter(mock);
   
    assertSame(mock, result);
    verify(mock).getMethod();
    verify(mock).getFormParameters();
    verify(mock).setMethod("PUT");
View Full Code Here


    verify(mock).setMethod("PUT");
    verifyNoMoreInteractions(mock);
  }

  public void test_filter_noActionOnPostFormDelete() {
    ContainerRequest mock = Mockito.mock(ContainerRequest.class);
    when(mock.getMethod()).thenReturn("POST");
    Form form = new Form();
    form.put("method", Arrays.asList("DELETE"));
    when(mock.getFormParameters()).thenReturn(form);
   
    HttpMethodFilter test = new HttpMethodFilter();
    ContainerRequest result = test.filter(mock);
   
    assertSame(mock, result);
    verify(mock).getMethod();
    verify(mock).getFormParameters();
    verify(mock).setMethod("DELETE");
View Full Code Here

    verify(mock).setMethod("DELETE");
    verifyNoMoreInteractions(mock);
  }

  public void test_filter_noActionOnPostFormOptions() {
    ContainerRequest mock = Mockito.mock(ContainerRequest.class);
    when(mock.getMethod()).thenReturn("POST");
    Form form = new Form();
    form.put("method", Arrays.asList("OPTIONS"));
    when(mock.getFormParameters()).thenReturn(form);
   
    HttpMethodFilter test = new HttpMethodFilter();
    ContainerRequest result = test.filter(mock);
   
    assertSame(mock, result);
    verify(mock).getMethod();
    verify(mock).getFormParameters();
    verify(mock).setMethod("OPTIONS");
View Full Code Here

    verify(mock).setMethod("OPTIONS");
    verifyNoMoreInteractions(mock);
  }

  public void test_filter_noActionOnPostFormHead() {
    ContainerRequest mock = Mockito.mock(ContainerRequest.class);
    when(mock.getMethod()).thenReturn("POST");
    Form form = new Form();
    form.put("method", Arrays.asList("HEAD"));
    when(mock.getFormParameters()).thenReturn(form);
   
    HttpMethodFilter test = new HttpMethodFilter();
    ContainerRequest result = test.filter(mock);
   
    assertSame(mock, result);
    verify(mock).getMethod();
    verify(mock).getFormParameters();
    verify(mock).setMethod("HEAD");
View Full Code Here

    verify(mock).setMethod("HEAD");
    verifyNoMoreInteractions(mock);
  }

  public void test_filter_noActionOnPostFormPost() {
    ContainerRequest mock = Mockito.mock(ContainerRequest.class);
    when(mock.getMethod()).thenReturn("POST");
    Form form = new Form();
    form.put("method", Arrays.asList("POST"));
    when(mock.getFormParameters()).thenReturn(form);
   
    HttpMethodFilter test = new HttpMethodFilter();
    ContainerRequest result = test.filter(mock);
   
    assertSame(mock, result);
    verify(mock).getMethod();
    verify(mock).getFormParameters();
    verify(mock).setMethod("POST");
View Full Code Here

    verify(mock).setMethod("POST");
    verifyNoMoreInteractions(mock);
  }

  public void test_filter_noActionOnPostFormGet() {
    ContainerRequest mock = Mockito.mock(ContainerRequest.class);
    when(mock.getMethod()).thenReturn("POST");
    Form form = new Form();
    form.put("method", Arrays.asList("GET"));
    when(mock.getFormParameters()).thenReturn(form);
   
    HttpMethodFilter test = new HttpMethodFilter();
    ContainerRequest result = test.filter(mock);
   
    assertSame(mock, result);
    verify(mock).getMethod();
    verify(mock).getFormParameters();
    verify(mock).setMethod("GET");
View Full Code Here

    verify(mock).setMethod("GET");
    verifyNoMoreInteractions(mock);
  }

  public void test_filter_noActionOnPostFormNoMatch() {
    ContainerRequest mock = Mockito.mock(ContainerRequest.class);
    when(mock.getMethod()).thenReturn("POST");
    Form form = new Form();
    form.put("method", Arrays.asList("FOOBAR"));
    when(mock.getFormParameters()).thenReturn(form);
   
    HttpMethodFilter test = new HttpMethodFilter();
    ContainerRequest result = test.filter(mock);
   
    assertSame(mock, result);
    verify(mock).getMethod();
    verify(mock).getFormParameters();
    verifyNoMoreInteractions(mock);
View Full Code Here

    public ClientResponse handle(ClientRequest clientRequest) {
        byte[] requestEntity = writeRequestEntity(clientRequest);

        InBoundHeaders rh = getInBoundHeaders(clientRequest.getMetadata());

        final ContainerRequest cRequest = new ContainerRequest(
                w,
                clientRequest.getMethod(),
                baseUri,
                clientRequest.getURI(),
                rh,
                new ByteArrayInputStream(requestEntity)
                );

        // TODO this is a hack
        List<String> cookies = cRequest.getRequestHeaders().get("Cookie");
        if (cookies != null) {
            for (String cookie : cookies) {
                if (cookie != null)
                    cRequest.getCookies().putAll(
                            HttpHeaderReader.readCookies(cookie));
            }
            }

        final TestContainerResponseWriter writer = new TestContainerResponseWriter();
View Full Code Here

        final URI baseUri = getBaseUri(request);
        final URI requestUri = baseUri.resolve(request.getTarget());

        try {
            final ContainerRequest cRequest = new ContainerRequest(
                    target,
                    request.getMethod(),
                    baseUri,
                    requestUri,
                    getHeaders(request),
View Full Code Here

       
        final URI baseUri = getBaseUri(request);
        final URI requestUri = baseUri.resolve(request.getTarget());
       
        try {
            final ContainerRequest cRequest = new ContainerRequest(
                    target,
                    request.getMethod(),
                    baseUri,
                    requestUri,
                    getHeaders(request),
View Full Code Here

TOP

Related Classes of com.sun.jersey.spi.container.ContainerRequest

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.