jersey
  1. jersey
  2. JERSEY-1261

ClientResponseContext methods mostly return blank values

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-m06
    • Fix Version/s: 2.0-m06, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      ClientResponseContext.getCookies, getHeaders return empty collection.
      .getMediaType even returns null!
      only .getStatus works.

      Suppose code:

      		NewCookie cookie1 = new NewCookie("cookie1", "cookie1");
      		NewCookie cookie2 = new NewCookie("cookie2", "cookie2");
      		Response response = Response.ok().cookie(cookie1).cookie(cookie2)
      				.header("head1", "head2").build();
      		ClientRequestFilter outFilter = new ClientRequestFilter() {
      
      			@Override
      			public void filter(ClientRequestContext context) throws IOException {
      				context.abortWith(r);
      			}
      		};
      ClientResponseFilter inFilter = new ClientResponseFilter(){
      	@Override
      	public void filter(ClientRequestContext requestContext,
      			ClientResponseContext responseContext) throws IOException {
      				Map<String, NewCookie> map = responseContext.getCookies();
      				System.out.println(map.size());
      				System.out.println(responseContext.getStatus());
      				System.out.println(responseContext.getHeaders());
      	}
      };
      		Client client = ClientFactory.newClient();
      		Configuration config = client.configuration();
      		config.register(outFilter).register(inFilter);
                      WebTarget target = client.target(get404Url());
                      Invocation i = target.request().buildGet();
                      Response r = i.invoke();
      

      The code writes twice 0 length, but response has correct status code.

        Activity

        Hide
        jan.supol added a comment -

        So far, the following methods seem not to work:
        getCookies
        getDate
        getEntityTag
        getHeaders
        getLanguage
        getLastModified
        getLength
        getLinkBuilder
        getLinks
        getLink
        getLocation
        getMediaType
        hasLink

        Show
        jan.supol added a comment - So far, the following methods seem not to work: getCookies getDate getEntityTag getHeaders getLanguage getLastModified getLength getLinkBuilder getLinks getLink getLocation getMediaType hasLink

          People

          • Assignee:
            Miroslav Fuksa
            Reporter:
            jan.supol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 7 hours
              7h