Tabnine Logo
HttpServletRequest.getRemotePort
Code IndexAdd Tabnine to your IDE (free)

How to use
getRemotePort
method
in
javax.servlet.http.HttpServletRequest

Best Java code snippets using javax.servlet.http.HttpServletRequest.getRemotePort (Showing top 20 results out of 1,872)

origin: spring-projects/spring-framework

@Override
public InetSocketAddress getRemoteAddress() {
  return new InetSocketAddress(this.request.getRemoteHost(), this.request.getRemotePort());
}
origin: spring-projects/spring-framework

@Override
public InetSocketAddress getRemoteAddress() {
  return new InetSocketAddress(this.servletRequest.getRemoteHost(), this.servletRequest.getRemotePort());
}
origin: Red5/red5-server

/** {@inheritDoc} */
public int getRemotePort() {
  return request.getRemotePort();
}
origin: org.springframework/spring-web

@Override
public InetSocketAddress getRemoteAddress() {
  return new InetSocketAddress(this.request.getRemoteHost(), this.request.getRemotePort());
}
origin: org.springframework/spring-web

@Override
public InetSocketAddress getRemoteAddress() {
  return new InetSocketAddress(this.servletRequest.getRemoteHost(), this.servletRequest.getRemotePort());
}
origin: apache/incubator-dubbo

@Override
public void handle(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {
  String uri = request.getRequestURI();
  HttpInvokerServiceExporter skeleton = skeletonMap.get(uri);
  if (!request.getMethod().equalsIgnoreCase("POST")) {
    response.setStatus(500);
  } else {
    RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
    try {
      skeleton.handleRequest(request, response);
    } catch (Throwable e) {
      throw new ServletException(e);
    }
  }
}
origin: apache/incubator-dubbo

@Override
public void handle(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {
  String uri = request.getRequestURI();
  HttpInvokerServiceExporter skeleton = skeletonMap.get(uri);
  if (!request.getMethod().equalsIgnoreCase("POST")) {
    response.setStatus(500);
  } else {
    RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
    try {
      skeleton.handleRequest(request, response);
    } catch (Throwable e) {
      throw new ServletException(e);
    }
  }
}
origin: neo4j/neo4j

  public static RequestData from( HttpServletRequest req )
  {
    return new RequestData(
        req.getRemoteAddr(),
        req.isSecure(),
        req.getRemotePort(),
        req.getLocalName(),
        req.getLocalAddr(),
        req.getLocalPort(),
        req.getAuthType() == null ? "" : req.getAuthType()
      );
  }
}
origin: apache/incubator-dubbo

@Override
public void handle(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {
  String uri = request.getRequestURI();
  HessianSkeleton skeleton = skeletonMap.get(uri);
  if (!request.getMethod().equalsIgnoreCase("POST")) {
    response.setStatus(500);
  } else {
    RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
    Enumeration<String> enumeration = request.getHeaderNames();
    while (enumeration.hasMoreElements()) {
      String key = enumeration.nextElement();
      if (key.startsWith(Constants.DEFAULT_EXCHANGER)) {
        RpcContext.getContext().setAttachment(key.substring(Constants.DEFAULT_EXCHANGER.length()),
            request.getHeader(key));
      }
    }
    try {
      skeleton.invoke(request.getInputStream(), response.getOutputStream());
    } catch (Throwable e) {
      throw new ServletException(e);
    }
  }
}
origin: apache/incubator-dubbo

@Override
public void handle(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {
  String uri = request.getRequestURI();
  HessianSkeleton skeleton = skeletonMap.get(uri);
  if (!request.getMethod().equalsIgnoreCase("POST")) {
    response.setStatus(500);
  } else {
    RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
    Enumeration<String> enumeration = request.getHeaderNames();
    while (enumeration.hasMoreElements()) {
      String key = enumeration.nextElement();
      if (key.startsWith(Constants.DEFAULT_EXCHANGER)) {
        RpcContext.getContext().setAttachment(key.substring(Constants.DEFAULT_EXCHANGER.length()),
            request.getHeader(key));
      }
    }
    try {
      skeleton.invoke(request.getInputStream(), response.getOutputStream());
    } catch (Throwable e) {
      throw new ServletException(e);
    }
  }
}
origin: apache/incubator-dubbo

  @Override
  public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
    dispatcher.service(request, response);
  }
}
origin: apache/incubator-dubbo

  @Override
  public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
    dispatcher.service(request, response);
  }
}
origin: apache/nifi

private PeerDescription getSourcePeerDescription(@Context HttpServletRequest req) {
  return new PeerDescription(req.getRemoteHost(), req.getRemotePort(), req.isSecure());
}
origin: spotify/apollo

private RequestMetadata extractMetadata(HttpServletRequest req) {
 return HttpRequestMetadata.create(
   Instant.now(),
   Optional.of(serverInfo),
   Optional.of(RequestMetadataImpl.hostAndPort(req.getRemoteHost(), req.getRemotePort())),
   req.getProtocol()
 );
}
origin: openzipkin/brave

