jersey
  1. jersey
  2. JERSEY-1544

Jersey overrides user defined Date http header in response

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0-m09
    • Fix Version/s: 2.0-rc1, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      Client call:

      Client client = ClientFactory.newClient();
      WebTarget target = client.target("http://localhost:8080/web/response/date");
      Invocation.Builder builder;
      builder = target.request("*/*");
      Invocation i;
      i=builder.build("POST",Entity.entity("1351608787000",MediaType.WILDCARD_TYPE);
      i.invoke();
      

      Resource:

      @Path("response")
      public class Resource {
      	@POST
      	@Path("date")
      	public Response getDate(String date) {
      		ResponseBuilder builder = Response.ok();
      		if (date != null && date.length() != 0) {
      			long millis = Long.parseLong(date);
      			Date dateFromMillis = new Date(millis);
      			builder = builder.header(HttpHeaders.DATE, dateFromMillis);
      		}
      		Response response = builder.build();
      		return response;
      	}
      }
      

      I got :

      << 200 OK
      << Date: Tue, 30 Oct 2012 14:53:08 GMT
      << Content-Length: 0

      i.e. Original date 1351608787000 and response#getDate() 1351608788000 differs

        Activity

        Hide
        Pavel Bucek added a comment -

        not a Jersey issue, date is overridden by underlying container.

        Show
        Pavel Bucek added a comment - not a Jersey issue, date is overridden by underlying container.
        Hide
        Pavel Bucek added a comment -

        leaving this opened intentionally.

        Jan, please specify used container? I can investigate afterwards whether we can somehow tweak its settings.

        Show
        Pavel Bucek added a comment - leaving this opened intentionally. Jan, please specify used container? I can investigate afterwards whether we can somehow tweak its settings.
        Hide
        jan.supol added a comment -

        In Tomcat it does not work, in GF, it works fine.

        Show
        jan.supol added a comment - In Tomcat it does not work, in GF, it works fine.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 hours
              3h
              Remaining:
              0m
              Logged:
              Time Not Required
              1m