|
Spring Framework example source code file (ServletRequestHandledEvent.java)
The Spring Framework ServletRequestHandledEvent.java source code/* * Copyright 2002-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.context.support; /** * Servlet-specific subclass of RequestHandledEvent, * adding servlet-specific context information. * * @author Juergen Hoeller * @since 2.0 * @see org.springframework.web.servlet.FrameworkServlet * @see org.springframework.context.ApplicationContext#publishEvent */ public class ServletRequestHandledEvent extends RequestHandledEvent { /** URL that the triggered the request */ private final String requestUrl; /** IP address that the request came from */ private final String clientAddress; /** Usually GET or POST */ private final String method; /** Name of the servlet that handled the request */ private final String servletName; /** * Create a new ServletRequestHandledEvent. * @param source the component that published the event * @param requestUrl the URL of the request * @param clientAddress the IP address that the request came from * @param method the HTTP method of the request (usually GET or POST) * @param servletName the name of the servlet that handled the request * @param sessionId the id of the HTTP session, if any * @param userName the name of the user that was associated with the * request, if any (usually the UserPrincipal) * @param processingTimeMillis the processing time of the request in milliseconds */ public ServletRequestHandledEvent(Object source, String requestUrl, String clientAddress, String method, String servletName, String sessionId, String userName, long processingTimeMillis) { super(source, sessionId, userName, processingTimeMillis); this.requestUrl = requestUrl; this.clientAddress = clientAddress; this.method = method; this.servletName = servletName; } /** * Create a new ServletRequestHandledEvent. * @param source the component that published the event * @param requestUrl the URL of the request * @param clientAddress the IP address that the request came from * @param method the HTTP method of the request (usually GET or POST) * @param servletName the name of the servlet that handled the request * @param sessionId the id of the HTTP session, if any * @param userName the name of the user that was associated with the * request, if any (usually the UserPrincipal) * @param processingTimeMillis the processing time of the request in milliseconds * @param failureCause the cause of failure, if any */ public ServletRequestHandledEvent(Object source, String requestUrl, String clientAddress, String method, String servletName, String sessionId, String userName, long processingTimeMillis, Throwable failureCause) { super(source, sessionId, userName, processingTimeMillis, failureCause); this.requestUrl = requestUrl; this.clientAddress = clientAddress; this.method = method; this.servletName = servletName; } /** * Return the URL of the request. */ public String getRequestUrl() { return this.requestUrl; } /** * Return the IP address that the request came from. */ public String getClientAddress() { return this.clientAddress; } /** * Return the HTTP method of the request (usually GET or POST). */ public String getMethod() { return this.method; } /** * Return the name of the servlet that handled the request. */ public String getServletName() { return this.servletName; } public String getShortDescription() { StringBuffer sb = new StringBuffer(); sb.append("url=[").append(getRequestUrl()).append("]; "); sb.append("client=[").append(getClientAddress()).append("]; "); sb.append(super.getShortDescription()); return sb.toString(); } public String getDescription() { StringBuffer sb = new StringBuffer(); sb.append("url=[").append(getRequestUrl()).append("]; "); sb.append("client=[").append(getClientAddress()).append("]; "); sb.append("method=[").append(getMethod()).append("]; "); sb.append("servlet=[").append(getServletName()).append("]; "); sb.append(super.getDescription()); return sb.toString(); } public String toString() { return "ServletRequestHandledEvent: " + getDescription(); } } Other Spring Framework examples (source code examples)Here is a short list of links related to this Spring Framework ServletRequestHandledEvent.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.