Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8115015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:19:43+00:00 2026-06-06T03:19:43+00:00

I use jersey-client to consume a REST service. I need both the requested Entity

  • 0

I use jersey-client to consume a REST service.
I need both the requested Entity and the Last-Modified header.

So I do the following:

ClientResponse response = webResource.get(ClientResponse.class);
Person person = response.getEntity(Person.class);

That works. I get a response and I can marshal the Entity (wich is XML) into my POJO.
When I debug and take a look into the Headers of the response, then I see that there is a Last-Modified header set.

But when I try to retrieve the date via

response.getLastModified();

I get a NPE somewhere in URLConnectionClientHandler.

Has anyone a clue what I do wrong?

edit: as requested the trace

java.lang.NullPointerException: null
at com.sun.jersey.api.client.ClientResponse.getLastModified(ClientResponse.java:647) ~[jersey-client-1.12.jar:1.12]
at a.o.u.user.dao.impl.uds.PersonenUdsClient.getPerson(PersonenUdsClient.java:103) ~[um-user-2.5.0-Beta1-SNAPSHOT.jar:na]
at a.o.u.user.dao.impl.UserDaoUdsImpl.mergeWithUdsUser(UserDaoUdsImpl.java:282) ~[um-user-2.5.0-Beta1-SNAPSHOT.jar:na]
at a.o.u.user.dao.impl.UserDaoUdsImpl.getUserWithEmail(UserDaoUdsImpl.java:124) ~[um-user-2.5.0-Beta1-SNAPSHOT.jar:na]
at ...

edit: as npe suggested I digged into the code. I think I found the problem. Beside jersey-client I also have cxf in the classpath. Both jersey and cxf provide a class called RuntimeDelegateImpl. But CXFs version does not feature a DateHeaderDelegate. I think the wrong version (CXFs) of RuntimeDelegateImpl is taken.

By now I have not found how I can explicitely set the RuntimeDelegateImpl to use.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:19:44+00:00Added an answer on June 6, 2026 at 3:19 am

    To make it a wrap.

    The problem is that I have both jersey-client and cxf in the classpath. Both RuntimeDelegateImpl. But CXFs version does not feature a DateHeaderDelegate. The wrong version (CXFs) of RuntimeDelegateImpl is taken.

    I solved the issue by retrieving the Last-Modified Header ‘manually’:

    private Date getLastModified(ClientResponse response){
        String lastModifiedString = response.getHeaders().getFirst(
                "Last-Modified");
        if (StringUtils.isEmpty(lastModifiedString)) {
            LOG.warn("Expect to get Last-Modified header when retrieving a Person by pnr "
                    + "but there is none.");
            return null;
        } else {
            try {
                // format is Thu, 21 Jun 2012 08:00:42 GMT
                return new SimpleDateFormat(
                        "EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US)
                        .parse(lastModifiedString);
            } catch (ParseException e) {
                LOG.error("Could not parse Last-Modified date "
                        + e.getMessage());
                return null;
            }
        }
    }
    

    Thanx to npe for the hints.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Jersey Client library to run tests against a rest service running
I am looking to use Jersey without the need of installing an application server
I'm using Jersey to create a REST web service for a server component. The
I'm using jersey API for some REST web services with apache Tomcat. I need
I have a JAX-RS REST service implemented using Jersey. One of the cool features
I'm trying to use Jersey as a client for a RESTful application. Specifically I'd
I have the following scenario: Server: Jetty (with configured JAAS) Client: Jersey invoked via
I have to use an interface in my REST web service. Here is the
I am running a Jersey REST service. The POJO's which represent my resources are
I use Jersey for my REST API. I use JSP files for the views.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.