Example usage for javax.servlet.http HttpServletRequest getRemoteAddr

List of usage examples for javax.servlet.http HttpServletRequest getRemoteAddr

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getRemoteAddr.

Prototype

public String getRemoteAddr();

Source Link

Document

Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.

Usage

From source file:com.wmanual.web.controller.ManualHomeController.java

@RequestMapping("/manuals")
public String manuals(HttpServletRequest request) throws Exception {
    logger.info("[{}] visit wmanual for {} page", request.getRemoteAddr(), "manuals");
    return "webmanual/manuals";
}

From source file:com.wmanual.web.controller.ManualHomeController.java

@RequestMapping("/appliance")
public String appliance(HttpServletRequest request) throws Exception {
    logger.info("[{}] visit wmanual for {} page", request.getRemoteAddr(), "appliance");
    return "webmanual/appliance";
}

From source file:com.wmanual.web.controller.ManualHomeController.java

@RequestMapping("/result")
public String result(HttpServletRequest request) throws Exception {
    logger.info("[{}] visit wmanual for {} page", request.getRemoteAddr(), "result");
    return "webmanual/result";
}

From source file:com.wmanual.web.controller.ManualHomeController.java

@RequestMapping("/signin")
public String signin(HttpServletRequest request) throws Exception {
    logger.info("[{}] visit wmanual for {} page", request.getRemoteAddr(), "signin");
    return "webmanual/signin";
}

From source file:com.wmanual.web.controller.ManualHomeController.java

@RequestMapping("/signup")
public String signup(HttpServletRequest request) throws Exception {
    logger.info("[{}] visit wmanual for {} page", request.getRemoteAddr(), "signup");
    return "webmanual/signup";
}

From source file:com.wmanual.web.controller.ManualHomeController.java

@RequestMapping("/pdfonline")
public String pdfonline(HttpServletRequest request) throws Exception {
    logger.info("[{}] visit wmanual for {} page", request.getRemoteAddr(), "pdfonline");
    return "webmanual/pdfonline";
}

From source file:com.netflix.spinnaker.gate.ratelimit.RateLimitingInterceptor.java

private String sourceIpAddress(HttpServletRequest request) {
    String ip = request.getHeader("X-FORWARDED-FOR");
    if (ip == null) {
        return request.getRemoteAddr();
    }// www  . ja  v a  2  s.  c  om
    return ip;
}

From source file:com.comcast.cdn.traffic_control.traffic_router.core.request.HTTPRequest.java

public void applyRequest(final HttpServletRequest request) {
    setClientIP(request.getRemoteAddr());
    setPath(request.getPathInfo());//  ww w .jav a2  s  .co m
    setQueryString(request.getQueryString());
    setHostname(request.getServerName());
    setRequestedUrl(request.getRequestURL().toString());
    setUri(request.getRequestURI());

    final String xmm = request.getHeader(X_MM_CLIENT_IP);
    final String fip = request.getParameter(FAKE_IP);

    if (xmm != null) {
        setClientIP(xmm);
    } else if (fip != null) {
        setClientIP(fip);
    }

    final Map<String, String> headers = new HashMap<String, String>();
    final Enumeration<?> headerNames = request.getHeaderNames();
    while (headerNames.hasMoreElements()) {
        final String name = (String) headerNames.nextElement();
        final String value = request.getHeader(name);
        headers.put(name, value);
    }
    setHeaders(headers);
    secure = request.isSecure();
}

From source file:fr.scc.elo.controller.ServiceController.java

@GET
@Path("/ip/match/write")
@ApiOperation(value = "pour savoir si l'ip source peut enregistrer un match", response = MatchResponse.class)
public Response manageMatch(@Context HttpServletRequest http) throws EloException {

    return Response.ok().entity("your IP " + http.getRemoteAddr() + " can write match result ? "
            + connectionService.acceptIPUpdate(http.getRemoteAddr())).build();
}

From source file:sample.session.SessionDetailsFilter.java

private String getRemoteAddress(HttpServletRequest request) {
    String remoteAddr = request.getHeader("X-FORWARDED-FOR");
    if (remoteAddr == null) {
        remoteAddr = request.getRemoteAddr();
    } else if (remoteAddr.contains(",")) {
        remoteAddr = remoteAddr.split(",")[0];
    }//from  w w  w  .j  av a2s  .  co  m
    return remoteAddr;
}