/**
 * This sets the client IP:port to the {@linkplain HttpServletRequest#getRemoteAddr() remote
 * address} if the {@link HttpServerAdapter#parseClientIpAndPort default parsing} fails.
 */
@Override public boolean parseClientIpAndPort(HttpServletRequest req, Span span) {
 if (parseClientIpFromXForwardedFor(req, span)) return true;
 return span.remoteIpAndPort(req.getRemoteAddr(), req.getRemotePort());
}
origin: Atmosphere/atmosphere

@Override
public int getRemotePort() {
  return isNotNoOps() ? b.request.getRemotePort() : b.lazyRemote != null ? b.lazyRemote.getPort() : b.remotePort;
}
origin: apache/incubator-dubbo

@Override
public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
  if (servletController == null) {
    HttpServlet httpServlet = DispatcherServlet.getInstance();
    if (httpServlet == null) {
      response.sendError(500, "No such DispatcherServlet instance.");
      return;
    }
    synchronized (this) {
      if (servletController == null) {
        servletController = new ServletController(transportFactory.getRegistry(), httpServlet.getServletConfig(), httpServlet);
      }
    }
  }
  RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
  servletController.invoke(request, response);
}
origin: apache/incubator-dubbo

@Override
public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
  if (servletController == null) {
    HttpServlet httpServlet = DispatcherServlet.getInstance();
    if (httpServlet == null) {
      response.sendError(500, "No such DispatcherServlet instance.");
      return;
    }
    synchronized (this) {
      if (servletController == null) {
        servletController = new ServletController(transportFactory.getRegistry(), httpServlet.getServletConfig(), httpServlet);
      }
    }
  }
  RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
  servletController.invoke(request, response);
}
origin: apache/incubator-dubbo

@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
  HttpServletRequest request = ResteasyProviderFactory.getContextData(HttpServletRequest.class);
  RpcContext.getContext().setRequest(request);
  // this only works for servlet containers
  if (request != null && RpcContext.getContext().getRemoteAddress() == null) {
    RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
  }
  RpcContext.getContext().setResponse(ResteasyProviderFactory.getContextData(HttpServletResponse.class));
  String headers = requestContext.getHeaderString(DUBBO_ATTACHMENT_HEADER);
  if (headers != null) {
    for (String header : headers.split(",")) {
      int index = header.indexOf("=");
      if (index > 0) {
        String key = header.substring(0, index);
        String value = header.substring(index + 1);
        if (!StringUtils.isEmpty(key)) {
          RpcContext.getContext().setAttachment(key.trim(), value.trim());
        }
      }
    }
  }
}
origin: apache/incubator-dubbo

@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
  HttpServletRequest request = ResteasyProviderFactory.getContextData(HttpServletRequest.class);
  RpcContext.getContext().setRequest(request);
  // this only works for servlet containers
  if (request != null && RpcContext.getContext().getRemoteAddress() == null) {
    RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
  }
  RpcContext.getContext().setResponse(ResteasyProviderFactory.getContextData(HttpServletResponse.class));
  String headers = requestContext.getHeaderString(DUBBO_ATTACHMENT_HEADER);
  if (headers != null) {
    for (String header : headers.split(",")) {
      int index = header.indexOf("=");
      if (index > 0) {
        String key = header.substring(0, index);
        String value = header.substring(index + 1);
        if (!StringUtils.isEmpty(key)) {
          RpcContext.getContext().setAttachment(key.trim(), value.trim());
        }
      }
    }
  }
}
javax.servlet.httpHttpServletRequestgetRemotePort

Popular methods of HttpServletRequest

  • getHeader
    Returns the value of the specified request header as a String. If the request did not include a head
  • getParameter
  • getRequestURI
    Returns the part of this request's URL from the protocol name up to the query string in the first li
  • getSession
    Returns the current HttpSession associated with this request or, if there is no current session and
  • getMethod
    Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT
  • getAttribute
  • getContextPath
    Returns the portion of the request URI that indicates the context of the request. The context path a
  • getQueryString
    Returns the query string that is contained in the request URL after the path. This method returns nu
  • setAttribute
  • getPathInfo
    Returns any extra path information associated with the URL the client sent when it made this request
  • getRequestURL
    Reconstructs the URL the client used to make the request. The returned URL contains a protocol, serv
  • getRemoteAddr
  • getRequestURL,
  • getRemoteAddr,
  • getServletPath,
  • getInputStream,
  • getParameterMap,
  • getCookies,
  • getServerName,
  • getHeaderNames,
  • getScheme,
  • getServerPort

Popular in Java

  • Making http requests using okhttp
  • setContentView (Activity)
  • runOnUiThread (Activity)
  • requestLocationUpdates (LocationManager)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now