Most Popular jGuru Stories
In the case of a web application marked "distributed" in its deployment descriptor, there will be one context instance for each virtual machine. In this situation, the context cannot be used as a location to share global information because the information won't be truly global. Use an external resource like a database instead. The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet is initialized.
This method was originally defined to retrieve a servlet from a ServletContext. In this version, this method always returns null and remains only to preserve binary compatibility. In lieu of this method, servlets can share information using the ServletContext class and can perform shared business logic by invoking methods on common non-servlet classes.
This method was originally defined to return an Enumeration of all the servlet names known to this context. In this version, this method always returns an empty Enumeration and remains only to preserve binary compatibility.
This method was originally defined to return an Enumeration of all the servlets known to this servlet context. In this version, this method always returns an empty enumeration and remains only to preserve binary compatibility. This method was originally defined to write an exception's stack trace and an explanatory error message to the servlet log file.
File provided by the servlet container for the ServletContext See Also: String getContextPath Returns the context path of the web application. The context path is the portion of the request URI that is used to select the context of the request.
The context path always comes first in a request URI. For servlets in the default root context, this method returns "". It is possible that a servlet container may match a context by more than one context path. In such cases the HttpServletRequest. The context path returned by this method should be considered as the prime or preferred context path of the application. The context path of the web application, or "" for the default root context Since: This method allows servlets to gain access to the context for various parts of the server, and as needed obtain RequestDispatcher objects from the context.
In a security conscious environment, the servlet container may return null for a given URL. All implementations that comply with Version 3. The value returned may be different from getMajorVersion , which returns the major version of the Servlet specification supported by the Servlet container.
The value returned may be different from getMinorVersion , which returns the minor version of the Servlet specification supported by the Servlet container.
The MIME type is determined by the configuration of the servlet container, and may be specified in a web application deployment descriptor. For example, for a web application containing: This method allows the servlet container to make a resource available to servlets from any source. Resources can be located on a local or remote file system, in a database, or in a.
This method returns null if no resource is mapped to the pathname. The resource content is returned directly, so be aware that requesting a. Use a RequestDispatcher instead to include results of an execution.
This method has a different purpose than java. This method does not use class loaders. The data in the InputStream can be of any type or length. The path must be specified according to the rules given in getResource. This method returns null if no resource exists at the specified path. Meta-information such as content length and content type that is available via getResource method is lost when using this method.
This method is different from java. This method allows servlet containers to make a resource available to a servlet from any location, without using a class loader. Center of Screen 1. DrawingBoard demo 2 1. Sprite Animation 01 1. Sprite Animation 02 1. Sprite Animation 03 1. Socket with Android 1.
Socket, Server Thread 1. Landscape, Portrait p2 1. Emul Korean fonts 1. Simple Button Listener 1. Socket on Android 1. Call External Apps 0. Telechips IP Change 0. Apache httpd server 6. Remote Power Control 1. Remote Motor Control 0. Digital Relay Control 0.
Ext Library Setup 1. Solar Battery Charger 0. Putty with ESP 1. ESP Web Client 1. ESP Web Client 2 0. Servo, PWM Control 1. RC Controller Input 0. VC C Error 1. Command Line Arguments 1. Winsock2 Chat 1 0. Winsock2 Chat 2 0. Winsock2 Chat 3 0. Standard C Library 1. Visual Studio 1. C String functions 1. C String test 1. Pro C, VS Express 1.
Pro C, DB Connect 1. Pro C, Host Variable 1. Pro C, Cursor example 1. Text File read 1. Edit append text 0. Other Data Types 1. Windows Form Intro 1. Allow Unsafe code 1. Media Query Demo 1. CSS Rounded corner 1. CSS Rounded Box 1. CSS Properties List 0. CSS Tab Menu example 1. CSS Item box example 1. CSS Top Menu 1. Drop Down Menu 1. ERD Work Flow 1. Video Box example 1.
ER Master Plugin 1. Dropbox upload, Java 1. Dropbox download, Java 1. Pull Up Down 1. Eclipse Git Plugin 1. On Air Unlisted 1. Billiard Collision 01 1. Billiard Collision 02 1. Angle of point 1. Angle of point 02 1. Angle of point 03 0. Billiard 3 Balls 1. Img Cnt Rotate 1. Canon Ball Animation 1.
Local Img Preview 1. CRUD for Web 1. ESP Web Server01 1. ESP Web Server 1. Launch4J how to 1. JavaCV on Target Setup 1. OpenCV on Windows 7 1. Java Reflection API 1. RMI Callback example 1. RMI with Servlet 1. RMI File Transfer 1. Annotation ex 02 1. Generics ex 02 1. Hashing it Out 1. JDBC Transaction 01 1. JDBC Transaction 02 1. Runtime class test 1. Data Share 01 1. Data Share 02 1. Data Share 03 1. Data Share 04 1. Life cycle of Thread 1.
Socket File Transfer 1. Socket File Request 1. Socket Img Upload 1. Socket Object Stream 1. Network Image Display 1. RMI ex 01 1. Add support for authentication in the websocket client. Patch submitted by J Fernandez. Add XML filtering for the status servlet output where needed. Tribes Fix incorrect behavior that attempts to resend channel messages more than the actual setting value of maxRetryAttempts.
When running on Java 9, any such attempted use of the endorsed directory mechanism will trigger an error and Tomcat will fail to start. When using the Windows installer, check if the requested service name already exists and, if it does, prompt the user to select an alternative service name.
Patch provided by Ralph Plawetzki. Update the Windows installer to search the new as of Java 9 registry locations when looking for a JRE. Remove outdated SSL information from the Security documentation. Catalina Use the correct path when loading the JVM logging. The checks were being performed elsewhere but adding them to the resource handling ensures that the checks are always performed.
Correct typos in Spanish translation. Exclude test files in unusual encodings and markdown files intended for display in GitHub from RAT analysis. Patch provided by Chris Thistlethwaite. Add the ability to make changes to the TLS configuration of a connector at runtime without having to restart the Connector. This check is optional but enabled by default. It may be disabled with the allowHostHeaderMismatch attribute of the Connector.
Correct a further regression in the fix to enable the use of Java key stores that contain multiple keys that do not all have the same password. The regression broke support for some FIPS compliant key stores. Correctly handle invocations of methods defined in the PooledConnection interface when using pooled XA connections. Patch provided by Nils Winkler. Other Update fix for so that values less than zero are accepted instead of throwing a NegativeArraySizeException. Add the ability to set environment variables for individual CGI scripts.
Based on a patch by jm When running under a SecurityManager, do not print a warning about not being able to read a logging configuration file when that file does not exist. Note that the default configuration does not change the existing behaviour.
When using the CGI servlet, make the generation of command line arguments from the query string as per section 4. This corrects a potential regression in the fix for with an alternative solution that adds the JarEntry objects normally skipped by a JarInputStream only if those entries exist. Coyote The minimum required Tomcat Native version has been increased to 1.
This enables TLS connections to close cleanly. In this case the client certificate without the chain will be presented to the application. Fix default key alias algorithm.
Correct a regression in the fix to enable the use of Java key stores that contained multiple keys that did not all have the same password. The regression broke support for any key store that did not store keys in PKCS 8 format such as hardware key stores and Windows key stores. Reduce the number of packets used to send WebSocket messages by not flushing between the header and the payload when the two are written together.
When using the permessage-deflate extension, correctly handle the sending of empty messages after non-empty messages to avoid the IllegalArgumentException. Web applications Show connector cipher list in the manager web application in the correct cipher order.
Tribes To avoid unexpected session timeout notification from backup session, update the access time when receiving the map member notification message. Ensure that failed queries are logged if the SlowQueryReport interceptor is configured to do so and the connection has been abandoned. Patch provided by Craig Webb. Ensure that transaction of idle connection has terminated when the testWhileIdle is set to true and defaultAutoCommit is set to false. Patch provided by WangZheng.
Replace a Unix style comment in the DOS bat file catalina. Update to Commons Daemon 1. Catalina Correct multiple regressions in the fix for that could corrupt static content served by the DefaultServlet.
Patch provided by Jonathan Horowitz. Ensure to explicitly signal an empty request body for HTTP responses. Additional fix to r Based on a patch provided by Alexandr Saperov.
Add a server listener that can be used to do system property replacement from the property source configured in the digester. Ensure that files are closed after detecting encoding of JSPs so that files do not remain locked by the file system.
Add support to the WebSocket client for following redirects when attempting to establish a WebSocket connection. Patch provided by J Fernandez. Catalina Performance improvements for service loader look-ups and look-ups of other class loader resources when the web application is deployed in a packed WAR file.
Add warn message when Digester. Based on patches by Peter Maloney and Felix Schumacher. Web applications Correct the documentation for how StandardRoot is configured. Fix corruption of UTF encoded source files in released source distributions. When log rotation is disabled only one separator will be used when generating the log file name. For example if the prefix is catalina. Patch provided by Katya Stoycheva. Correct a regression in the refactoring to use Charset rather than String to store request character encoding that prevented getReader throwing an UnsupportedEncodingException if the user agent specifies an unsupported character encoding.
Coyote Enable TLS connectors to use Java key stores that contain multiple keys where each key has a separate password. Based on a patch by Frank Taffelt. Add the ability to set the defaults used by the Windows installer from a configuration file. Patch provided by Sandra Madden. Improve the Default Servlet's handling of static files when the file encoding is not compatible with the required response encoding. Remove deleted attribute servlets from the Context MBean description. Patch provided by Alexis Hassler.
The thread that cleans the log files is marked as daemon thread. Correct a regression in 9. Coyote Restore the ability to configure support for SSLv3. Enabling this protocol will trigger a warning in the logs since it is known to be insecure. This significantly reduces the memory footprint of Jasper in development mode, provides a small performance improvement for error page generation and enables source quotes to continue to be provided after a Tomcat restart. Web applications Remove references to the Loader attribute searchExternalFirst from the documentation since the attribute is no longer supported.
Based on a patch by Christian Stöber. Patch provided by Igal Sapir. Other Restore the local definition of the web service annotations since the JRE provided versions are deprecated and Java 9 does not provide them by default. Add the option to specify an alternative file name for the catalina. Also document that relative, as well as absolute, URLs are permitted.
Respect the documentation statements that allow using the platform default secure random for session id generation. CORS filter should set Vary header in response. Submitted by Rick Riemer. By default the log files will be kept 90 days as configured in logging. Based on a patch by Lucas Ventura Carro.
Do not use '[' and ']' symbols around substituted text fragments when generating the default error pages. Patch provided by Katya Todorova. Allow the Manager and Host Manager web applications to start by default when running under a security manager. This was accomplished by adding a custom permission, org.
Polish the javadoc for o. Using this property one can specify a regular expression that will be used to identify crawlers based on their IP address. Based on a patch provided by Tetradeus.
Log a warning message rather than an information message if it takes more than ms to initialised a SecureRandom instance for a web application to use to generate session identifiers. Patch provided by Piotr Chlebda. When an asynchronous request is dispatched via AsyncContext. Ensure that the charset name used in the Content-Type header has exactly the same form as that provided by the application.
This reverts a behavioural change in 9. M21 that caused problems for some clients. Explicitly signal an empty request body for HTTP responses. Improve error message when JSP compiler configuration options are not valid.
Extend Jasper's timeSpaces option to add support for single which replaces template text that consists entirely of whitespace with a single space character. Based on a patch by Meetesh Karia. When pre-compiling with JspC, report all compilation errors rather than stopping after the first error.
A new option -failFast can be used to restore the previous behaviour of stopping after the first error. Based on a patch provided by Marc Pompl. TagLibraryInfo uri and j. TagLibraryInfo prefix fields should not be final. Correct a regression in the previous fix for that could trigger a deadlock depending on the locking strategy employed by the client code. Web applications Better document the meaning of the trimSpaces option for Jasper. Clarify the code comments in the rewrite valve to make clear that there are no plans to provide proxy support for this valve since Tomcat does not have proxy capabilities.
Document the altDDName attribute for the Context element. Issue reported via comments. Add missing Documented annotation to annotations in the annotations API. General Allow to exclude JUnit test classes using the build property test.
Catalina Review those places where Tomcat re-encodes a URI or URI component and ensure that that correct encoding path differs from query string is applied and that the encoding is applied consistently. Add MIME mapping for woff2 fonts in the default web. Patch provided by Justin Williamson. Coyote When a TrustManager is configured that does not support certificateVerificationDepth only log a warning about that lack of support when certificateVerificationDepth has been explicitly set.
Extend the fix for large headers to push requests. Jasper When no BOM is present and an encoding is detected, do not skip the bytes used to detect the encoding since they are not part of a BOM.
Ensure that once the class is resolved by javax. ImportHandler resolveClass it will be cached with the proper name. AsyncChannelWrapperSecure are correctly reset even if some exceptions occurred during processing. Tribes Add features to get the statistics of the thread pool of the Receiver component and MessageDispatchInterceptor. These statistics information can be acquired via JMX.
Other Modify the Ant build script used to publish to a Maven repository so that it no longer requires artifacts to be GPG signed. Catalina Update the Servlet 4. Refactor code so that explicitly referenced inner classes are given explicit names rather than being anonymous.
Log a message that lists the components in the processing chain that do not support async processing when a call to ServletRequest. Since the class is used extensively in error handling, it is prudent to pre-load it to avoid any failure to load this class masking the true problem during error handling. WriteListener registered then a call to javax. ReadListener registered then a call to javax. Improve the handling of access to properties defined by interfaces when a BeanELResolver is used under a SecurityManager.
Correctly escape single quotes when used in i18n messages. Based on a patch by Michael Osipov. Refactor to avoid using some methods that will be deprecated in Java 9 onwards. Ensure that Set-Cookie headers generated by the RfcCookieProcessor are aligned with the specification.
Patch provided by Jim Griswold. Fix a NullPointerException when obtaining a RequestDispatcher for a request that will not have any pathInfo associated with it.
This was a regression in the changes in 9. M18 for the Servlet 4. Based on a patch by Didier Gutacker. Patch by Michael Osipov. Correctly spell compressible when used in configuration attributes and internal code. Fix sendfile processing error that could lead to subsequent requests experiencing an IllegalStateException. Correctly handle the error when fewer parameter values than required by the method are used to invoke an EL method expression.
Patch provided by Daniel Gray. Implement equals and hashCode in the StatementFacade in order to enable these methods to be called on the closed statements if any statement proxy is set. This behavior can be changed with useStatementFacade attribute. Refactor RealmBase for better code re-use when implementing Realms that use a custom Principal.
Various formatting and layout improvements for the ErrorReportValve. Patch provided by Michael Osipov. Remove the reason phrase when sending a response status for consistency with other response status lines.
Improve performance of DefaultServlet when sendfile feature is disabled on connector. Patch provided by Aaron Anderson. When startStopThreads is 1 or a special value that is equivalent to 1 then rather than using an ExecutorService to start the children of the current component, the children will be started on the current thread.
Remove final marker from CorsFilter to enable sub-classing. Improve error handling for asynchronous processing and correct a number of cases where the requestDestroyed event was not being fired and an entry wasn't being made in the access logs. Take account of the dispatchersUseEncodedPaths setting on the current Context when generating paths for dispatches triggered by AsyncContext.
Make the separator Tomcat uses in the Tomcat specific war: URL protocol customizable via a system property. The separator is equivalent to the use of the! Note that the Servlet 4. Correct a bug in the handling of JARs in unpacked WARs that meant multiple attempts to read the same entry from a JAR in succession would fail for the second and subsequent attempts.
Ensure that the Map returned by ServletRequest. Based on a patch provided by woosan. Correctly cache the Subject in the session - if there is a session - when running under a SecurityManager. Patch provided by Jan Engehausen. The expectation is that configuration will be performed via a JSSE provider specific mechanisms. Expose a protected getter and setter for NioEndpoint.
Jasper Follow up to the fix for Correct a regression in the XML encoding detection refactoring carried out for 9. M16 that incorrectly always used the detected BOM encoding in preference to any encoding specified in the prolog.
Patch provided by Svetlin Zarev. Other Spelling corrections provided by Josh Soref. Update all unit tests that test the HTTP status line to check for the required space after the status code. Coyote Ensure UpgradeProcessor instances associated with closed connections are removed from the map of current connections to Processors.
The original problem cannot be reproduced with the current code and the work-around is now causing problems. Follow up fix using a better variable name for the tag reuse flag. WebSocket Prevent potential processing loop on unexpected WebSocket connection closure. Handle the case where the stored user credential uses a different key length than the length currently configured for the CredentialHandler.
Based on a patch by Niklas Holm. Fix thread safety issue with RMI cleanup code. In particular, don't use PKCS12 as a default trust store type. Better document how the default trust store type is selected for a TLS virtual host.
Once a new size has been agreed for the dynamic HPACK table, the next header block must begin with a dynamic table update. WebSocket Correctly handle blocking WebSocket writes when the write times out just before the write is attempted. Based upon a patch by Michael Osipov. Correct the format of the sample ISO date used to report the build date for the documentation. Other Increment version due a local build configuration error with 9. M14 that wasn't caught until after digital signing had been completed Signing requires unique names so a new tag was required.
Add an available flag to realms, to indicate the state, or the realm backend. Update lockout realm to only register auth failures if the realm is available. Stop creating a default connector on start in embedded mode. Dispose of the GSS credential once it is no longer required. Provide a standard toString implementation for components that implement Contained.
Correct the javadoc for o. The default value is different for the different implementations. Duplicate code identified by the Simian tool. When expanding the buffer used for reading the request body, ensure the read position will be restored to the original one. Implement support in the RewriteValve for symbolic names to specify the redirect code to use when returning a redirect response to the user agent. In the RewriteValve write empty capture groups as the empty string rather than as "null" when generating the re-written URL.
Ensure the response headers' buffer limit is reset to the capacity of this buffer when IOException occurs while writing the headers to the socket.