/** * The default behavior of this method is to return getRemoteHost() * on the wrapped request object. */ public String getRemoteHost() { return this.request.getRemoteHost(); }
/** * Returns the host name or IP associated with the current subject. This method is primarily provided for use * during construction of an <code>AuthenticationToken</code>. * <p/> * The default implementation merely returns {@link ServletRequest#getRemoteHost()}. * * @param request the incoming ServletRequest * @return the <code>InetAddress</code> to associate with the login attempt. */ protected String getHost(ServletRequest request) { return request.getRemoteHost(); }
void insertIntoMDC(ServletRequest request) { MDC.put(ClassicConstants.REQUEST_REMOTE_HOST_MDC_KEY, request.getRemoteHost()); if (request instanceof HttpServletRequest) { HttpServletRequest httpServletRequest = (HttpServletRequest) request; MDC.put(ClassicConstants.REQUEST_REQUEST_URI, httpServletRequest.getRequestURI()); StringBuffer requestURL = httpServletRequest.getRequestURL(); if (requestURL != null) { MDC.put(ClassicConstants.REQUEST_REQUEST_URL, requestURL.toString()); } MDC.put(ClassicConstants.REQUEST_METHOD, httpServletRequest.getMethod()); MDC.put(ClassicConstants.REQUEST_QUERY_STRING, httpServletRequest.getQueryString()); MDC.put(ClassicConstants.REQUEST_USER_AGENT_MDC_KEY, httpServletRequest.getHeader("User-Agent")); MDC.put(ClassicConstants.REQUEST_X_FORWARDED_FOR, httpServletRequest.getHeader("X-Forwarded-For")); } }
@Override public void doFilter(final ServletRequest req, final ServletResponse resp, final FilterChain filterChain) throws IOException, ServletException { final HttpServletRequest request = (HttpServletRequest) req; final long start = System.nanoTime(); try { filterChain.doFilter(req, resp); } finally { final long stop = System.nanoTime(); final String requestId = ((HttpServletRequest) req).getHeader(RequestReplicator.REQUEST_TRANSACTION_ID_HEADER); final String replicationHeader = ((HttpServletRequest) req).getHeader(RequestReplicator.REPLICATION_INDICATOR_HEADER); final boolean validationPhase = RequestReplicator.NODE_CONTINUE.equals(replicationHeader); final String requestDescription = validationPhase ? "Validation Phase of Request " + requestId : "Request ID " + requestId; logger.debug("{} {} from {} duration for {}: {} millis", request.getMethod(), request.getRequestURL().toString(), req.getRemoteHost(), requestDescription, TimeUnit.MILLISECONDS.convert(stop - start, TimeUnit.NANOSECONDS)); } }
@Override public String resolveHost() { String host = super.resolveHost(); if (host == null) { ServletRequest request = resolveServletRequest(); if (request != null) { host = request.getRemoteHost(); } } return host; }
private String getHost(SessionContext context) { String host = context.getHost(); if (host == null) { ServletRequest request = WebUtils.getRequest(context); if (request != null) { host = request.getRemoteHost(); } } return host; }
message = "" + req.getRemoteHost() + " made a non-HTTP request";
/** * The default behavior of this method is to return getRemoteHost() * on the wrapped request object. */ public String getRemoteHost() { return this.request.getRemoteHost(); }
/** * The default behavior of this method is to return getRemoteHost() * on the wrapped request object. */ public String getRemoteHost() { return this.request.getRemoteHost(); }
void insertIntoMDC(ServletRequest request) { MDC.put(ClassicConstants.REQUEST_REMOTE_HOST_MDC_KEY, request .getRemoteHost()); if (request instanceof HttpServletRequest) { HttpServletRequest httpServletRequest = (HttpServletRequest) request; MDC.put(ClassicConstants.REQUEST_REQUEST_URI, httpServletRequest .getRequestURI()); StringBuffer requestURL = httpServletRequest.getRequestURL(); if (requestURL != null) { MDC.put(ClassicConstants.REQUEST_REQUEST_URL, requestURL.toString()); } MDC.put(ClassicConstants.REQUEST_QUERY_STRING, httpServletRequest.getQueryString()); MDC.put(ClassicConstants.REQUEST_USER_AGENT_MDC_KEY, httpServletRequest .getHeader("User-Agent")); MDC.put(ClassicConstants.REQUEST_X_FORWARDED_FOR, httpServletRequest .getHeader("X-Forwarded-For")); } }
public static void put(final String key, final ServletRequest servletRequest) { put(key, "RemoteAddr", servletRequest.getRemoteAddr()); put(key, "RemoteHost", servletRequest.getRemoteHost()); put(key, "RemotePort", servletRequest.getRemotePort()); }
/** * The default behavior of this method is to return getRemoteHost() * on the wrapped request object. */ public String getRemoteHost() { return this.request.getRemoteHost(); }
/** * The default behavior of this method is to return getRemoteHost() * on the wrapped request object. */ public String getRemoteHost() { return this.request.getRemoteHost(); }
/** * The default behavior of this method is to return getRemoteHost() * on the wrapped request object. */ public String getRemoteHost() { return this.request.getRemoteHost(); }
/** * The default behavior of this method is to return getRemoteHost() on the * wrapped request object. */ @Override public String getRemoteHost() { return this.request.getRemoteHost(); }
/** * The default behavior of this method is to return getRemoteHost() * on the wrapped request object. */ public String getRemoteHost() { return this.request.getRemoteHost(); }
/** * The default behavior of this method is to return getRemoteHost() * on the wrapped request object. */ public String getRemoteHost() { return this.request.getRemoteHost(); }
/** * The default behavior of this method is to return getRemoteHost() * on the wrapped request object. */ public String getRemoteHost() { return this.request.getRemoteHost(); }
/** * The default behavior of this method is to return getRemoteHost() * on the wrapped request object. */ public String getRemoteHost() { return this.request.getRemoteHost(); }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try (Closeable closeable = MDCBuilder.create() .addContext(MDCBuilder.PROTOCOL, "JMAP") .addContext(MDCBuilder.IP, request.getRemoteAddr()) .addContext(MDCBuilder.HOST, request.getRemoteHost()) .build()) { chain.doFilter(request, response); } }