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

  • Home
  • SEARCH
  • 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 8640965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:24:21+00:00 2026-06-12T11:24:21+00:00

I have this function to get the HostAddress from my request (HttpServletRequest) on Java.

  • 0

I have this function to get the HostAddress from my request (HttpServletRequest) on Java. But using Jetty 7.x and my IP is ipV6 I have always this error with iPv6 address.

My function:

xxxx.getIP(request, false);

public static String getIP(HttpServletRequest request, boolean proxy) {
    String ip = "";
    log.debug("X-getHeaderNames ["+ request.getHeaderNames()+"]");
    if (proxy) {
        ip = XFordwardedInetAddressUtil.getAddressFromRequest(request);
    } else {
        String _ip = request.getRemoteAddr();
        ip = InetAddresses.forString(_ip).getHostAddress();
    }
    return ip;
}

The error:

DEBUG: org.encuestame.core.exception.EnMeMappingExceptionResolver – Resolving exception from handler [org.encuestame.mvc.controller.TweetPollController@4fc23996]: java.lang.IllegalArgumentException: ‘0:0:0:0:0:0:0:1%0’ is not an IP string literal.
java.lang.IllegalArgumentException: ‘0:0:0:0:0:0:0:1%0’ is not an IP string literal.
at org.encuestame.utils.net.InetAddresses.forString(InetAddresses.java:59)
at org.encuestame.core.util.EnMeUtils.getIP(EnMeUtils.java:210)
at org.encuestame.mvc.controller.AbstractBaseOperations.getIpClient(AbstractBaseOperations.java:262)
at org.encuestame.mvc.controller.TweetPollController.detailTweetPollController(TweetPollController.java:332)
at org.encuestame.mvc.controller.TweetPollController$$FastClassByCGLIB$$6990b004.invoke()
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedIntercepto

I know the iPv6 localhost format should be ‘0:0:0:0:0:0:0:1’ but my request always return this string ‘0:0:0:0:0:0:0:1%0’

Anyone can help me?

  • 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-12T11:24:22+00:00Added an answer on June 12, 2026 at 11:24 am

    The problem is that the class you’re using (org.encuestame.utils.net.InetAddresses) clearly doesn’t support IPv6. Try using the java InetAddress class that Joachim mentioned in his answer.

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

Sidebar

Related Questions

I have this in my Controller. public function delete($id) { if($this->request->is('get')) { throw new
In my index file I get data from the database using this function (which
I have this function and it works fine to get a translated value from
I have this function in my model the purpose of it is to get
I have this code to get the default constructor: Public Function f(ByVal t As
I have progress.js file which has the following code $('#text_area_input').keyup(function() { var text_area_box =$(this).val();//Get
I have this function to create a request to another file to update the
So i have this function to show the time generated from the inserted unix
I have this $.ajax (using jquery) code, it originally was the $.get that is
I have this function that I use to read a directory and get files

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.