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 6598327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:19:57+00:00 2026-05-25T18:19:57+00:00

I’m using Apache HttpComponents (core – 4.1.3, httpclient 4.1.1) to make http requests in

  • 0

I’m using Apache HttpComponents (core – 4.1.3, httpclient 4.1.1) to make http requests in a REST client I’ve written. The web service requires OAuth, which I’ve implemented using signpost. Recently, the webservice has introduced 301 redirects to endpoints that also require oauth. So, I’ve implemented a custom RedirectStrategy which builds a new request and signs it with signpost, just like I would do normally. However, the first two lines (in DefaultRequestDirector) immediately after I return my new request are setting all the headers to those that were sent in the initial request, effectively wiping my new Authorization header and causing all redirect requests to fail.

Does anyone know a way around this? I’ve considered always returning false in my custom RedirectStrategy and handing this in the ResponseHandler that I’ve attached to my request, but there’s no trivial way of reconstructing the request and submitting it back through the proper client.

These are lines 1021-1023 in the DefaultRequestDirector where it calls to my custom RedirectStrategy and then wipes my headers (I’ll try to link to source, shortly):

HttpUriRequest redirect = redirectStrategy.getRedirect(request, response, context);
HttpRequest orig = request.getOriginal();
redirect.setHeaders(orig.getAllHeaders());
  • 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-05-25T18:19:58+00:00Added an answer on May 25, 2026 at 6:19 pm

    I’m guessing a bit here, but if the code that you are referring to is line 349 of DefaultRequestDirector, then a bit further down on line 452 there is a call to requestExec.preProcess(wrapper, httpProcessor, context).

    Would it be possible to register a processor here that signs the request?

    If not, the BasicHttpProcessor (which is probably the processor used here) allows you to register interceptors that allow you to participate in the pre-processing of the request.

    This might be another option to sign the request.

    Alternatively, there is a HttpContext object. The Javadoc for this object suggests that it can be used to hold contextual data for the request, and your data would fit this description. So park it there and regather when you need it later.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm making a simple page using Google Maps API 3. My first. One marker
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to

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.