Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x
This commit is contained in:
commit
45e3abbdcf
|
@ -45,13 +45,6 @@ public class JettyTldPreScanned extends TldPreScanned
|
|||
{
|
||||
private final Collection<URL> _jettyPreScannedURLs;
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param namespaceAware
|
||||
* @param validation
|
||||
* @param blockExternal
|
||||
* @param preScannedTlds
|
||||
*/
|
||||
public JettyTldPreScanned(ServletContext context, boolean namespaceAware, boolean validation, boolean blockExternal, Collection<URL> preScannedTlds)
|
||||
{
|
||||
super(context, namespaceAware, validation, blockExternal, preScannedTlds);
|
||||
|
|
|
@ -890,9 +890,11 @@ public class AnnotationParser
|
|||
*
|
||||
* @param handlers the handlers to look for classes in
|
||||
* @param entry the entry in the potentially MultiRelease jar resource to parse
|
||||
* @param jar the jar file
|
||||
* @throws Exception if unable to parse
|
||||
*/
|
||||
protected void parseJarEntry (Set<? extends Handler> handlers, Resource jar, MultiReleaseJarFile.VersionedJarEntry entry) throws Exception
|
||||
protected void parseJarEntry (Set<? extends Handler> handlers, Resource jar, MultiReleaseJarFile.VersionedJarEntry entry)
|
||||
throws Exception
|
||||
{
|
||||
if (jar == null || entry == null)
|
||||
return;
|
||||
|
|
|
@ -70,7 +70,7 @@ public class BasicAuthentication extends AbstractAuthentication
|
|||
* Basic authentication result.
|
||||
* <p>
|
||||
* Application may utilize this class directly via
|
||||
* {@link AuthenticationStore#addAuthenticationResult(Result)}
|
||||
* {@link org.eclipse.jetty.client.api.AuthenticationStore#addAuthenticationResult(Result)}
|
||||
* to perform preemptive authentication, that is immediately
|
||||
* sending the authorization header based on the fact that the
|
||||
* URI is known to require authentication and that username
|
||||
|
|
|
@ -838,12 +838,10 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
|||
/**
|
||||
* Check to see if indexes are available, in which case
|
||||
* we can do more performant queries.
|
||||
* @return
|
||||
* @return <code>true</code> if indexes are available
|
||||
*/
|
||||
protected boolean checkIndexes ()
|
||||
protected boolean checkIndexes()
|
||||
{
|
||||
long start =0;
|
||||
|
||||
try
|
||||
{
|
||||
Query<ProjectionEntity> query = Query.newProjectionEntityQueryBuilder()
|
||||
|
|
|
@ -400,7 +400,8 @@ public class GZIPContentDecoder implements Destroyable
|
|||
}
|
||||
|
||||
/**
|
||||
* @return An indirect buffer of the configured buffersize either from the pool or freshly allocated.
|
||||
* @param capacity capacity capacity of the allocated ByteBuffer
|
||||
* @return An indirect buffer of the configured buffersize either from the pool or freshly allocated.
|
||||
*/
|
||||
public ByteBuffer acquire(int capacity)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@ public class MetaData implements Iterable<HttpField>
|
|||
|
||||
/**
|
||||
* @deprecated use {@link #getHttpVersion()} instead
|
||||
* @return the HTTP version of this MetaData object
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpVersion getVersion()
|
||||
|
|
|
@ -117,6 +117,7 @@ public interface ISession extends Session
|
|||
*
|
||||
* @see #onShutdown()
|
||||
* @see #close(int, String, Callback)
|
||||
* @return <code>true</code> if the session has expired
|
||||
*/
|
||||
public boolean onIdleTimeout();
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public interface IStream extends Stream, Closeable
|
|||
|
||||
/**
|
||||
* @return the {@link org.eclipse.jetty.http2.api.Stream.Listener} associated with this stream
|
||||
* @see #setListener(Listener)
|
||||
* @see #setListener(Stream.Listener)
|
||||
*/
|
||||
public Listener getListener();
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ public class PriorityFrame extends Frame
|
|||
|
||||
/**
|
||||
* @deprecated use {@link #getParentStreamId()} instead.
|
||||
* @return <code>int</code> of the Parent Stream
|
||||
*/
|
||||
@Deprecated
|
||||
public int getDependentStreamId()
|
||||
|
|
|
@ -184,8 +184,9 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
Attributes attributes;
|
||||
|
||||
/**
|
||||
* @param userName
|
||||
* @param credential
|
||||
* @param userName the user name
|
||||
* @param credential the credential
|
||||
* @param attributes the user {@link Attributes}
|
||||
*/
|
||||
public LDAPUserInfo(String userName, Credential credential, Attributes attributes)
|
||||
{
|
||||
|
@ -266,25 +267,21 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
* NOTE: this is not an user authenticated operation
|
||||
*
|
||||
* @param username
|
||||
* @return
|
||||
* @return the {@link Attributes} from the user
|
||||
* @throws LoginException
|
||||
*/
|
||||
private Attributes getUserAttributes(String username) throws LoginException
|
||||
{
|
||||
Attributes attributes = null;
|
||||
|
||||
SearchResult result;
|
||||
try
|
||||
{
|
||||
result = findUser(username);
|
||||
attributes = result.getAttributes();
|
||||
SearchResult result = findUser(username);
|
||||
Attributes attributes = result.getAttributes();
|
||||
return attributes;
|
||||
}
|
||||
catch (NamingException e)
|
||||
{
|
||||
throw new LoginException("Root context binding failure.");
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
private String getUserCredentials(Attributes attributes) throws LoginException
|
||||
|
|
|
@ -42,9 +42,9 @@ public class UserInfo
|
|||
|
||||
|
||||
/**
|
||||
* @param userName
|
||||
* @param credential
|
||||
* @param roleNames
|
||||
* @param userName the user name
|
||||
* @param credential the credential
|
||||
* @param roleNames a {@link List} of role name
|
||||
*/
|
||||
public UserInfo (String userName, Credential credential, List<String> roleNames)
|
||||
{
|
||||
|
@ -52,18 +52,15 @@ public class UserInfo
|
|||
_credential = credential;
|
||||
if (roleNames != null)
|
||||
{
|
||||
synchronized (_roleNames)
|
||||
{
|
||||
_roleNames.addAll(roleNames);
|
||||
_rolesLoaded = true;
|
||||
}
|
||||
_roleNames.addAll(roleNames);
|
||||
_rolesLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param userName
|
||||
* @param credential
|
||||
* @param userName the user name
|
||||
* @param credential the credential
|
||||
*/
|
||||
public UserInfo (String userName, Credential credential)
|
||||
{
|
||||
|
@ -76,16 +73,16 @@ public class UserInfo
|
|||
* Should be overridden by subclasses to obtain
|
||||
* role info
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @return List of role associated to the user
|
||||
* @throws Exception if the roles cannot be retrieved
|
||||
*/
|
||||
public List<String> doFetchRoles ()
|
||||
public List<String> doFetchRoles()
|
||||
throws Exception
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public void fetchRoles () throws Exception
|
||||
public void fetchRoles() throws Exception
|
||||
{
|
||||
synchronized (_roleNames)
|
||||
{
|
||||
|
|
|
@ -310,7 +310,7 @@ public class JettyRunDistro extends JettyRunMojo
|
|||
* If jetty home does not exist, download it and
|
||||
* unpack to build dir.
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Exception if jetty distribution cannot be found neither downloaded
|
||||
*/
|
||||
public void configureJettyHome() throws Exception
|
||||
{
|
||||
|
@ -341,7 +341,7 @@ public class JettyRunDistro extends JettyRunMojo
|
|||
* @param version the version of the artifact
|
||||
* @param extension the extension type of the artifact eg "zip", "jar"
|
||||
* @return the artifact from the local or remote repo
|
||||
* @throws ArtifactResolverException
|
||||
* @throws ArtifactResolverException in case of an error while resolving the artifact
|
||||
*/
|
||||
public Artifact resolveArtifact (String groupId, String artifactId, String version, String extension)
|
||||
throws ArtifactResolverException
|
||||
|
@ -363,7 +363,7 @@ public class JettyRunDistro extends JettyRunMojo
|
|||
/**
|
||||
* Create or configure a jetty base.
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Exception if any error occured while copying files
|
||||
*/
|
||||
public void configureJettyBase() throws Exception
|
||||
{
|
||||
|
@ -372,9 +372,8 @@ public class JettyRunDistro extends JettyRunMojo
|
|||
|
||||
targetBase = new File(target, "jetty-base");
|
||||
Path targetBasePath = targetBase.toPath();
|
||||
if (Files.exists(targetBasePath))
|
||||
IO.delete(targetBase);
|
||||
|
||||
Files.deleteIfExists(targetBase.toPath());
|
||||
|
||||
targetBase.mkdirs();
|
||||
|
||||
if (jettyBase != null)
|
||||
|
@ -483,7 +482,7 @@ public class JettyRunDistro extends JettyRunMojo
|
|||
* Convert webapp config to properties
|
||||
*
|
||||
* @param file the file to place the properties into
|
||||
* @throws Exception
|
||||
* @throws Exception if any I/O exception during generating the properties file
|
||||
*/
|
||||
public void createPropertiesFile (File file)
|
||||
throws Exception
|
||||
|
@ -496,10 +495,9 @@ public class JettyRunDistro extends JettyRunMojo
|
|||
* Make the command to spawn a process to
|
||||
* run jetty from a distro.
|
||||
*
|
||||
* @return
|
||||
* @return the command configured
|
||||
*/
|
||||
public ProcessBuilder configureCommand()
|
||||
throws Exception
|
||||
{
|
||||
List<String> cmd = new ArrayList<>();
|
||||
cmd.add("java");
|
||||
|
|
|
@ -184,7 +184,7 @@ public class ServerSupport
|
|||
if (files == null || files.isEmpty())
|
||||
return server;
|
||||
|
||||
Map<String,Object> lastMap = new HashMap<String,Object>();
|
||||
Map<String,Object> lastMap = new HashMap<>();
|
||||
|
||||
if (server != null)
|
||||
lastMap.put("Server", server);
|
||||
|
@ -232,7 +232,7 @@ public class ServerSupport
|
|||
* @param files the xml configs to apply
|
||||
* @return the Server after application of configs
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Exception if unable to apply the xml configuration
|
||||
*/
|
||||
public static Server applyXmlConfigurations (Server server, List<File> files)
|
||||
throws Exception
|
||||
|
|
|
@ -240,7 +240,7 @@ public class Starter
|
|||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
* @param args Starter arguments
|
||||
*/
|
||||
public static final void main(String[] args)
|
||||
{
|
||||
|
|
|
@ -20,11 +20,13 @@
|
|||
package org.eclipse.jetty.maven.plugin;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -51,7 +53,7 @@ public class WebAppPropertyConverter
|
|||
* @param webApp the webapp to convert
|
||||
* @param propsFile the file to put the properties into
|
||||
* @param contextXml the optional context xml file related to the webApp
|
||||
* @throws Exception
|
||||
* @throws Exception if any I/O exception occurs
|
||||
*/
|
||||
public static void toProperties(JettyWebAppContext webApp, File propsFile, String contextXml)
|
||||
throws Exception
|
||||
|
@ -112,7 +114,7 @@ public class WebAppPropertyConverter
|
|||
|
||||
//web-inf lib
|
||||
List<File> deps = webApp.getWebInfLib();
|
||||
StringBuffer strbuff = new StringBuffer();
|
||||
StringBuilder strbuff = new StringBuilder();
|
||||
if (deps != null)
|
||||
{
|
||||
for (int i=0; i<deps.size(); i++)
|
||||
|
@ -128,8 +130,9 @@ public class WebAppPropertyConverter
|
|||
//context xml to apply
|
||||
if (contextXml != null)
|
||||
props.put("context.xml", contextXml);
|
||||
|
||||
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(propsFile)))
|
||||
|
||||
|
||||
try (BufferedWriter out = Files.newBufferedWriter(propsFile.toPath()))
|
||||
{
|
||||
props.store(out, "properties for forked webapp");
|
||||
}
|
||||
|
@ -143,7 +146,7 @@ public class WebAppPropertyConverter
|
|||
* @param resource the properties file to apply
|
||||
* @param server the Server instance to use
|
||||
* @param jettyProperties jetty properties to use if there is a context xml file to apply
|
||||
* @throws Exception
|
||||
* @throws Exception if any I/O exception occurs
|
||||
*/
|
||||
public static void fromProperties (JettyWebAppContext webApp, String resource, Server server, Map<String,String> jettyProperties)
|
||||
throws Exception
|
||||
|
@ -161,7 +164,7 @@ public class WebAppPropertyConverter
|
|||
* @param propsFile the properties to apply
|
||||
* @param server the Server instance to use if there is a context xml file to apply
|
||||
* @param jettyProperties jetty properties to use if there is a context xml file to apply
|
||||
* @throws Exception
|
||||
* @throws Exception if any I/O exception occurs
|
||||
*/
|
||||
public static void fromProperties (JettyWebAppContext webApp, File propsFile, Server server, Map<String,String> jettyProperties)
|
||||
throws Exception
|
||||
|
@ -175,7 +178,7 @@ public class WebAppPropertyConverter
|
|||
throw new IllegalArgumentException (propsFile.getCanonicalPath()+" does not exist");
|
||||
|
||||
Properties props = new Properties();
|
||||
try (InputStream in = new FileInputStream(propsFile))
|
||||
try (InputStream in = Files.newInputStream(propsFile.toPath()))
|
||||
{
|
||||
props.load(in);
|
||||
}
|
||||
|
@ -247,7 +250,7 @@ public class WebAppPropertyConverter
|
|||
//the pom to override the context xml file, but as the other mojos all
|
||||
//configure a WebAppContext in the pom (the <webApp> element), it is
|
||||
//already configured by the time the context xml file is applied.
|
||||
str = (String)props.getProperty("context.xml");
|
||||
str = props.getProperty("context.xml");
|
||||
if (!StringUtil.isBlank(str))
|
||||
{
|
||||
XmlConfiguration xmlConfiguration = new XmlConfiguration(Resource.newResource(str).getURI().toURL());
|
||||
|
@ -274,7 +277,7 @@ public class WebAppPropertyConverter
|
|||
*/
|
||||
private static String toCSV (Resource[] resources)
|
||||
{
|
||||
StringBuffer rb = new StringBuffer();
|
||||
StringBuilder rb = new StringBuilder();
|
||||
|
||||
for (Resource r:resources)
|
||||
{
|
||||
|
|
|
@ -87,7 +87,7 @@ public class MemcachedSessionDataMap extends AbstractLifeCycle implements Sessio
|
|||
|
||||
|
||||
/**
|
||||
* @param sec
|
||||
* @param sec the expiry to use in seconds
|
||||
*/
|
||||
public void setExpirySec (int sec)
|
||||
{
|
||||
|
|
|
@ -126,8 +126,7 @@ public class MongoSessionDataStoreFactory extends AbstractSessionDataStoreFactor
|
|||
|
||||
|
||||
/**
|
||||
* @throws MongoException
|
||||
* @throws UnknownHostException
|
||||
* @throws Exception {@link UnknownHostException} if any issue while resolving MongoDB Host
|
||||
* @see org.eclipse.jetty.server.session.SessionDataStoreFactory#getSessionDataStore(org.eclipse.jetty.server.session.SessionHandler)
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -146,7 +146,7 @@ public class ContainerTldBundleDiscoverer implements TldBundleDiscoverer
|
|||
|
||||
/**
|
||||
* Check that jsp is on the classpath
|
||||
* @return
|
||||
* @return <code>true</code> if jsp is available in the environment
|
||||
*/
|
||||
public boolean isJspAvailable()
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ public class ContainerTldBundleDiscoverer implements TldBundleDiscoverer
|
|||
/**
|
||||
* Find the bundle that contains a jstl implementation class, which assumes that
|
||||
* the jstl taglibs will be inside the same bundle.
|
||||
* @return
|
||||
* @return Bundle contains the jstl implementation class
|
||||
*/
|
||||
public Bundle findJstlBundle ()
|
||||
{
|
||||
|
|
|
@ -120,7 +120,7 @@ public class JSTLBundleDiscoverer implements TldBundleDiscoverer
|
|||
* Unsupported: the bundle is a jar that embeds more jars.
|
||||
*
|
||||
* @return array of URLs
|
||||
* @throws Exception
|
||||
* @throws Exception In case of errors during resolving TLDs files
|
||||
*/
|
||||
public URL[] getUrlsForBundlesWithTlds(DeploymentManager deployer, BundleFileLocatorHelper locatorHelper) throws Exception
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ public class WarUrlActivator implements BundleActivator
|
|||
/**
|
||||
* Register the url stream handler factory.
|
||||
*
|
||||
* @param context
|
||||
* @param context the {@link BundleContext} to use
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void start(BundleContext context) throws Exception
|
||||
|
|
|
@ -52,6 +52,7 @@ public class WarURLConnection extends URLConnection
|
|||
* a new temporary file ust to replace the manifest.
|
||||
* @param newmanifest The new manifest
|
||||
* @param rawIn The file input stream or equivalent. not the jar input stream.
|
||||
* @throws IOException if an I/O error occurs.
|
||||
*/
|
||||
public static InputStream substitueManifest(final Manifest newmanifest,
|
||||
final InputStream rawIn) throws IOException
|
||||
|
@ -106,6 +107,7 @@ public class WarURLConnection extends URLConnection
|
|||
* @param url The file url (for example)
|
||||
* @param mf The manifest to use as a replacement to the jar file inside
|
||||
* the file url.
|
||||
* @throws IOException if an I/O error occurs.
|
||||
*/
|
||||
public WarURLConnection(URL url, Manifest mf) throws IOException
|
||||
{
|
||||
|
|
|
@ -33,10 +33,10 @@ public interface TldBundleDiscoverer
|
|||
/**
|
||||
* Find bundles that contain tlds and convert into URL references to their location.
|
||||
*
|
||||
* @param manager
|
||||
* @param fileLocator
|
||||
* @param manager The {@link DeploymentManager} instance to use
|
||||
* @param fileLocator the {@link BundleFileLocatorHelper} instance to use
|
||||
* @return array of URLs representing locations of tld containing bundles
|
||||
* @throws Exception
|
||||
* @throws Exception In case of errors during resolving TLDs files
|
||||
*/
|
||||
URL[] getUrlsForBundlesWithTlds(DeploymentManager manager, BundleFileLocatorHelper fileLocator) throws Exception;
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@ public class Util
|
|||
/**
|
||||
* Create an osgi filter for the given classname and server name.
|
||||
*
|
||||
* @param bundleContext
|
||||
* @param bundleContext the {@link BundleContext} instance to use
|
||||
* @param classname the class to match on the filter
|
||||
* @param managedServerName the name of the jetty server instance
|
||||
* @return a new filter
|
||||
*
|
||||
* @throws InvalidSyntaxException
|
||||
* @throws InvalidSyntaxException If the filter contains an invalid string that cannot be parsed.
|
||||
*/
|
||||
public static Filter createFilter (BundleContext bundleContext, String classname, String managedServerName) throws InvalidSyntaxException
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ public abstract class NamingEntry
|
|||
*
|
||||
* @param scope an object representing the scope of the name to be bound into jndi, where null means jvm scope.
|
||||
* @param jndiName the name that will be associated with an object bound into jndi
|
||||
* @throws NamingException
|
||||
* @throws NamingException if jndiName is null
|
||||
*/
|
||||
protected NamingEntry (Object scope, String jndiName)
|
||||
throws NamingException
|
||||
|
|
|
@ -123,7 +123,7 @@ public class QuickStartDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
* @param context the webapp
|
||||
* @param descriptor the xml file to process
|
||||
* @param node the context-param node in the xml file
|
||||
* @throws Exception
|
||||
* @throws Exception if some resources cannot be read
|
||||
*/
|
||||
public void visitContextParam (WebAppContext context, Descriptor descriptor, XmlParser.Node node)
|
||||
throws Exception
|
||||
|
|
|
@ -30,12 +30,12 @@ import org.eclipse.jetty.util.log.Log;
|
|||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/**
|
||||
* A Connection Listener that limits the number of Connections.
|
||||
* <p>A Connection Listener that limits the number of Connections.</p>
|
||||
* <p>This listener applies a limit to the number of connections, which when
|
||||
* exceeded results in a call to {@link AbstractConnector#setAccepting(boolean)}
|
||||
* to prevent further connections being received. It can be applied to an
|
||||
* entire server or to a specific connector.
|
||||
* <p>
|
||||
* </p>
|
||||
* @see Connection.Listener
|
||||
*/
|
||||
@ManagedObject
|
||||
|
|
|
@ -86,10 +86,10 @@ public class ForwardedRequestCustomizer implements Customizer
|
|||
}
|
||||
|
||||
/**
|
||||
* Configure to only support the RFC7239 Forwarded header and to
|
||||
* not support any {@code X-Forwarded-} headers. This convenience method
|
||||
* clears all the non RFC headers if passed true and sets them to
|
||||
* the default values (if not already set) if passed false.
|
||||
* @param rfc7239only Configure to only support the RFC7239 Forwarded header and to
|
||||
* not support any {@code X-Forwarded-} headers. This convenience method
|
||||
* clears all the non RFC headers if passed true and sets them to
|
||||
* the default values (if not already set) if passed false.
|
||||
* @param rfc7239only Configure to support only RFC7239
|
||||
*/
|
||||
public void setForwardedOnly(boolean rfc7239only)
|
||||
|
|
|
@ -1249,6 +1249,7 @@ public class HttpChannelState
|
|||
* Called to indicate that more content may be available,
|
||||
* but that a handling thread may need to produce (fill/parse)
|
||||
* it. Typically called by the async read success callback.
|
||||
* @return <code>true</code> if more content may be available
|
||||
*/
|
||||
public boolean onReadPossible()
|
||||
{
|
||||
|
@ -1279,7 +1280,7 @@ public class HttpChannelState
|
|||
/**
|
||||
* Called to signal that a read has read -1.
|
||||
* Will wake if the read was called while in ASYNC_WAIT state
|
||||
* @return true if woken
|
||||
* @return <code>true</code> if woken
|
||||
*/
|
||||
public boolean onReadEof()
|
||||
{
|
||||
|
|
|
@ -44,23 +44,27 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
/**
|
||||
* {@link HttpInput} provides an implementation of {@link ServletInputStream} for {@link HttpChannel}.
|
||||
* <p>
|
||||
* Content may arrive in patterns such as [content(), content(), messageComplete()] so that this class maintains two states: the content state that tells
|
||||
* whether there is content to consume and the EOF state that tells whether an EOF has arrived. Only once the content has been consumed the content state is
|
||||
* moved to the EOF state.
|
||||
* Content may arrive in patterns such as [content(), content(), messageComplete()]
|
||||
* so that this class maintains two states: the content state that tells
|
||||
* whether there is content to consume and the EOF state that tells whether an EOF has arrived.
|
||||
* Only once the content has been consumed the content state is moved to the EOF state.
|
||||
* </p>
|
||||
*/
|
||||
public class HttpInput extends ServletInputStream implements Runnable
|
||||
{
|
||||
/**
|
||||
* An interceptor for HTTP Request input.
|
||||
* <p>
|
||||
* Unlike inputstream wrappers that can be applied by filters, an interceptor
|
||||
* Unlike InputStream wrappers that can be applied by filters, an interceptor
|
||||
* is entirely transparent and works with async IO APIs.
|
||||
* </p>
|
||||
* <p>
|
||||
* An Interceptor may consume data from the passed content and the interceptor
|
||||
* will continue to be called for the same content until the interceptor returns
|
||||
* null or an empty content. Thus even if the passed content is completely consumed
|
||||
* null or an empty content. Thus even if the passed content is completely consumed
|
||||
* the interceptor will be called with the same content until it can no longer
|
||||
* produce more content.
|
||||
* produce more content.
|
||||
* </p>
|
||||
* @see HttpInput#setInterceptor(Interceptor)
|
||||
* @see HttpInput#addInterceptor(Interceptor)
|
||||
*/
|
||||
|
@ -77,8 +81,8 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
|
||||
/**
|
||||
* An {@link Interceptor} that chains two other {@link Interceptor}s together.
|
||||
* The {@link #readFrom(Content)} calls the previous {@link Interceptor}'s
|
||||
* {@link #readFrom(Content)} and then passes any {@link Content} returned
|
||||
* The {@link Interceptor#readFrom(Content)} calls the previous {@link Interceptor}'s
|
||||
* {@link Interceptor#readFrom(Content)} and then passes any {@link Content} returned
|
||||
* to the next {@link Interceptor}.
|
||||
*/
|
||||
public static class ChainedInterceptor implements Interceptor, Destroyable
|
||||
|
@ -335,6 +339,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
/**
|
||||
* Called by channel when asynchronous IO needs to produce more content
|
||||
* @throws IOException
|
||||
* if unable to produce content
|
||||
*/
|
||||
public void asyncReadProduce() throws IOException
|
||||
{
|
||||
|
|
|
@ -57,14 +57,18 @@ import org.eclipse.jetty.util.thread.Scheduler;
|
|||
* use all the commons services (eg {@link Executor}, {@link Scheduler}) of the
|
||||
* passed {@link Server} instance, but all services may also be constructor injected
|
||||
* into the connector so that it may operate with dedicated or otherwise shared services.
|
||||
* </p>
|
||||
* <h2>Connection Factories</h2>
|
||||
* <p>
|
||||
* Various convenience constructors are provided to assist with common configurations of
|
||||
* ConnectionFactories, whose generic use is described in {@link AbstractConnector}.
|
||||
* If no connection factories are passed, then the connector will
|
||||
* default to use a {@link HttpConnectionFactory}. If an non null {@link SslContextFactory}
|
||||
* instance is passed, then this used to instantiate a {@link SslConnectionFactory} which is
|
||||
* prepended to the other passed or default factories.
|
||||
* </p>
|
||||
* <h2>Selectors</h2>
|
||||
* <p>
|
||||
* The connector will use the {@link Executor} service to execute a number of Selector Tasks,
|
||||
* which are implemented to each use a NIO {@link Selector} instance to asynchronously
|
||||
* schedule a set of accepted connections. It is the selector thread that will call the
|
||||
|
@ -72,10 +76,12 @@ import org.eclipse.jetty.util.thread.Scheduler;
|
|||
* {@link EndPoint#write(Callback, java.nio.ByteBuffer...)} methods. It is expected
|
||||
* that these callbacks may do some non-blocking IO work, but will always dispatch to the
|
||||
* {@link Executor} service any blocking, long running or application tasks.
|
||||
* </p>
|
||||
* <p>
|
||||
* The default number of selectors is equal to half of the number of processors available to the JVM,
|
||||
* which should allow optimal performance even if all the connections used are performing
|
||||
* significant non-blocking work in the callback tasks.
|
||||
* </p>
|
||||
*/
|
||||
@ManagedObject("HTTP connector using NIO ByteChannels and Selectors")
|
||||
public class ServerConnector extends AbstractNetworkConnector
|
||||
|
@ -281,7 +287,7 @@ public class ServerConnector extends AbstractNetworkConnector
|
|||
* This open method can be called before starting the connector to pass it a ServerSocketChannel
|
||||
* that will be used instead of one returned from {@link #openAcceptChannel()}
|
||||
* @param acceptChannel the channel to use
|
||||
* @throws IOException
|
||||
* @throws IOException if the server channel is not bound
|
||||
*/
|
||||
public void open(ServerSocketChannel acceptChannel) throws IOException
|
||||
{
|
||||
|
@ -311,7 +317,7 @@ public class ServerConnector extends AbstractNetworkConnector
|
|||
/**
|
||||
* Called by {@link #open()} to obtain the accepting channel.
|
||||
* @return ServerSocketChannel used to accept connections.
|
||||
* @throws IOException
|
||||
* @throws IOException if unable to obtain or configure the server channel
|
||||
*/
|
||||
protected ServerSocketChannel openAcceptChannel() throws IOException
|
||||
{
|
||||
|
|
|
@ -152,6 +152,8 @@ public class ErrorHandler extends AbstractHandler
|
|||
* @param baseRequest The base request
|
||||
* @param request The servlet request (may be wrapped)
|
||||
* @param response The response (may be wrapped)
|
||||
* @param code the http error code
|
||||
* @param message the http error message
|
||||
* @throws IOException if the response cannot be generated
|
||||
*/
|
||||
protected void generateAcceptableResponse(Request baseRequest, HttpServletRequest request, HttpServletResponse response, int code, String message)
|
||||
|
@ -230,6 +232,8 @@ public class ErrorHandler extends AbstractHandler
|
|||
* @param baseRequest The base request
|
||||
* @param request The servlet request (may be wrapped)
|
||||
* @param response The response (may be wrapped)
|
||||
* @param code the http error code
|
||||
* @param message the http error message
|
||||
* @param mimeType The mimetype to generate (may be */*or other wildcard)
|
||||
* @throws IOException if a response cannot be generated
|
||||
*/
|
||||
|
|
|
@ -24,7 +24,10 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.server.HttpChannel;
|
||||
import org.eclipse.jetty.server.HttpConnection;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.Response;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -148,6 +151,22 @@ public abstract class ScopedHandler extends HandlerWrapper
|
|||
/**
|
||||
* Scope the handler
|
||||
* <p>Derived implementations should call {@link #nextScope(String, Request, HttpServletRequest, HttpServletResponse)}
|
||||
* @param target
|
||||
* The target of the request - either a URI or a name.
|
||||
* @param baseRequest
|
||||
* The original unwrapped request object.
|
||||
* @param request
|
||||
* The request either as the {@link Request} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getRequest() getRequest()}</code>
|
||||
* method can be used access the Request object if required.
|
||||
* @param response
|
||||
* The response as the {@link Response} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getResponse() getResponse()}</code>
|
||||
* method can be used access the Response object if required.
|
||||
* @throws IOException
|
||||
* if unable to handle the request or response processing
|
||||
* @throws ServletException
|
||||
* if unable to handle the request or response due to underlying servlet issue
|
||||
*/
|
||||
public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
|
@ -158,6 +177,22 @@ public abstract class ScopedHandler extends HandlerWrapper
|
|||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Scope the handler
|
||||
* @param target
|
||||
* The target of the request - either a URI or a name.
|
||||
* @param baseRequest
|
||||
* The original unwrapped request object.
|
||||
* @param request
|
||||
* The request either as the {@link Request} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getRequest() getRequest()}</code>
|
||||
* method can be used access the Request object if required.
|
||||
* @param response
|
||||
* The response as the {@link Response} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getResponse() getResponse()}</code>
|
||||
* method can be used access the Response object if required.
|
||||
* @throws IOException
|
||||
* if unable to handle the request or response processing
|
||||
* @throws ServletException
|
||||
* if unable to handle the request or response due to underlying servlet issue
|
||||
*/
|
||||
public final void nextScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
|
@ -173,7 +208,23 @@ public abstract class ScopedHandler extends HandlerWrapper
|
|||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Do the handler work within the scope.
|
||||
* <p>Derived implementations should call {@link #nextHandle(String, Request, HttpServletRequest, HttpServletResponse)}
|
||||
* <p>Derived implementations should call {@link #nextHandle(String, Request, HttpServletRequest, HttpServletResponse)}
|
||||
* @param target
|
||||
* The target of the request - either a URI or a name.
|
||||
* @param baseRequest
|
||||
* The original unwrapped request object.
|
||||
* @param request
|
||||
* The request either as the {@link Request} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getRequest() getRequest()}</code>
|
||||
* method can be used access the Request object if required.
|
||||
* @param response
|
||||
* The response as the {@link Response} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getResponse() getResponse()}</code>
|
||||
* method can be used access the Response object if required.
|
||||
* @throws IOException
|
||||
* if unable to handle the request or response processing
|
||||
* @throws ServletException
|
||||
* if unable to handle the request or response due to underlying servlet issue
|
||||
*/
|
||||
public abstract void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException;
|
||||
|
@ -181,6 +232,22 @@ public abstract class ScopedHandler extends HandlerWrapper
|
|||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* Do the handler work within the scope.
|
||||
* @param target
|
||||
* The target of the request - either a URI or a name.
|
||||
* @param baseRequest
|
||||
* The original unwrapped request object.
|
||||
* @param request
|
||||
* The request either as the {@link Request} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getRequest() getRequest()}</code>
|
||||
* method can be used access the Request object if required.
|
||||
* @param response
|
||||
* The response as the {@link Response} object or a wrapper of that request. The
|
||||
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getResponse() getResponse()}</code>
|
||||
* method can be used access the Response object if required.
|
||||
* @throws IOException
|
||||
* if unable to handle the request or response processing
|
||||
* @throws ServletException
|
||||
* if unable to handle the request or response due to underlying servlet issue
|
||||
*/
|
||||
public final void nextHandle(String target, final Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
@ -30,7 +29,6 @@ import org.eclipse.jetty.util.StringUtil;
|
|||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.DumpableCollection;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.Locker.Lock;
|
||||
|
@ -177,7 +175,7 @@ public abstract class AbstractSessionCache extends ContainerLifeCycle implements
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param handler the {@link SessionHandler} to use
|
||||
*/
|
||||
public AbstractSessionCache (SessionHandler handler)
|
||||
{
|
||||
|
@ -309,7 +307,7 @@ public abstract class AbstractSessionCache extends ContainerLifeCycle implements
|
|||
* If a session's data cannot be loaded from the store without error, remove
|
||||
* it from the persistent store.
|
||||
*
|
||||
* @param removeUnloadableSessions
|
||||
* @param removeUnloadableSessions if <code>true</code> unloadable sessions will be removed from session store
|
||||
*/
|
||||
@Override
|
||||
public void setRemoveUnloadableSessions(boolean removeUnloadableSessions)
|
||||
|
|
|
@ -61,8 +61,8 @@ public class CachingSessionDataStore extends ContainerLifeCycle implements Sessi
|
|||
|
||||
|
||||
/**
|
||||
* @param cache
|
||||
* @param store
|
||||
* @param cache the front cache to use
|
||||
* @param store the actual store for the the session data
|
||||
*/
|
||||
public CachingSessionDataStore (SessionDataMap cache, SessionDataStore store)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ public class DefaultSessionCache extends AbstractSessionCache
|
|||
|
||||
|
||||
/**
|
||||
* @param manager
|
||||
* @param manager The SessionHandler related to this SessionCache
|
||||
*/
|
||||
public DefaultSessionCache (SessionHandler manager)
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory
|
|||
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return the removeUnloadableSessions
|
||||
*/
|
||||
public boolean isRemoveUnloadableSessions()
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory
|
|||
|
||||
|
||||
/**
|
||||
* @param removeUnloadableSessions
|
||||
* @param removeUnloadableSessions the removeUnloadableSessions to set
|
||||
*/
|
||||
public void setRemoveUnloadableSessions(boolean removeUnloadableSessions)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory
|
|||
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return the evictionPolicy
|
||||
*/
|
||||
public int getEvictionPolicy()
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory
|
|||
|
||||
|
||||
/**
|
||||
* @param evictionPolicy
|
||||
* @param evictionPolicy the evictionPolicy to set
|
||||
*/
|
||||
public void setEvictionPolicy(int evictionPolicy)
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory
|
|||
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return the saveOnInactiveEvict
|
||||
*/
|
||||
public boolean isSaveOnInactiveEvict()
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory
|
|||
|
||||
|
||||
/**
|
||||
* @param saveOnInactiveEvict
|
||||
* @param saveOnInactiveEvict the saveOnInactiveEvict to set
|
||||
*/
|
||||
public void setSaveOnInactiveEvict(boolean saveOnInactiveEvict)
|
||||
{
|
||||
|
|
|
@ -107,9 +107,9 @@ public class HouseKeeper extends AbstractLifeCycle
|
|||
* Get a scheduler. First try a common scheduler, failing that
|
||||
* create our own.
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Exception when the scheduler cannot be started
|
||||
*/
|
||||
protected void findScheduler () throws Exception
|
||||
protected void findScheduler() throws Exception
|
||||
{
|
||||
if (_scheduler == null)
|
||||
{
|
||||
|
@ -133,9 +133,9 @@ public class HouseKeeper extends AbstractLifeCycle
|
|||
|
||||
/**
|
||||
* If scavenging is not scheduled, schedule it.
|
||||
* @throws Exception
|
||||
* @throws Exception if any error during scheduling the scavenging
|
||||
*/
|
||||
protected void startScavenging() throws Exception
|
||||
protected void startScavenging() throws Exception
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ public class HouseKeeper extends AbstractLifeCycle
|
|||
/**
|
||||
* If scavenging is scheduled, stop it.
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Exception if any error during stopping the scavenging
|
||||
*/
|
||||
protected void stopScavenging() throws Exception
|
||||
{
|
||||
|
@ -195,9 +195,9 @@ public class HouseKeeper extends AbstractLifeCycle
|
|||
/**
|
||||
* Set the period between scavenge cycles
|
||||
* @param sec the interval (in seconds)
|
||||
* @throws Exception
|
||||
* @throws Exception if any error during restarting the scavenging
|
||||
*/
|
||||
public void setIntervalSec (long sec) throws Exception
|
||||
public void setIntervalSec(long sec) throws Exception
|
||||
{
|
||||
if (isStarted() || isStarting())
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ public class JDBCSessionDataStoreFactory extends AbstractSessionDataStoreFactory
|
|||
|
||||
|
||||
/**
|
||||
* @param adaptor
|
||||
* @param adaptor the {@link DatabaseAdaptor} to set
|
||||
*/
|
||||
public void setDatabaseAdaptor (DatabaseAdaptor adaptor)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ public class JDBCSessionDataStoreFactory extends AbstractSessionDataStoreFactory
|
|||
|
||||
|
||||
/**
|
||||
* @param schema
|
||||
* @param schema the {@link JDBCSessionDataStoreFactory} to set
|
||||
*/
|
||||
public void setSessionTableSchema (JDBCSessionDataStore.SessionTableSchema schema)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ public class NullSessionCache extends AbstractSessionCache
|
|||
{
|
||||
|
||||
/**
|
||||
* @param handler
|
||||
* @param handler The SessionHandler related to this SessionCache
|
||||
*/
|
||||
public NullSessionCache(SessionHandler handler)
|
||||
{
|
||||
|
|
|
@ -297,6 +297,7 @@ public class Session implements SessionHandler.SessionIf
|
|||
* @param name name of the attribute
|
||||
* @param newValue new value of the attribute
|
||||
* @param oldValue previous value of the attribute
|
||||
* @throws IllegalStateException if no session manager can be find
|
||||
*/
|
||||
protected void callSessionAttributeListeners (String name, Object newValue, Object oldValue)
|
||||
{
|
||||
|
@ -915,10 +916,10 @@ public class Session implements SessionHandler.SessionIf
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/** Call HttpSessionAttributeListeners as part of invalidating
|
||||
* a Session.
|
||||
/**
|
||||
* Call HttpSessionAttributeListeners as part of invalidating a Session.
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
* @throws IllegalStateException if no session manager can be find
|
||||
*/
|
||||
@Deprecated
|
||||
protected void doInvalidate() throws IllegalStateException
|
||||
|
@ -931,7 +932,7 @@ public class Session implements SessionHandler.SessionIf
|
|||
/** Call HttpSessionAttributeListeners as part of invalidating
|
||||
* a Session.
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
* @throws IllegalStateException if no session manager can be find
|
||||
*/
|
||||
protected void finishInvalidate() throws IllegalStateException
|
||||
{
|
||||
|
|
|
@ -63,7 +63,7 @@ public interface SessionCache extends LifeCycle
|
|||
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param context the {@link SessionContext} to use for this cache
|
||||
*/
|
||||
void initialize(SessionContext context);
|
||||
|
||||
|
@ -76,17 +76,17 @@ public interface SessionCache extends LifeCycle
|
|||
/**
|
||||
* Create an entirely new Session.
|
||||
*
|
||||
* @param request
|
||||
* @param id
|
||||
* @param time
|
||||
* @param maxInactiveMs
|
||||
* @param request the request
|
||||
* @param id the unique id associated to the session
|
||||
* @param time the timestamp of the session creation
|
||||
* @param maxInactiveMs the max inactive time in milliseconds
|
||||
* @return a new Session
|
||||
*/
|
||||
Session newSession (HttpServletRequest request, String id, long time, long maxInactiveMs);
|
||||
|
||||
/**
|
||||
* Re-materialize a Session that has previously existed.
|
||||
* @param data
|
||||
* @param data the data associated with the session
|
||||
* @return a Session object for the data supplied
|
||||
*/
|
||||
Session newSession (SessionData data);
|
||||
|
@ -95,10 +95,10 @@ public interface SessionCache extends LifeCycle
|
|||
/**
|
||||
* Change the id of a Session.
|
||||
*
|
||||
* @param oldId
|
||||
* @param newId
|
||||
* @param oldId the current session id
|
||||
* @param newId the new session id
|
||||
* @return the Session after changing its id
|
||||
* @throws Exception
|
||||
* @throws Exception if any error occurred
|
||||
*/
|
||||
Session renewSessionId (String oldId, String newId) throws Exception;
|
||||
|
||||
|
@ -107,9 +107,9 @@ public interface SessionCache extends LifeCycle
|
|||
* Get an existing Session. If necessary, the cache will load the data for
|
||||
* the session from the configured SessionDataStore.
|
||||
*
|
||||
* @param id
|
||||
* @param id the session id
|
||||
* @return the Session if one exists, null otherwise
|
||||
* @throws Exception
|
||||
* @throws Exception if any error occurred
|
||||
*/
|
||||
Session get(String id) throws Exception;
|
||||
|
||||
|
@ -120,9 +120,9 @@ public interface SessionCache extends LifeCycle
|
|||
* implementations may want to delay writing out Session contents
|
||||
* until the last request exits a Session.
|
||||
*
|
||||
* @param id
|
||||
* @param session
|
||||
* @throws Exception
|
||||
* @param id the session id
|
||||
* @param session the current session object
|
||||
* @throws Exception if any error occurred
|
||||
*/
|
||||
void put(String id, Session session) throws Exception;
|
||||
|
||||
|
@ -131,10 +131,10 @@ public interface SessionCache extends LifeCycle
|
|||
* Check to see if a Session is in the cache. Does NOT consult
|
||||
* the SessionDataStore.
|
||||
*
|
||||
* @param id
|
||||
* @param id the session id
|
||||
* @return true if a Session object matching the id is present
|
||||
* in the cache, false otherwise
|
||||
* @throws Exception
|
||||
* @throws Exception if any error occurred
|
||||
*/
|
||||
boolean contains (String id) throws Exception;
|
||||
|
||||
|
@ -143,9 +143,9 @@ public interface SessionCache extends LifeCycle
|
|||
* Check to see if a session exists: WILL consult the
|
||||
* SessionDataStore.
|
||||
*
|
||||
* @param id
|
||||
* @param id the session id
|
||||
* @return true if the session exists, false otherwise
|
||||
* @throws Exception
|
||||
* @throws Exception if any error occurred
|
||||
*/
|
||||
boolean exists (String id) throws Exception;
|
||||
|
||||
|
@ -154,9 +154,9 @@ public interface SessionCache extends LifeCycle
|
|||
* Remove a Session completely: from both this
|
||||
* cache and the SessionDataStore.
|
||||
*
|
||||
* @param id
|
||||
* @param id the session id
|
||||
* @return the Session that was removed, null otherwise
|
||||
* @throws Exception
|
||||
* @throws Exception if any error occurred
|
||||
*/
|
||||
Session delete (String id) throws Exception;
|
||||
|
||||
|
@ -177,7 +177,7 @@ public interface SessionCache extends LifeCycle
|
|||
* Check a Session to see if it might be appropriate to
|
||||
* evict or expire.
|
||||
*
|
||||
* @param session
|
||||
* @param session the session to check
|
||||
*/
|
||||
void checkInactiveSession(Session session);
|
||||
|
||||
|
@ -185,9 +185,14 @@ public interface SessionCache extends LifeCycle
|
|||
/**
|
||||
* A SessionDataStore that is the authoritative source
|
||||
* of session information.
|
||||
* @param sds
|
||||
* @param sds the {@link SessionDataStore} to use
|
||||
*/
|
||||
void setSessionDataStore(SessionDataStore sds);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the {@link SessionDataStore} used
|
||||
*/
|
||||
SessionDataStore getSessionDataStore();
|
||||
|
||||
|
||||
|
@ -204,15 +209,25 @@ public interface SessionCache extends LifeCycle
|
|||
* be evicted.
|
||||
*/
|
||||
void setEvictionPolicy (int policy);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the eviction policy
|
||||
*/
|
||||
int getEvictionPolicy ();
|
||||
|
||||
/**
|
||||
* Whether or not a a session that is about to be evicted should
|
||||
* be saved before being evicted.
|
||||
*
|
||||
* @param saveOnEvict
|
||||
* @param saveOnEvict <code>true</code> if the session should be saved before being evicted
|
||||
*/
|
||||
void setSaveOnInactiveEviction (boolean saveOnEvict);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return <code>true</code> if the session should be saved before being evicted
|
||||
*/
|
||||
boolean isSaveOnInactiveEviction ();
|
||||
|
||||
|
||||
|
@ -221,9 +236,14 @@ public interface SessionCache extends LifeCycle
|
|||
* immediately saved. If false, a session that is created and
|
||||
* invalidated within a single request is never persisted.
|
||||
*
|
||||
* @param saveOnCreate
|
||||
* @param saveOnCreate <code>true</code> to immediately save the newly created session
|
||||
*/
|
||||
void setSaveOnCreate(boolean saveOnCreate);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return if <code>true</code> the newly created session will be saved immediately
|
||||
*/
|
||||
boolean isSaveOnCreate();
|
||||
|
||||
|
||||
|
@ -231,8 +251,13 @@ public interface SessionCache extends LifeCycle
|
|||
* If the data for a session exists but is unreadable,
|
||||
* the SessionCache can instruct the SessionDataStore to delete it.
|
||||
*
|
||||
* @param removeUnloadableSessions
|
||||
* @param removeUnloadableSessions <code>true</code> to delete session which cannot be loaded
|
||||
*/
|
||||
void setRemoveUnloadableSessions(boolean removeUnloadableSessions);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return if <code>true</code> unloadable session will be deleted
|
||||
*/
|
||||
boolean isRemoveUnloadableSessions();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public interface SessionDataMap extends LifeCycle
|
|||
* be used by one context(/session manager).
|
||||
*
|
||||
* @param context context associated
|
||||
* @throws Exception if unable to initialize the
|
||||
*/
|
||||
void initialize(SessionContext context) throws Exception;
|
||||
|
||||
|
|
|
@ -1006,7 +1006,7 @@ public class SessionHandler extends ScopedHandler
|
|||
|
||||
|
||||
/**
|
||||
* @param cache
|
||||
* @param cache the session store to use
|
||||
*/
|
||||
public void setSessionCache (SessionCache cache)
|
||||
{
|
||||
|
@ -1294,7 +1294,7 @@ public class SessionHandler extends ScopedHandler
|
|||
* configurable amount of time, or the session itself
|
||||
* has passed its expiry.
|
||||
*
|
||||
* @param session
|
||||
* @param session the session
|
||||
*/
|
||||
public void sessionInactivityTimerExpired (Session session)
|
||||
{
|
||||
|
@ -1349,8 +1349,8 @@ public class SessionHandler extends ScopedHandler
|
|||
*
|
||||
* @param id identity of session to check
|
||||
*
|
||||
* @return true if this manager knows about this id
|
||||
* @throws Exception
|
||||
* @return <code>true</code> if this manager knows about this id
|
||||
* @throws Exception if any error occurred
|
||||
*/
|
||||
public boolean isIdInUse(String id) throws Exception
|
||||
{
|
||||
|
|
|
@ -52,14 +52,14 @@ public class UnreadableSessionDataException extends Exception
|
|||
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param contextId
|
||||
* @param t
|
||||
* @param id the session id
|
||||
* @param sessionContext the sessionContext
|
||||
* @param t the cause of the exception
|
||||
*/
|
||||
public UnreadableSessionDataException (String id, SessionContext contextId, Throwable t)
|
||||
public UnreadableSessionDataException (String id, SessionContext sessionContext, Throwable t)
|
||||
{
|
||||
super ("Unreadable session "+id+" for "+contextId, t);
|
||||
_sessionContext = contextId;
|
||||
super ("Unreadable session "+id+" for "+sessionContext, t);
|
||||
_sessionContext = sessionContext;
|
||||
_id = id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -834,7 +834,10 @@ public class ServletHandler extends ScopedHandler
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Create a new CachedChain
|
||||
* Create a new CachedChain
|
||||
* @param filters the filter chain to be cached as a collection of {@link FilterHolder}
|
||||
* @param servletHolder the servletHolder
|
||||
* @return a new {@link CachedChain} instance
|
||||
*/
|
||||
public CachedChain newCachedChain(List<FilterHolder> filters, ServletHolder servletHolder)
|
||||
{
|
||||
|
@ -1590,7 +1593,7 @@ public class ServletHandler extends ScopedHandler
|
|||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param filters list of {@link FilterHolder} objects
|
||||
* @param servletHolder
|
||||
* @param servletHolder the current {@link ServletHolder}
|
||||
*/
|
||||
protected CachedChain(List<FilterHolder> filters, ServletHolder servletHolder)
|
||||
{
|
||||
|
|
|
@ -511,6 +511,9 @@ public class DoSFilter implements Filter
|
|||
}
|
||||
|
||||
/**
|
||||
* @param request the current request
|
||||
* @param response the current response
|
||||
* @param thread the handling thread
|
||||
* Get priority for this request, based on user type
|
||||
*
|
||||
* @param request the current request
|
||||
|
|
|
@ -49,6 +49,7 @@ public class MultiReleaseJarFile implements Closeable
|
|||
/**
|
||||
* Construct a multi release jar file for the current JVM version, ignoring directories.
|
||||
* @param file The file to open
|
||||
* @throws IOException if the jar file cannot be read
|
||||
*/
|
||||
public MultiReleaseJarFile(File file) throws IOException
|
||||
{
|
||||
|
|
|
@ -48,6 +48,7 @@ public class Locker
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the lock to unlock
|
||||
* @return whether this lock has been acquired
|
||||
*/
|
||||
public boolean isLocked()
|
||||
|
|
|
@ -89,8 +89,9 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements Executo
|
|||
/**
|
||||
* @param executor The executor to use to obtain threads
|
||||
* @param capacity The number of threads to preallocate. If less than 0 then capacity
|
||||
* is calculated based on a heuristic from the number of available processors and
|
||||
* thread pool size.
|
||||
* is calculated based on a heuristic from the number of available processors and
|
||||
* thread pool size.
|
||||
* @param owner the owner of the instance. Only used for debugging purpose withing the {@link #toString()} method
|
||||
*/
|
||||
public ReservedThreadExecutor(Executor executor,int capacity, Object owner)
|
||||
{
|
||||
|
|
|
@ -378,7 +378,7 @@ public class MetaInfConfiguration extends AbstractConfiguration
|
|||
* @param context the context for the scan
|
||||
* @param jars the jars to scan
|
||||
* @param useCaches if true, the scanned info is cached
|
||||
* @throws Exception
|
||||
* @throws Exception if unable to scan the jars
|
||||
*/
|
||||
public void scanJars (final WebAppContext context, Collection<Resource> jars, boolean useCaches)
|
||||
throws Exception
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.eclipse.jetty.websocket.common.scopes.SimpleContainerScope;
|
|||
/**
|
||||
* Client {@link ContainerProvider} implementation.
|
||||
* <p>
|
||||
* <p>
|
||||
* Created by a {@link java.util.ServiceLoader} call in the
|
||||
* {@link javax.websocket.ContainerProvider#getWebSocketContainer()} call.
|
||||
* </p>
|
||||
|
@ -80,7 +79,6 @@ public class JettyClientContainerProvider extends ContainerProvider
|
|||
* find and return the {@code javax.websocket.server.ServerContainer} from the
|
||||
* active {@code javax.servlet.ServletContext}.
|
||||
* <p>
|
||||
* <p>
|
||||
* This will only work if the call to {@link ContainerProvider#getWebSocketContainer()}
|
||||
* occurs within a thread being processed by the Servlet container.
|
||||
* </p>
|
||||
|
|
|
@ -83,13 +83,20 @@ public class ServerContainer extends ClientContainer implements javax.websocket.
|
|||
|
||||
/**
|
||||
* @deprecated use {@code ServerContainer(NativeWebSocketConfiguration, HttpClient)} instead
|
||||
* @param configuration the {@link NativeWebSocketConfiguration} to use
|
||||
* @param executor not used
|
||||
*/
|
||||
@Deprecated
|
||||
public ServerContainer(NativeWebSocketConfiguration configuration, Executor executor)
|
||||
{
|
||||
this(configuration, (HttpClient) null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param configuration the {@link NativeWebSocketConfiguration} to use
|
||||
* @param httpClient the {@link HttpClient} instance to use
|
||||
*/
|
||||
public ServerContainer(NativeWebSocketConfiguration configuration, HttpClient httpClient)
|
||||
{
|
||||
super(configuration.getFactory(), httpClient);
|
||||
|
|
|
@ -176,6 +176,10 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
|
|||
|
||||
/**
|
||||
* @deprecated use {@link #configureContext(ServletContextHandler)} instead
|
||||
* @param context not used
|
||||
* @param jettyContext the {@link ServletContextHandler} to use
|
||||
* @return a configured {@link ServerContainer} instance
|
||||
* @throws ServletException if the {@link WebSocketUpgradeFilter} cannot be configured
|
||||
*/
|
||||
@Deprecated
|
||||
public static ServerContainer configureContext(ServletContext context, ServletContextHandler jettyContext) throws ServletException
|
||||
|
|
|
@ -263,6 +263,8 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
* the Container Scope
|
||||
* @param sessionFactory
|
||||
* the SessionFactory to use
|
||||
* @param httpClient
|
||||
* the httpClient to use
|
||||
*/
|
||||
public WebSocketClient(final WebSocketContainerScope scope, SessionFactory sessionFactory, HttpClient httpClient)
|
||||
{
|
||||
|
@ -462,6 +464,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
|
||||
/**
|
||||
* @deprecated not used, no replacement
|
||||
* @return a {@link RandomMasker} instance
|
||||
*/
|
||||
@Deprecated
|
||||
public Masker getMasker()
|
||||
|
@ -649,6 +652,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
|
||||
/**
|
||||
* @deprecated not used, configure threading in HttpClient instead
|
||||
* @param daemon do nothing
|
||||
*/
|
||||
@Deprecated
|
||||
public void setDaemon(boolean daemon)
|
||||
|
@ -669,6 +673,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
|
||||
/**
|
||||
* @deprecated not used, no replacement
|
||||
* @param masker do nothing
|
||||
*/
|
||||
@Deprecated
|
||||
public void setMasker(Masker masker)
|
||||
|
|
|
@ -362,7 +362,8 @@ public class WebSocketUpgradeRequest extends HttpRequest implements CompleteList
|
|||
* Exists for internal use of HttpClient by WebSocketClient.
|
||||
* <p>
|
||||
* Maintained for Backward compatibility and also for JSR356 WebSocket ClientContainer use.
|
||||
*
|
||||
*
|
||||
* @param wsClient the WebSocketClient that this request uses
|
||||
* @param httpClient the HttpClient that this request uses
|
||||
* @param request the ClientUpgradeRequest (backward compat) to base this request from
|
||||
*/
|
||||
|
@ -374,7 +375,8 @@ public class WebSocketUpgradeRequest extends HttpRequest implements CompleteList
|
|||
|
||||
/**
|
||||
* Initiating a WebSocket Upgrade using HTTP/1.1
|
||||
*
|
||||
*
|
||||
* @param wsClient the WebSocketClient that this request uses
|
||||
* @param httpClient the HttpClient that this request uses
|
||||
* @param localEndpoint the local endpoint (following Jetty WebSocket Client API rules) to use for incoming
|
||||
* WebSocket events
|
||||
|
|
|
@ -148,6 +148,8 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
|
|||
|
||||
/**
|
||||
* Aborts the active session abruptly.
|
||||
* @param statusCode the status code
|
||||
* @param reason the raw reason code
|
||||
*/
|
||||
public void abort(int statusCode, String reason)
|
||||
{
|
||||
|
|
|
@ -461,6 +461,10 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
|
|||
super.onOpen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Event for no activity on connection (read or write)
|
||||
* @return true to signal that the endpoint must be closed, false to keep the endpoint open
|
||||
*/
|
||||
@Override
|
||||
protected boolean onReadTimeout(Throwable timeout)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ public interface MappedWebSocketCreator
|
|||
/**
|
||||
* Returns the creator for the given path spec.
|
||||
*
|
||||
* @param spec @param spec the spec to test for (using the same spec syntax as seen in {@link #addMapping(String, WebSocketCreator)})
|
||||
* @param spec the spec to test for (using the same spec syntax as seen in {@link #addMapping(String, WebSocketCreator)})
|
||||
* @return the websocket creator if path spec exists, or null
|
||||
*/
|
||||
WebSocketCreator getMapping(String spec);
|
||||
|
|
|
@ -56,6 +56,12 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
|
|||
public static final String CONTEXT_ATTRIBUTE_KEY = "contextAttributeKey";
|
||||
public static final String CONFIG_ATTRIBUTE_KEY = "configAttributeKey";
|
||||
|
||||
/**
|
||||
*
|
||||
* @param context the {@link ServletContextHandler} to use
|
||||
* @return a configured {@link WebSocketUpgradeFilter} instance
|
||||
* @throws ServletException if the filer cannot be configured
|
||||
*/
|
||||
public static WebSocketUpgradeFilter configureContext(ServletContextHandler context) throws ServletException
|
||||
{
|
||||
// Prevent double configure
|
||||
|
@ -90,6 +96,9 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
|
|||
|
||||
/**
|
||||
* @deprecated use {@link #configureContext(ServletContextHandler)} instead
|
||||
* @param context the ServletContext to use
|
||||
* @return a configured {@link WebSocketUpgradeFilter} instance
|
||||
* @throws ServletException if the filer cannot be configured
|
||||
*/
|
||||
@Deprecated
|
||||
public static WebSocketUpgradeFilter configureContext(ServletContext context) throws ServletException
|
||||
|
|
Loading…
Reference in New Issue