Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project

This commit is contained in:
Joakim Erdfelt 2014-01-13 19:13:32 -07:00
commit 5cdd27b7b9
2703 changed files with 80159 additions and 28220 deletions

4
.gitattributes vendored Normal file
View File

@ -0,0 +1,4 @@
*.sh eol=lf
*.bat eol=crlf
*.txt eol=lf
*.js eol=lf

View File

@ -1,6 +1,6 @@
==============================================================
Jetty Web Container
Copyright 1995-2012 Mort Bay Consulting Pty Ltd.
Copyright 1995-2014 Mort Bay Consulting Pty Ltd.
==============================================================
The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd

View File

@ -1,3 +1,267 @@
jetty-9.1.2-SNAPSHOT
jetty-9.1.1.v20140108 - 08 January 2014
+ 408912 JDBCSessionIdManager should allow configuration of schema
+ 410750 NPE Protection in Mongo save session
+ 417202 Start / command line arguments with ${variable} should be expanded
+ 418622 WebSocket / When rejecting old WebSocket protocols, log client
details
+ 418769 Allow resourceBases in run-forked Mojo
+ 418888 Added strict mode to HttpGenerator
+ 419309 encode alias URIs from File.toURI
+ 419911 Empty chunk causes ArrayIndexOutOfBoundsException in
InputStreamResponseListener.
+ 421189 WebSocket / AbstractExtension's WebSocketPolicy is not
Session-specific
+ 421314 Websocket / Connect attempt with Chrome 32+ fails with "Some
extension already uses the compress bit"
+ 421697 IteratingCallback improvements
+ 421775 CookiePatternRule only sets cookie if not set already
+ 421794 Iterator from InputStreamProvider is not implemented properly.
+ 421795 ContentProvider should have a method to release resources.
+ 422192 ClientContainer.getOpenSessions() always returns null
+ 422264 OutputStreamContentProvider does not work with Basic Authentication.
+ 422308 Change all session/sessionid managers to use shared Scheduler
+ 422386 Comma-separated <param-value>s not trimmed in GzipFilter
+ 422388 Test for GzipFilter apply to resources with charset appended to the
MIME type
+ 422398 moved jmx remote config to jmx-remote.mod
+ 422427 improved TestConnection
+ 422703 Support reentrant HttpChannel and HttpConnection
+ 422723 Dispatch failed callbacks to avoid blocking selector
+ 422734 messages per second in ConnectorStatistics
+ 422807 fragment large written byte arrays to protect from JVM OOM bug
+ 423005 reuse gzipfilter buffers
+ 423048 Receiving a PING while sending a message kills the connection
+ 423060 Allow ${jetty.base}/work
+ 423118 ServletUpgradeRequest.getUserPrincipal() does not work
+ 423185 Update permessage-deflate for finalized spec
+ 423255 MBeans of SessionIdManager can leak memory on redeploy
+ 423361 Ensure ServletContainerInitializers called before injecting Listeners
+ 423373 Correct namespace use for JEE7 Schemas
+ 423392 GzipFilter without wrapping or blocking
+ 423395 Ensure @WebListeners are injected
+ 423397 Jetty server does not run on Linux server startup because of a bug
in jetty.sh script.
+ 423476 WebSocket / JSR / @OnMessage(maxMessageSize=20000000) not properly
supported
+ 423556 HttpSessionIdListener should be resource injectable
+ 423646 WebSocket / JSR / WebSocketContainer (Client) should have its
LifeCycle stop on standalone use
+ 423692 use UrlEncoded.ENCODING for merging forwarded query strings
+ 423695 <HT> Horizontal-tab used as HTTP Header Field separator unsupported
+ 423724 WebSocket / Rename MessageAppender.appendMessage to .appendFrame
+ 423739 Start checks module files.
+ 423804 WebSocket / JSR improper use of
ServerEndpointConfig.Configurator.getNegotiatedSubprotocol()
+ 423875 Update jetty-distro build to use jetty-toolchain jetty-schemas 3.1.M0
+ 423915 WebSocket / Active connection from IOS that goes into airplane mode
not disconnected on server side
+ 423926 Remove code duplication in class IdleTimeout.
+ 423930 SPDY streams are leaked.
+ 423948 Cleanup and consolidate testing utilities in WebSocket
+ 424014 PathContentProvider does not close its internal SeekableByteChannel.
+ 424043 IteratingCallback Idle race.
+ 424051 Using --list-config can result in NPE
+ 424168 Module [ext] should load libraries recursively from lib/ext/
+ 424180 extensible bad message content
+ 424183 Start does not find LIB (Classpath) when on non-English locale
+ 424284 Identify conflicts in logging when error "Multiple servlets map to
{pathspec}" occurs
+ 424303 @ServletSecurity not applied on non load-on-startup servlets
+ 424307 obfuscate unicode
+ 424380 Augment class / Jar scanning timing log events
+ 424390 Allow enabling modules via regex
+ 424398 Servlet load-on-startup ordering is not obeyed
+ 424497 Allow concurrent async sends
+ 424498 made bytebufferendpoint threadsafe
+ 424588 org.eclipse.jetty.ant.AntWebInfConfiguration does not add
WEB-INF/classes for annotation scanning
+ 424598 Module [npn] downloads wrong npn jar
+ 424651 org.eclipse.jetty.spdy.Flusher use of non-growable ArrayQueue yield
java.lang.IllegalStateException: Full.
+ 424682 Session cannot be deserialized with form authentication
+ 424706 The setMaxIdleTimeout of javax.websocket.Session does not take any
affect
+ 424734 WebSocket / Expose Locale information from ServletUpgradeRequest
+ 424735 WebSocket / Make ServletUpgradeRequest expose its HttpServletRequest
+ 424743 Verify abort behavior in case the total timeout expires before the
connect timeout.
+ 424762 ShutdownHandler hardcodes "127.0.0.1" and cannot be used with IPv6
+ 424847 Deadlock in deflate-frame (webkit binary)
+ 424863 IllegalStateException "Unable to find decoder for type
<javax.websocket.PongMessage>"
+ 425038 WebSocketClient leaks file handles when exceptions are thrown from
open()
+ 425043 Track whether pools are used correctly.
+ 425049 add json mime mapping to mime.properties.
jetty-9.1.0.v20131115 - 15 November 2013
+ 397167 Remote Access documentation is wrong
+ 416477 QueuedThreadPool does not reuse interrupted threads
+ 420776 complete error pages after startAsync
+ 421362 When using the jetty.osgi.boot ContextHandler service feature the
wrong ContextHandler can be undeployed
jetty-9.1.0.RC2 - 07 November 2013
+ 410656 WebSocketSession.suspend() hardcoded to return null
+ 417223 removed deprecated ThreadPool.dispatch
+ 418741 Threadlocal cookie buffer in response
+ 420359 fixed thread warnings
+ 420572 IOTest explicitly uses 127.0.0.1
+ 420692 set soTimeout to try to avoid hang
+ 420844 Connection:close on exceptional errors
+ 420930 Use Charset to specify character encoding
+ 421197 synchronize gzip output finish
+ 421198 onComplete never call onComplete in BufferingResponseListener in 9.1.
jetty-9.0.7.v20131107 - 07 November 2013
+ 407716 fixed logs
+ 416597 Allow classes and jars on the webappcontext extraclasspath to be
scanned for annotations by jetty-maven-plugin
+ 418636 Name anonymous filter and holders with classname-hashcode
+ 418732 Add whiteListByPath mode to IPAccessHandler
+ 418767 run-forked goal ingores test scope dependencies with
useTestScope=true
+ 418792 Session getProtocolVersion always returns null
+ 418892 SSL session caching so unreliable it effectively does not work.
+ 419309 Added symlink checker to test webapp
+ 419333 treat // as an alias in path
+ 419344 NPNServerConnection does not close the EndPoint if it reads -1.
+ 419350 Do not borrow space from passed arrays
+ 419655 AnnotationParser throws NullPointerException when scanning files from
jar:file urls
+ 419687 HttpClient's query parameters must be case sensitive.
+ 419799 Async timeout dispatches to error page
+ 419814 Annotation properties maxMessageSize and inputBufferSize don't work
+ 419846 JDBCSessionManager doesn't determine dirty state correctly
+ 419901 Client always adds extra user-agent header.
+ 419937 Request isSecure cleared on recycle
+ 419950 Provide constructor for StringContentProvider that takes Charset.
+ 419964 InputStreamContentProvider does not close provided InputStream.
+ 420033 AsyncContext.onTimeout exceptions passed to onError
+ 420039 BufferingResponseListener continues processing after aborting
request.
+ 420048 DefaultServlet alias checks configured resourceBase
+ 420142 reimplemented graceful shutdown
+ 420362 Response/request listeners called too many times.
+ 420374 Call super.close() in a finally block
+ 420530 AbstractLoginModule never fails a login
+ 420572 IOTest explicitly uses 127.0.0.1
+ 420776 complete error pages after startAsync
+ 420844 Connection:close on exceptional errors
+ 420930 Use Charset to specify character encoding
+ 421197 synchronize gzip output finish
jetty-8.1.14.v20131031 - 31 October 2013
+ 417772 fixed low resources idle timeout
+ 418636 Name anonymous filter and holders with classname-hashcode
+ 419432 Allow to override the SslContextFactory on a per-destination basis.
+ 420048 DefaultServlet alias checks configured resourceBase
+ 420530 AbstractLoginModule never fails a login
jetty-7.6.14.v20131031 - 31 October 2013
+ 417772 fixed low resources idle timeout
+ 418636 Name anonymous filter and holders with classname-hashcode
+ 419432 Allow to override the SslContextFactory on a per-destination basis.
+ 420048 DefaultServlet alias checks configured resourceBase
+ 420530 AbstractLoginModule never fails a login
jetty-9.1.0.RC1 - 31 October 2013
+ 294531 Unpacking webapp twice to the same directory name causes problems
with updated jars in WEB-INF/lib
+ 397049 Cannot Provide Custom Credential to JDBCLoginService
+ 403591 improve the Blocking Q implementation.
+ 407716 fixed logs
+ 410840 Change SSLSession.getPeerCertificateChain() to
SSLSession.getPeerCertificates().
+ 415118 WebAppClassLoader.getResource(name) should strip .class from name
+ 415609 spdy replace SessionInvoker with IteratingCallback. Introduce Flusher
class to separate queuing/flushing logic from StandardSession
+ 416300 Order ServletContainerInitializer callbacks
+ 416597 Allow classes and jars on the webappcontext extraclasspath to be
scanned for annotations by jetty-maven-plugin
+ 417356 Add SOCKS support to jetty client.
+ 417932 resources.mod should make ${jetty.base}/resources/ directory
+ 417933 logging.mod ini template should include commented log.class settings
+ 418212 org.eclipse.jetty.spdy.server.http.SSLExternalServerTest hangs.
+ 418441 Use of OPTIONS= in Jetty 9.1 should display WARNING message
+ 418596 Faults in JARs during class scanning should report the jar that
caused the problem
+ 418603 cannot specify a custom ServerEndpointConfig.Configurator
+ 418625 WebSocket / Jsr RemoteEndpoint.sendObject(java.nio.HeapByteBuffer)
doesn't find encoder
+ 418632 WebSocket / Jsr annotated @OnMessage with InputStream fails to be
called
+ 418636 Name anonymous filter and holders with classname-hashcode
+ 418732 Add whiteListByPath mode to IPAccessHandler
+ 418767 run-forked goal ingores test scope dependencies with
useTestScope=true
+ 418792 Session getProtocolVersion always returns null
+ 418892 SSL session caching so unreliable it effectively does not work.
+ 418922 Missing parameterization of etc/jetty-xinetd.xml
+ 418923 Missing parameterization of etc/jetty-proxy.xml
+ 419146 Parameterize etc/jetty-requestlog.xml values
+ 419309 Added symlink checker to test webapp
+ 419330 Allow access to setters on jetty-jspc-maven-plugin
+ 419333 treat // as an alias in path
+ 419344 NPNServerConnection does not close the EndPoint if it reads -1.
+ 419350 Do not borrow space from passed arrays
+ 419655 AnnotationParser throws NullPointerException when scanning files from
jar:file urls
+ 419687 HttpClient's query parameters must be case sensitive.
+ 419799 Async timeout dispatches to error page
+ 419814 Annotation properties maxMessageSize and inputBufferSize don't work
+ 419846 JDBCSessionManager doesn't determine dirty state correctly
+ 419899 Do not wrap SSL Exception as EoFException
+ 419901 Client always adds extra user-agent header.
+ 419904 Data corruption on proxy PUT requests.
+ 419914 QueuedThreadPool uses nanoTime
+ 419937 Request isSecure cleared on recycle
+ 419950 Provide constructor for StringContentProvider that takes Charset.
+ 419964 InputStreamContentProvider does not close provided InputStream.
+ 420012 Improve ProxyServlet.Transparent configuration in case prefix="/".
+ 420033 AsyncContext.onTimeout exceptions passed to onError
+ 420034 Removed threads/timers from Date caching
+ 420039 BufferingResponseListener continues processing after aborting
request.
+ 420048 DefaultServlet alias checks configured resourceBase
+ 420103 Split out jmx-remote module from existing jmx module
+ 420142 reimplemented graceful shutdown
+ 420362 Response/request listeners called too many times.
+ 420364 Bad synchronization in HttpConversation.
+ 420374 Call super.close() in a finally block
+ 420530 AbstractLoginModule never fails a login
+ 420687 XML errors in jetty-plus/src/test/resources/web-fragment-*.xml
+ 420776 complete error pages after startAsync
jetty-9.1.0.RC0 - 30 September 2013
+ 412469 make module for jetty-jaspi
+ 416453 Add comments to embedded SplitFileServer example
+ 416577 enhanced shutdown handler to send shutdown at startup
+ 416674 run all jetty-ant tests on random ports
+ 416940 avoid download of spring-beans.dtd
+ 417152 WebSocket / Do all setup in websocket specific
ServletContainerInitializer
+ 417239 re-implemented Request.getContentRead()
+ 417284 Precompiled regex in HttpField
+ 417289 SPDY replace use of direct buffers with indirect buffers or make it
configurable
+ 417340 Upgrade JDT compiler to one that supports source/target of Java 1.7
+ 417382 Upgrade to asm 4.1 and refactor annotation parsing
+ 417475 Do not null context Trie during dynamic deploy
+ 417490 WebSocket / @PathParam annotated parameters are null when the servlet
mapping uses a wildcard
+ 417561 Refactor annotation related code: change log messages
+ 417574 Setting options with _JAVA_OPTIONS breaks run-forked with
<waitForChild>true</waitForChild>
+ 417831 Remove jetty-logging.properties from distro/resources
+ 417938 Startup / Sort properties presented in --list-config alphabetically
+ 418014 Handle NTFS canonical exceptions during alias check
+ 418068 WebSocketClient has lazy or injected Executor
+ 418212 org.eclipse.jetty.spdy.server.http.SSLExternalServerTest hangs
+ 418227 Null cookie value test
jetty-9.0.6.v20130930 - 30 September 2013
+ 411069 better set compiler defaults to 1.7, including webdefault.xml for jsp
+ 411934 War overlay configuration assumes src/main/webapp exists
@ -54,6 +318,215 @@ jetty-9.0.6.v20130930 - 30 September 2013
+ 418212 org.eclipse.jetty.spdy.server.http.SSLExternalServerTest hangs
+ 418227 Null cookie value test
jetty-9.1.0.M0 - 16 September 2013
+ 393473 Add support for JSR-356 (javax.websocket) draft
+ 395444 Websockets not working with Chrome (deflate problem)
+ 396562 Add an implementation of RequestLog that supports Slf4j
+ 398467 Servlet 3.1 Non Blocking IO
+ 402984 WebSocket Upgrade must honor case insensitive header fields in
upgrade request
+ 403280 Update to javax.el 2.2.4
+ 403380 Introduce WebSocketTimeoutException to differentiate between EOF on
write and Timeout
+ 403510 HttpSession maxInactiveInterval is not serialized in HashSession
+ 403591 do not use the ConcurrentArrayBlockingQueue for thread pool, selector
and async request log
+ 403817 Use of WebSocket Session.close() results in invalid status code
+ 405188 HTTP 1.0 with GET returns internal IP address.
+ 405422 Implement servlet3.1 spec sections 4.4.3 and 8.1.4 for new
HttpSessionIdListener class
+ 405432 Check implementation of section 13.4.1 @ServletSecurity for
@HttpConstraint and HttpMethodConstraint clarifications
+ 405435 Implement servlet3.1 section 13.6.3 for 303 redirects for Form auth
+ 405437 Implement section 13.8.4 Uncovered HTTP methods
+ 405525 Throw IllegalArgumentException if filter or servlet name is null or
empty string in ServletContext.addXXX() methods
+ 405526 Deployment must fail if more than 1 servlet maps to same url pattern
+ 405531 Implement Part.getSubmittedFileName()
+ 405533 Implement special role ** for security constraints
+ 405535 Implement Request.isUserInRole(role) check security-role-refs
defaulting to security-role if no matching ref
+ 405944 Check annotation and resource injection is supported for
AsyncListener
+ 406759 supressed stacktrace in ReferrerPushStrategyTest
+ 407708 HttpUpgradeHandler must support injection
+ 408782 Transparent Proxy - rewrite URL is ignoring query strings.
+ 408904 Enhance CommandlineBuilder to not escape strings inside single quotes
+ 409403 fix IllegalStateException when SPDY is used and the response is
written through BufferUtil.writeTo byte by byte
+ 409796 fix and cleanup ReferrerPushStrategy. There's more work to do here,
so it remains @Ignore for now
+ 409953 return buffer.slice() instead of buffer.asReadOnlyBuffer() in
ResourceCache to avoid using inefficent path in BufferUtil.writeTo
+ 410083 Jetty clients submits incomplete URL to proxy.
+ 410098 inject accept-encoding header for all http requests through SPDY as
SPDY clients MUST support spdy. Also remove two new tests that have been to
implementation agnostic and not needed anymore due to recent code changes
+ 410246 HttpClient with proxy does not tunnel HTTPS requests.
+ 410341 suppress stacktraces that happen during test setup shutdown after
successful test run
+ 410800 Make RewritePatternRule queryString aware
+ 411069 better set compiler defaults to 1.7, including webdefault.xml for jsp
+ 411934 War overlay configuration assumes src/main/webapp exists
+ 412205 SSL handshake failure leads to unresponsive UpgradeConnection
+ 412418 HttpTransportOverSPDY fix race condition while sending push streams
that could cause push data not to be sent. Fixes intermittent test issues in
ReferrerPushStrategyTest
+ 412729 SPDYClient needs a Promise-based connect() method.
+ 412829 Allow any mappings from web-default.xml to be overridden by web.xml
+ 412830 Error Page match ServletException then root cause
+ 412840 remove Future in SPDYClient.connect() and return Session instead in
blocking version
+ 412934 Ignore any re-definition of an init-param within a descriptor
+ 412935 setLocale is not an explicit set of character encoding
+ 412940 minor threadsafe fixes
+ 413018 ServletContext.addListener() should throw IllegalArgumentException if
arg is not correct type of listener
+ 413020 Second call to HttpSession.invalidate() should throw exception 413019
HttpSession.getCreateTime() should throw exception after session is
invalidated
+ 413291 Avoid SPDY double dispatch
+ 413387 onResponseHeaders is not called multiple times when multiple
redirects occur.
+ 413484 setAttribute in nosql session management better handles _dirty status
+ 413531 Introduce pluggable transports for HttpClient.
+ 413684 deprecated unsafe alias checkers
+ 413737 hide stacktrace in ReferrerPushStrategyTest
+ 413901 isAsyncStarted remains true while original request is dispatched
+ 414167 WebSocket handshake upgrade from FireFox fails due to keep-alive
+ 414431 Avoid debug NPE race
+ 414635 Modular start.d and jetty.base property
+ 414640 HTTP header value encoding
+ 414725 Annotation Scanning should exclude webapp basedir from path
validation checks
+ 414731 Request.getCookies() should return null if there are no cookies
+ 414740 Removed the parent peeking Loader
+ 414891 Errors thrown by ReadListener and WriteListener not handled
correctly.
+ 414898 Only upgrade v0 to v1 cookies on dquote , ; backslash space and tab
in the value
+ 414913 WebSocket / Performance - reduce ByteBuffer allocation/copying during
generation/writing
+ 414923 CompactPathRule needs to also compact the uri
+ 415047 Create URIs lazily in HttpClient.
+ 415062 SelectorManager wakeup optimisation.
+ 415131 Avoid autoboxing on debug
+ 415192 <jsp-file> maps to JspPropertyGroupServlet instead of JspServlet
+ 415194 Deployer gives management of context to context collection
+ 415302
+ 415314 Jetty should not commit response on output if <
Response.setBufferSize() bytes are written
+ 415330 Avoid multiple callbacks at EOF
+ 415401 WebAppProvider: override XmlConfiguration.initializeDefaults
+ 415548 migrate ProxyHTTPToSPDYTest to use HttpClient to avoid intermittent
NPE part 2
+ 415605 fix status code logging for async requests
+ 415641 Remove remaining calls to deprecated HttpTranspoert.send
+ 415656 SPDY - add IdleTimeout per Stream functionality
+ 415744 Reduce Future usage in websocket
+ 415745 Include followed by forward using a PrintWriter incurs unnecessary
delay
+ 415780 fix StreamAlreadyCommittedException in spdy build
+ 415825 fix stop support in modular start setup
+ 415826 modules initialised with --add-to-start and --add-to-startd
+ 415827 jetty-start / update --help text for new command line options
+ 415830 jetty-start / add more TestUseCases for home + base + modules
configurations
+ 415831 rename ini keyword from MODULES= to --module=
+ 415832 jetty-start / fix ClassNotFound exception when starting from empty
base directory
+ 415839 jetty-start / warning about need for --exec given when not needed by
default configuration
+ 415899 jetty-start / add --lib=<cp> capability from Jetty 7/8
+ 415913 support bootlib and download in modules
+ 415999 Fix some of FindBugs warnings
+ 416015 Handle null Accept-Language and other headers
+ 416026 improve error handlig in SPDY parsers
+ 416096 DefaultServlet leaves open file descriptors with file sizes greater
than response buffer
+ 416102 Clean up of async sendContent process
+ 416103 Added AllowSymLinkAliasChecker.java
+ 416143 mod file format uses [type]
+ 416242 respect persistence headers in ProxyHTTPSPDYConnection
+ 416251 ProxyHTTPToSPDYConnection now sends a 502 to the client if it
receives a rst frame from the upstream spdy server
+ 416266 HttpServletResponse.encodeURL() encodes on first request when only
SessionTrackingMode.COOKIE is used
+ 416314 jetty async client wrong behaviour for HEAD Method + Redirect.
+ 416321 handle failure during blocked committing write
+ 416477 Improved consumeAll error handling
+ 416568 Simplified servlet exception logging
+ 416585 WebInfConfiguration examines webapp classloader first instead of its
parent when looking for container jars
+ 416597 Allow classes and jars on the webappcontext extraclasspath to be
scanned for annotations
+ 416663 Content-length set by resourcehandler
+ 416674 run all jetty-ant tests on random ports
+ 416679 Change warning to debug if no transaction manager present
+ 416680 remove uncovered constraint warning
+ 416681 Remove unnecessary security constraints in test-jetty-webapp
+ 416763 WebSocket / Jsr Session.getPathParameters() is empty
+ 416764 WebSocket / Jsr Session.getRequestURI() is missing scheme + host +
port + query parameters
+ 416787 StringIndexOutOfBounds with a pathMap of ""
+ 416812 Don't start WebSocketClient for every context
+ 416990 JMX names statically unique
+ 417022 Request attribute access to Server,HttpChannel & HttpConnection
+ 417023 Add Default404Servlet if no default servlet set
+ 417108 demo-base uses HTTPS
+ 417109 Demo / Jaas test fails to find etc/login.conf
+ 417110 Demo / html body end tag missing in authfail.html
+ 417111 Demo / login with admin/admin fails
+ 417133 WebSocket / deflate-frame should accumulate decompress byte buffers
properly
+ 417134 WebSocket / Jsr
ServerEndpointConfig.Configurator.getNegotiatedExtensions() is never used
+ 417225 added Container.addEventListener method
+ 417260 Protected targets matched as true URI path segments
jetty-8.1.13.v20130916 - 16 September 2013
+ 412629 PropertyFileLoginModule doesn't cache user configuration file even
for refreshInterval=0
+ 413484 setAttribute in nosql session management better handles _dirty status
+ 413684 deprecated unsafe alias checkers
+ 414235 RequestLogHandler configured on a context fails to handle forwarded
requests
+ 414393 StringIndexOutofBoundsException with > 8k multipart content without
CR or LF
+ 414431 Avoid debug NPE race
+ 414507 Ensure AnnotationParser ignores parent dir hierarchy when checking
for hidden dirnames
+ 414652 WebSocket's sendMessage() may hang on congested connections.
+ 415192 <jsp-file> maps to JspPropertyGroupServlet instead of JspServlet
+ 415401 Add XmlConfiguration.initializeDefaults that allows to set default
values for any XmlConfiguration that may be overridden in the config file
+ 416266 HttpServletResponse.encodeURL() encodes on first request when only
SessionTrackingMode.COOKIE is used
+ 416585 WebInfConfiguration examines webapp classloader first instead of its
parent when looking for container jars
+ 416787 StringIndexOutOfBounds with a pathMap of ""
+ 416990 JMX names statically unique
jetty-7.6.13.v20130916 - 16 September 2013
+ 412629 PropertyFileLoginModule doesn't cache user configuration file even
for refreshInterval=0
+ 413484 setAttribute in nosql session management better handles _dirty status
+ 413684 deprecated unsafe alias checkers
+ 414235 RequestLogHandler configured on a context fails to handle forwarded
requests
+ 414393 StringIndexOutofBoundsException with > 8k multipart content without
CR or LF
+ 414431 Avoid debug NPE race
+ 414507 Ensure AnnotationParser ignores parent dir hierarchy when checking
for hidden dirnames
+ 414652 WebSocket's sendMessage() may hang on congested connections.
+ 415192 <jsp-file> maps to JspPropertyGroupServlet instead of JspServlet
+ 415401 Add XmlConfiguration.initializeDefaults that allows to set default
values for any XmlConfiguration that may be overridden in the config file
+ 416585 WebInfConfiguration examines webapp classloader first instead of its
parent when looking for container jars
+ 416990 JMX names statically unique
jetty-9.0.5.v20130815 - 15 August 2013
+ 414898 Only upgrade v0 to v1 cookies on dquote , ; backslash space and tab
in the value
@ -139,49 +612,6 @@ jetty-9.0.5.v20130815 - 15 August 2013
+ 414951 QueuedThreadPool fix constructor that missed to pass the idleTimeout
+ 414972 HttpClient may read bytes with pre-tunnelled connection.
jetty-8.1.13.v20130916 - 16 September 2013
+ 412629 PropertyFileLoginModule doesn't cache user configuration file even
for refreshInterval=0
+ 413484 setAttribute in nosql session management better handles _dirty status
+ 413684 deprecated unsafe alias checkers
+ 414235 RequestLogHandler configured on a context fails to handle forwarded
requests
+ 414393 StringIndexOutofBoundsException with > 8k multipart content without
CR or LF
+ 414431 Avoid debug NPE race
+ 414507 Ensure AnnotationParser ignores parent dir hierarchy when checking
for hidden dirnames
+ 414652 WebSocket's sendMessage() may hang on congested connections.
+ 415192 <jsp-file> maps to JspPropertyGroupServlet instead of JspServlet
+ 415401 Add XmlConfiguration.initializeDefaults that allows to set default
values for any XmlConfiguration that may be overridden in the config file
+ 416266 HttpServletResponse.encodeURL() encodes on first request when only
SessionTrackingMode.COOKIE is used
+ 416585 WebInfConfiguration examines webapp classloader first instead of its
parent when looking for container jars
+ 416787 StringIndexOutOfBounds with a pathMap of ""
+ 416990 JMX names statically unique
jetty-7.6.13.v20130916 - 16 September 2013
+ 412629 PropertyFileLoginModule doesn't cache user configuration file even
for refreshInterval=0
+ 413484 setAttribute in nosql session management better handles _dirty status
+ 413684 deprecated unsafe alias checkers
+ 414235 RequestLogHandler configured on a context fails to handle forwarded
requests
+ 414393 StringIndexOutofBoundsException with > 8k multipart content without
CR or LF
+ 414431 Avoid debug NPE race
+ 414507 Ensure AnnotationParser ignores parent dir hierarchy when checking
for hidden dirnames
+ 414652 WebSocket's sendMessage() may hang on congested connections.
+ 415192 <jsp-file> maps to JspPropertyGroupServlet instead of JspServlet
+ 415401 Add XmlConfiguration.initializeDefaults that allows to set default
values for any XmlConfiguration that may be overridden in the config file
+ 416585 WebInfConfiguration examines webapp classloader first instead of its
parent when looking for container jars
+ 416990 JMX names statically unique
jetty-9.0.4.v20130625 - 25 June 2013
+ 396706 CGI support parameters
+ 397051 Make JDBCLoginService data members protected to facilitate

View File

@ -2,13 +2,12 @@
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>9.1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
<version>9.0.7-SNAPSHOT</version>
<name>Jetty :: Aggregate :: All core Jetty</name>
<url>http://www.eclipse.org/jetty</url>
<build>
@ -26,7 +25,7 @@
<configuration>
<excludes>**/MANIFEST.MF,javax/**</excludes>
<excludeArtifactIds>javax</excludeArtifactIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit</excludeGroupIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit,org.mortbay.jetty.npn</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
@ -42,9 +41,9 @@
<classifier>sources</classifier>
<includes>**/*</includes>
<excludes>META-INF/**,**/Servlet3Continuation*,**/Jetty6Continuation*</excludes>
<includeGroupIds>org.eclipse.jetty</includeGroupIds>
<includeGroupIds>org.eclipse.jetty,org.eclipse.jetty.websocket</includeGroupIds>
<excludeArtifactIds>javax</excludeArtifactIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit</excludeGroupIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit,org.mortbay.jetty.npn</excludeGroupIds>
<outputDirectory>${project.build.directory}/sources</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
@ -94,91 +93,132 @@
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId>
<version>9.0.7-SNAPSHOT</version>
<artifactId>websocket-servlet</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>javax-websocket-server-impl</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-http-server</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jaspi</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jndi</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-rewrite</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<!-- dependencies that jetty-all needs (some optional) -->
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.mail.glassfish</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,163 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>9.1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-websocket-all</artifactId>
<name>Jetty :: Aggregate :: All WebSocket Server + Client Classes</name>
<url>http://www.eclipse.org/jetty</url>
<build>
<sourceDirectory>${project.build.directory}/sources</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludes>**/MANIFEST.MF</excludes>
<excludeGroupIds>org.slf4j,org.eclipse.jetty.orbit,org.mortbay.jetty.npn</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
<execution>
<id>unpack-source</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<includes>**/*</includes>
<excludes>META-INF/**,**/Servlet3Continuation*,**/Jetty6Continuation*</excludes>
<includeGroupIds>org.eclipse.jetty,org.eclipse.jetty.websocket</includeGroupIds>
<excludeArtifactIds>javax</excludeArtifactIds>
<excludeGroupIds>javax,org.eclipse.jetty.orbit,org.mortbay.jetty.npn</excludeGroupIds>
<outputDirectory>${project.build.directory}/sources</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins
</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifest>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>http://eclipse.org/jetty</url>
<Built-By>${user.name}</Built-By>
<package>org.eclipse.jetty</package>
<Bundle-License>http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/NOTICE.txt</Bundle-License>
<Bundle-Name>Jetty</Bundle-Name>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>javadoc-jar</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-servlet</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>javax-websocket-server-impl</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<!-- dependencies that jetty-all needs (some optional) -->
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -2,7 +2,7 @@
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>example-async-rest</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>9.1.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.example-async-rest</groupId>
@ -22,8 +22,9 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1-b08</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -163,7 +163,7 @@ public class AsyncRestServlet extends AbstractRestServlet
out.close();
}
private abstract class AsyncRestRequest extends Response.Listener.Empty
private abstract class AsyncRestRequest extends Response.Listener.Adapter
{
final Utf8StringBuilder _content = new Utf8StringBuilder();

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,4 +1,10 @@
<web-fragment>
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-fragment
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
version="3.1">
<servlet>
<display-name>SerialRestServlet</display-name>
<servlet-name>SerialRestServlet</servlet-name>
@ -19,4 +25,4 @@
<servlet-name>AsyncRestServlet</servlet-name>
<url-pattern>/testAsync</url-pattern>
</servlet-mapping>
</web-fragment>
</web-fragment>

View File

@ -2,7 +2,7 @@
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>example-async-rest</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>9.1.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.example-async-rest</groupId>
@ -25,8 +25,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1-b08</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Async REST Webservice Example</display-name>

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -2,7 +2,7 @@
<parent>
<groupId>org.eclipse.jetty.examples</groupId>
<artifactId>examples-parent</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>9.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -2,7 +2,7 @@
<parent>
<groupId>org.eclipse.jetty.examples</groupId>
<artifactId>examples-parent</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>9.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -42,6 +42,11 @@
<artifactId>jetty-jmx</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>javax-websocket-server-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId>
@ -67,6 +72,10 @@
<artifactId>test-mock-resources</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-proxy</artifactId>

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -16,12 +16,14 @@
// ========================================================================
//
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
public class HelloWorld extends AbstractHandler

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -25,6 +25,7 @@ import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
public class ExampleServer
{
@ -44,7 +45,6 @@ public class ExampleServer
handlers.setHandlers(new Handler[]{context,new DefaultHandler()});
server.setHandler(handlers);
server.start();
server.join();
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -48,7 +48,9 @@ public class LikeJettyXml
public static void main(String[] args) throws Exception
{
String jetty_home = System.getProperty("jetty.home","../../jetty-distribution/target/distribution");
String jetty_base = System.getProperty("jetty.home","../../jetty-distribution/target/distribution/demo-base");
System.setProperty("jetty.home",jetty_home);
System.setProperty("jetty.base",jetty_base);
// === jetty.xml ===
@ -132,7 +134,7 @@ public class LikeJettyXml
deployer.setContextAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",".*/servlet-api-[^/]*\\.jar$");
WebAppProvider webapp_provider = new WebAppProvider();
webapp_provider.setMonitoredDirName(jetty_home + "/webapps");
webapp_provider.setMonitoredDirName(jetty_base + "/webapps");
webapp_provider.setDefaultsDescriptor(jetty_home + "/etc/webdefault.xml");
webapp_provider.setScanInterval(1);
webapp_provider.setExtractWars(true);
@ -176,7 +178,7 @@ public class LikeJettyXml
// === test-realm.xml ===
HashLoginService login = new HashLoginService();
login.setName("Test Realm");
login.setConfig(jetty_home + "/etc/realm.properties");
login.setConfig(jetty_base + "/etc/realm.properties");
login.setRefreshInterval(0);
server.addBean(login);

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -112,7 +112,7 @@ public class ManyHandlers
{
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
Map params = request.getParameterMap();
Map<String,String[]> params = request.getParameterMap();
if (params.size() > 0)
{
response.setContentType("text/plain");

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -54,6 +54,7 @@ public class MinimalServlets
server.join();
}
@SuppressWarnings("serial")
public static class HelloServlet extends HttpServlet
{
@Override

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -26,20 +26,15 @@ public class OneServletContext
{
public static void main(String[] args) throws Exception
{
Server server = new Server(8080);
Server server = new Server(8080);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
// Server content from tmp
ServletHolder holder = context.addServlet(org.eclipse.jetty.servlet.DefaultServlet.class,"/tmp/*");
holder.setInitParameter("resourceBase","/tmp");
holder.setInitParameter("pathInfoOnly","true");
context.addServlet(org.eclipse.jetty.servlet.DefaultServlet.class,"/");
context.addServlet(new ServletHolder(new DumpServlet()),"/dump/*");
// A Dump Servlet
context.addServlet(new ServletHolder(new DumpServlet()),"/*");
server.start();
server.join();
}

View File

@ -0,0 +1,48 @@
//
// ========================================================================
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.embedded;
import java.lang.management.ManagementFactory;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.ConnectorStatistics;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
public class OneServletContextJmxStats
{
public static void main(String[] args) throws Exception
{
Server server = new Server(8080);
server.addBean(new MBeanContainer(ManagementFactory.getPlatformMBeanServer()));
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
context.addServlet(org.eclipse.jetty.servlet.DefaultServlet.class,"/");
context.addServlet(new ServletHolder(new DumpServlet()),"/dump/*");
ConnectorStatistics.addToAllConnectors(server);
server.start();
server.join();
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -18,10 +18,11 @@
package org.eclipse.jetty.embedded;
import java.lang.management.ManagementFactory;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.webapp.WebAppContext;
public class OneWebApp
@ -32,6 +33,10 @@ public class OneWebApp
// a randomly available port will be assigned that you can either look in the logs for the port,
// or programmatically obtain it for use in test cases.
Server server = new Server(8080);
// Setup JMX
MBeanContainer mbContainer=new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
server.addBean(mbContainer);
// The WebAppContext is the entity that controls the environment in which a web application lives and
// breathes. In this example the context path is being set to "/" so it is suitable for serving root context
@ -40,7 +45,7 @@ public class OneWebApp
// PlusConfiguration) to choosing where the webapp will unpack itself.
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar("../../tests/test-webapps/test-jetty-webapp/target/test-jetty-webapp-9.0.0-SNAPSHOT.war");
webapp.setWar("../../jetty-distribution/target/distribution/demo-base/webapps/test.war");
// A WebAppContext is a ContextHandler as well so it needs to be set to the server so it is aware of where to
// send the appropriate requests.

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -32,6 +32,7 @@ public class ProxyServer
Server server = new Server();
ServerConnector connector = new ServerConnector(server);
connector.setPort(8888);
server.addConnector(connector);
// Setup proxy handler to handle CONNECT methods
ConnectHandler proxy = new ConnectHandler();

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -19,8 +19,6 @@
package org.eclipse.jetty.embedded;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.jetty.security.ConstraintMapping;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
@ -74,7 +72,6 @@ public class SecuredHelloHandler
security.setConstraintMappings(Collections.singletonList(mapping));
security.setAuthenticator(new BasicAuthenticator());
security.setLoginService(loginService);
security.setStrict(false);
// The Hello Handler is the handler we are securing so we create one, and then set it as the handler on the
// security handler to complain the simple handler chain.

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -43,7 +43,8 @@ public class ServerWithAnnotations
//Create a WebApp
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar("../../tests/test-webapps/test-servlet-spec/test-spec-webapp/target/test-spec-webapp-9.0.4-SNAPSHOT.war");
webapp.setWar("../../tests/test-webapps/test-servlet-spec/test-spec-webapp/target/test-spec-webapp-9.1.0-SNAPSHOT.war");
webapp.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",".*/javax.servlet-[^/]*\\.jar$|.*/servlet-api-[^/]*\\.jar$");
server.setHandler(webapp);
//Register new transaction manager in JNDI

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -21,6 +21,7 @@ package org.eclipse.jetty.embedded;
import java.util.Properties;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -24,8 +24,8 @@ import org.eclipse.jetty.deploy.DeploymentManager;
import org.eclipse.jetty.deploy.providers.WebAppProvider;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
import org.eclipse.jetty.server.AsyncNCSARequestLog;
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -0,0 +1,66 @@
//
// ========================================================================
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.embedded;
import javax.websocket.OnMessage;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.websocket.jsr356.server.ServerContainer;
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
/**
* Example of setting up a javax.websocket server with Jetty embedded
*/
public class WebSocketJsrServer
{
/**
* A server socket endpoint
*/
@ServerEndpoint(value = "/echo")
public static class EchoJsrSocket
{
@OnMessage
public void onMessage(Session session, String message)
{
session.getAsyncRemote().sendText(message);
}
}
public static void main(String[] args) throws Exception
{
Server server = new Server(8080);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
// Enable javax.websocket configuration for the context
ServerContainer wsContainer = WebSocketServerContainerInitializer.configureContext(context);
// Add your websockets to the container
wsContainer.addEndpoint(EchoJsrSocket.class);
server.start();
context.dumpStdErr();
server.join();
}
}

View File

@ -0,0 +1,79 @@
//
// ========================================================================
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.embedded;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
/**
* Example of setting up a Jetty WebSocket server
* <p>
* Note: this uses the Jetty WebSocket API, not the javax.websocket API.
*/
public class WebSocketServer
{
/**
* Example of a Jetty API WebSocket Echo Socket
*/
@WebSocket
public static class EchoSocket
{
@OnWebSocketMessage
public void onMessage(Session session, String message)
{
session.getRemote().sendStringByFuture(message);
}
}
/**
* Servlet layer
*/
@SuppressWarnings("serial")
public static class EchoServlet extends WebSocketServlet
{
@Override
public void configure(WebSocketServletFactory factory)
{
// Register the echo websocket with the basic WebSocketCreator
factory.register(EchoSocket.class);
}
}
public static void main(String[] args) throws Exception
{
Server server = new Server(8080);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
// Add the echo socket servlet to the /echo path map
context.addServlet(new ServletHolder(EchoServlet.class),"/echo");
server.start();
context.dumpStdErr();
server.join();
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -21,7 +21,7 @@
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>9.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>org.eclipse.jetty.examples</groupId>

View File

@ -2,7 +2,7 @@
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>9.1.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-annotations</artifactId>
@ -43,7 +43,7 @@
</goals>
<configuration>
<instructions>
<Import-Package>javax.servlet.*;version="2.6.0",*</Import-Package>
<Import-Package>javax.servlet.*;version="[2.6.0,3.2)",*</Import-Package>
</instructions>
</configuration>
</execution>
@ -98,12 +98,16 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.annotation</artifactId>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>org.objectweb.asm</artifactId>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,17 @@
#
# Jetty Annotation Scanning Module
#
[depend]
# Annotations needs plus, and jndi features
plus
[lib]
# Annotations needs jetty annotation jars
lib/jetty-annotations-${jetty.version}.jar
# Need annotation processing jars too
lib/annotations/*.jar
[xml]
# Enable annotation scanning webapp configurations
etc/jetty-annotations.xml

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -18,62 +18,30 @@
package org.eclipse.jetty.annotations;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.annotations.AnnotationParser.AbstractHandler;
import org.eclipse.jetty.webapp.DiscoveredAnnotation;
import org.eclipse.jetty.webapp.WebAppContext;
/**
* DiscoverableAnnotationHandler
*
*
* Base class for handling the discovery of an annotation.
*
*/
public abstract class AbstractDiscoverableAnnotationHandler implements DiscoverableAnnotationHandler
public abstract class AbstractDiscoverableAnnotationHandler extends AbstractHandler
{
protected WebAppContext _context;
protected List<DiscoveredAnnotation> _annotations;
protected Resource _resource;
public AbstractDiscoverableAnnotationHandler(WebAppContext context)
{
this(context, null);
}
public AbstractDiscoverableAnnotationHandler(WebAppContext context, List<DiscoveredAnnotation> list)
{
_context = context;
if (list == null)
_annotations = new ArrayList<DiscoveredAnnotation>();
else
_annotations = list;
}
public Resource getResource()
{
return _resource;
}
public void setResource(Resource resource)
{
_resource = resource;
}
public List<DiscoveredAnnotation> getAnnotationList ()
{
return _annotations;
}
public void resetList()
{
_annotations.clear();
}
public void addAnnotation (DiscoveredAnnotation a)
{
_annotations.add(a);
_context.getMetaData().addDiscoveredAnnotation(a);
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -18,19 +18,11 @@
package org.eclipse.jetty.annotations;
import java.util.EventListener;
import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.ServletContextHandler.Decorator;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.webapp.WebAppContext;
/**
* WebAppDecoratorWrapper
* AnnotationDecorator
*
*
*/
@ -53,99 +45,6 @@ public class AnnotationDecorator implements Decorator
_introspector.registerHandler(new ServletSecurityAnnotationHandler(context));
}
/* ------------------------------------------------------------ */
/**
* @param filter
* @throws ServletException
* @see org.eclipse.jetty.servlet.ServletContextHandler.Decorator#decorateFilterHolder(org.eclipse.jetty.servlet.FilterHolder)
*/
public void decorateFilterHolder(FilterHolder filter) throws ServletException
{
}
/* ------------------------------------------------------------ */
/**
* @param <T>
* @param filter
* @return the decorated filter
* @throws ServletException
* @see org.eclipse.jetty.servlet.ServletContextHandler.Decorator#decorateFilterInstance(javax.servlet.Filter)
*/
public <T extends Filter> T decorateFilterInstance(T filter) throws ServletException
{
introspect(filter);
return filter;
}
/* ------------------------------------------------------------ */
/**
* @param <T>
* @param listener
* @return the decorated event listener instance
* @throws ServletException
* @see org.eclipse.jetty.servlet.ServletContextHandler.Decorator#decorateListenerInstance(java.util.EventListener)
*/
public <T extends EventListener> T decorateListenerInstance(T listener) throws ServletException
{
introspect(listener);
return listener;
}
/* ------------------------------------------------------------ */
/**
* @param servlet
* @throws ServletException
* @see org.eclipse.jetty.servlet.ServletContextHandler.Decorator#decorateServletHolder(org.eclipse.jetty.servlet.ServletHolder)
*/
public void decorateServletHolder(ServletHolder servlet) throws ServletException
{
}
/* ------------------------------------------------------------ */
/**
* @param <T>
* @param servlet
* @return the decorated servlet instance
* @throws ServletException
* @see org.eclipse.jetty.servlet.ServletContextHandler.Decorator#decorateServletInstance(javax.servlet.Servlet)
*/
public <T extends Servlet> T decorateServletInstance(T servlet) throws ServletException
{
introspect(servlet);
return servlet;
}
/* ------------------------------------------------------------ */
/**
* @param f
* @see org.eclipse.jetty.servlet.ServletContextHandler.Decorator#destroyFilterInstance(javax.servlet.Filter)
*/
public void destroyFilterInstance(Filter f)
{
}
/* ------------------------------------------------------------ */
/**
* @param s
* @see org.eclipse.jetty.servlet.ServletContextHandler.Decorator#destroyServletInstance(javax.servlet.Servlet)
*/
public void destroyServletInstance(Servlet s)
{
}
/* ------------------------------------------------------------ */
/**
* @param f
* @see org.eclipse.jetty.servlet.ServletContextHandler.Decorator#destroyListenerInstance(java.util.EventListener)
*/
public void destroyListenerInstance(EventListener f)
{
}
/**
* Look for annotations that can be discovered with introspection:
* <ul>
@ -161,4 +60,17 @@ public class AnnotationDecorator implements Decorator
{
_introspector.introspect(o.getClass());
}
@Override
public Object decorate(Object o)
{
introspect(o);
return o;
}
@Override
public void destroy(Object o)
{
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -18,10 +18,11 @@
package org.eclipse.jetty.annotations;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jetty.annotations.AnnotationParser.ClassHandler;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.annotations.AnnotationParser.AbstractHandler;
import org.eclipse.jetty.annotations.AnnotationParser.ClassInfo;
import org.eclipse.jetty.util.ConcurrentHashSet;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -30,34 +31,33 @@ import org.eclipse.jetty.util.log.Logger;
*
* As asm scans for classes, remember the type hierarchy.
*/
public class ClassInheritanceHandler implements ClassHandler
public class ClassInheritanceHandler extends AbstractHandler
{
private static final Logger LOG = Log.getLogger(ClassInheritanceHandler.class);
MultiMap _inheritanceMap;
ConcurrentHashMap<String, ConcurrentHashSet<String>> _inheritanceMap;
public ClassInheritanceHandler()
{
_inheritanceMap = new MultiMap();
}
public ClassInheritanceHandler(MultiMap map)
public ClassInheritanceHandler(ConcurrentHashMap<String, ConcurrentHashSet<String>> map)
{
_inheritanceMap = map;
}
public void handle(String className, int version, int access, String signature, String superName, String[] interfaces)
public void handle(ClassInfo classInfo)
{
try
{
for (int i=0; interfaces != null && i<interfaces.length;i++)
for (int i=0; classInfo.getInterfaces() != null && i < classInfo.getInterfaces().length;i++)
{
_inheritanceMap.add (interfaces[i], className);
addToInheritanceMap(classInfo.getInterfaces()[i], classInfo.getClassName());
//_inheritanceMap.add (classInfo.getInterfaces()[i], classInfo.getClassName());
}
//To save memory, we don't record classes that only extend Object, as that can be assumed
if (!"java.lang.Object".equals(superName))
_inheritanceMap.add(superName, className);
if (!"java.lang.Object".equals(classInfo.getSuperName()))
{
addToInheritanceMap(classInfo.getSuperName(), classInfo.getClassName());
//_inheritanceMap.add(classInfo.getSuperName(), classInfo.getClassName());
}
}
catch (Exception e)
{
@ -65,13 +65,21 @@ public class ClassInheritanceHandler implements ClassHandler
}
}
public List getClassNamesExtendingOrImplementing (String className)
private void addToInheritanceMap (String interfaceOrSuperClassName, String implementingOrExtendingClassName)
{
return _inheritanceMap.getValues(className);
}
public MultiMap getMap ()
{
return _inheritanceMap;
//As it is likely that the interfaceOrSuperClassName is already in the map, try getting it first
ConcurrentHashSet<String> implementingClasses = _inheritanceMap.get(interfaceOrSuperClassName);
//If it isn't in the map, then add it in, but test to make sure that someone else didn't get in
//first and add it
if (implementingClasses == null)
{
implementingClasses = new ConcurrentHashSet<String>();
ConcurrentHashSet<String> tmp = _inheritanceMap.putIfAbsent(interfaceOrSuperClassName, implementingClasses);
if (tmp != null)
implementingClasses = tmp;
}
implementingClasses.add(implementingOrExtendingClassName);
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -19,10 +19,11 @@
package org.eclipse.jetty.annotations;
import java.util.List;
import org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler;
import org.eclipse.jetty.annotations.AnnotationParser.Value;
import org.eclipse.jetty.annotations.AnnotationParser.AbstractHandler;
import org.eclipse.jetty.annotations.AnnotationParser.ClassInfo;
import org.eclipse.jetty.annotations.AnnotationParser.FieldInfo;
import org.eclipse.jetty.annotations.AnnotationParser.MethodInfo;
import org.eclipse.jetty.plus.annotation.ContainerInitializer;
/**
@ -32,10 +33,14 @@ import org.eclipse.jetty.plus.annotation.ContainerInitializer;
* method level. The specified annotation is derived from an @HandlesTypes on
* a ServletContainerInitializer class.
*/
public class ContainerInitializerAnnotationHandler implements DiscoverableAnnotationHandler
/**
* @author janb
*
*/
public class ContainerInitializerAnnotationHandler extends AbstractHandler
{
ContainerInitializer _initializer;
Class _annotation;
final ContainerInitializer _initializer;
final Class _annotation;
public ContainerInitializerAnnotationHandler (ContainerInitializer initializer, Class annotation)
{
@ -45,35 +50,44 @@ public class ContainerInitializerAnnotationHandler implements DiscoverableAnnota
/**
* Handle finding a class that is annotated with the annotation we were constructed with.
* @see org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler#handleClass(java.lang.String, int, int, java.lang.String, java.lang.String, java.lang.String[], java.lang.String, java.util.List)
*
* @see org.eclipse.jetty.annotations.AnnotationParser.Handler#handle(ClassInfo, String)
*/
public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotationName,
List<Value> values)
public void handle(ClassInfo info, String annotationName)
{
_initializer.addAnnotatedTypeName(className);
if (annotationName == null || !_annotation.getName().equals(annotationName))
return;
_initializer.addAnnotatedTypeName(info.getClassName());
}
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
List<Value> values)
{
_initializer.addAnnotatedTypeName(className);
/**
* Handle finding a field that is annotated with the annotation we were constructed with.
*
* @see org.eclipse.jetty.annotations.AnnotationParser.Handler#handle(FieldInfo, String)
*/
public void handle(FieldInfo info, String annotationName)
{
if (annotationName == null || !_annotation.getName().equals(annotationName))
return;
_initializer.addAnnotatedTypeName(info.getClassInfo().getClassName());
}
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation,
List<Value> values)
/**
* Handle finding a method that is annotated with the annotation we were constructed with.
*
* @see org.eclipse.jetty.annotations.AnnotationParser.Handler#handle(MethodInfo, String)
*/
public void handle(MethodInfo info, String annotationName)
{
_initializer.addAnnotatedTypeName(className);
if (annotationName == null || !_annotation.getName().equals(annotationName))
return;
_initializer.addAnnotatedTypeName(info.getClassInfo().getClassName());
}
@Override
public String getAnnotationName()
{
return _annotation.getName();
}
public ContainerInitializer getContainerInitializer()
{
return _initializer;
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -44,7 +44,7 @@ public class PostConstructAnnotationHandler extends AbstractIntrospectableAnnota
public void doHandle(Class clazz)
{
//Check that the PostConstruct is on a class that we're interested in
if (Util.isServletType(clazz))
if (Util.supportsPostConstructPreDestroy(clazz))
{
Method[] methods = clazz.getDeclaredMethods();
for (int i=0; i<methods.length; i++)

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -43,7 +43,7 @@ public class PreDestroyAnnotationHandler extends AbstractIntrospectableAnnotatio
public void doHandle(Class clazz)
{
//Check that the PreDestroy is on a class that we're interested in
if (Util.isServletType(clazz))
if (Util.supportsPostConstructPreDestroy(clazz))
{
Method[] methods = clazz.getDeclaredMethods();
for (int i=0; i<methods.length; i++)

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -57,7 +57,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
*/
public void doHandle(Class<?> clazz)
{
if (Util.isServletType(clazz))
if (Util.supportsResourceInjection(clazz))
{
handleClass(clazz);

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -18,12 +18,9 @@
package org.eclipse.jetty.annotations;
import java.util.List;
import javax.servlet.Servlet;
import org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler;
import org.eclipse.jetty.annotations.AnnotationParser.Value;
import org.eclipse.jetty.plus.annotation.RunAsCollection;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.log.Log;
@ -87,14 +84,12 @@ public class RunAsAnnotationHandler extends AbstractIntrospectableAnnotationHand
}
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
List<Value> values)
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation)
{
LOG.warn ("@RunAs annotation not applicable for fields: "+className+"."+fieldName);
}
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation,
List<Value> values)
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation)
{
LOG.warn("@RunAs annotation ignored on method: "+className+"."+methodName+" "+signature);
}

View File

@ -1,145 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.annotations;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.jetty.annotations.AnnotationConfiguration;
import org.eclipse.jetty.plus.annotation.ContainerInitializer;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.WebAppContext;
/**
* ServletContainerInitializerListener
*
*
*/
public class ServletContainerInitializerListener extends AbstractLifeCycle
{
private static final Logger LOG = Log.getLogger(ServletContainerInitializerListener.class);
protected WebAppContext _context = null;
public void setWebAppContext (WebAppContext context)
{
_context = context;
}
/**
* Call the doStart method of the ServletContainerInitializers
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
*/
public void doStart()
{
List<ContainerInitializer> initializers = (List<ContainerInitializer>)_context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS);
MultiMap classMap = (MultiMap)_context.getAttribute(AnnotationConfiguration.CLASS_INHERITANCE_MAP);
if (initializers != null)
{
for (ContainerInitializer i : initializers)
{
//We have already found the classes that directly have an annotation that was in the HandlesTypes
//annotation of the ServletContainerInitializer. For each of those classes, walk the inheritance
//hierarchy to find classes that extend or implement them.
if (i.getAnnotatedTypeNames() != null)
{
Set<String> annotatedClassNames = new HashSet<String>(i.getAnnotatedTypeNames());
for (String name : annotatedClassNames)
{
//add the class with the annotation
i.addApplicableTypeName(name);
//add the classes that inherit the annotation
if (classMap != null)
{
List<String> implementsOrExtends = (List<String>)classMap.getValues(name);
if (implementsOrExtends != null && !implementsOrExtends.isEmpty())
addInheritedTypes(classMap, i, implementsOrExtends);
}
}
}
//Now we need to look at the HandlesTypes classes that were not annotations. We need to
//find all classes that extend or implement them.
if (i.getInterestedTypes() != null)
{
for (Class c : i.getInterestedTypes())
{
if (!c.isAnnotation())
{
//add the classes that implement or extend the class.
//TODO but not including the class itself?
if (classMap != null)
{
List<String> implementsOrExtends = (List<String>)classMap.getValues(c.getName());
if (implementsOrExtends != null && !implementsOrExtends.isEmpty())
addInheritedTypes(classMap, i, implementsOrExtends);
}
}
}
}
//instantiate ServletContainerInitializers, call doStart
try
{
i.callStartup(_context);
}
catch (Exception e)
{
LOG.warn(e);
throw new RuntimeException(e);
}
}
}
}
void addInheritedTypes (MultiMap classMap, ContainerInitializer initializer, List<String> applicableTypes)
{
for (String s : applicableTypes)
{
//add the name of the class that extends or implements
initializer.addApplicableTypeName(s);
//walk the hierarchy and find all types that extend or implement it
List<String> implementsOrExtends = (List<String>)classMap.getValues(s);
if (implementsOrExtends != null && !implementsOrExtends.isEmpty())
addInheritedTypes (classMap, initializer, implementsOrExtends);
}
}
/**
* Nothing to do for ServletContainerInitializers on stop
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStop()
*/
public void doStop()
{
}
}

View File

@ -0,0 +1,161 @@
//
// ========================================================================
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.annotations;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jetty.plus.annotation.ContainerInitializer;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.util.ConcurrentHashSet;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.WebAppContext;
/**
* ServletContainerInitializersStarter
*
* Call the onStartup() method on all ServletContainerInitializers, after having
* found all applicable classes (if any) to pass in as args.
*/
public class ServletContainerInitializersStarter extends AbstractLifeCycle implements ServletContextHandler.ServletContainerInitializerCaller
{
private static final Logger LOG = Log.getLogger(ServletContainerInitializersStarter.class);
WebAppContext _context;
/**
* @param context
*/
public ServletContainerInitializersStarter(WebAppContext context)
{
_context = context;
}
/**
* Call the doStart method of the ServletContainerInitializers
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
*/
public void doStart()
{
List<ContainerInitializer> initializers = (List<ContainerInitializer>)_context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS);
if (initializers == null)
return;
ConcurrentHashMap<String, ConcurrentHashSet<String>> map = ( ConcurrentHashMap<String, ConcurrentHashSet<String>>)_context.getAttribute(AnnotationConfiguration.CLASS_INHERITANCE_MAP);
for (ContainerInitializer i : initializers)
{
configureHandlesTypes(_context, i, map);
//instantiate ServletContainerInitializers, call doStart
try
{
if (LOG.isDebugEnabled())
LOG.debug("Calling ServletContainerInitializer "+i.getTarget().getClass().getName());
i.callStartup(_context);
}
catch (Exception e)
{
LOG.warn(e);
throw new RuntimeException(e);
}
}
}
private void configureHandlesTypes (WebAppContext context, ContainerInitializer initializer, ConcurrentHashMap<String, ConcurrentHashSet<String>> classMap)
{
doHandlesTypesAnnotations(context, initializer, classMap);
doHandlesTypesClasses(context, initializer, classMap);
}
private void doHandlesTypesAnnotations(WebAppContext context, ContainerInitializer initializer, ConcurrentHashMap<String, ConcurrentHashSet<String>> classMap)
{
if (initializer == null)
return;
if (context == null)
throw new IllegalArgumentException("WebAppContext null");
//We have already found the classes that directly have an annotation that was in the HandlesTypes
//annotation of the ServletContainerInitializer. For each of those classes, walk the inheritance
//hierarchy to find classes that extend or implement them.
Set<String> annotatedClassNames = initializer.getAnnotatedTypeNames();
if (annotatedClassNames != null && !annotatedClassNames.isEmpty())
{
if (classMap == null)
throw new IllegalStateException ("No class hierarchy");
for (String name : annotatedClassNames)
{
//add the class that has the annotation
initializer.addApplicableTypeName(name);
//find and add the classes that inherit the annotation
addInheritedTypes(classMap, initializer, (ConcurrentHashSet<String>)classMap.get(name));
}
}
}
private void doHandlesTypesClasses (WebAppContext context, ContainerInitializer initializer, ConcurrentHashMap<String, ConcurrentHashSet<String>> classMap)
{
if (initializer == null)
return;
if (context == null)
throw new IllegalArgumentException("WebAppContext null");
//Now we need to look at the HandlesTypes classes that were not annotations. We need to
//find all classes that extend or implement them.
if (initializer.getInterestedTypes() != null)
{
if (classMap == null)
throw new IllegalStateException ("No class hierarchy");
for (Class c : initializer.getInterestedTypes())
{
if (!c.isAnnotation())
{
//find and add the classes that implement or extend the class.
//but not including the class itself
addInheritedTypes(classMap, initializer, (ConcurrentHashSet<String>)classMap.get(c.getName()));
}
}
}
}
private void addInheritedTypes (ConcurrentHashMap<String, ConcurrentHashSet<String>> classMap, ContainerInitializer initializer, ConcurrentHashSet<String> names)
{
if (names == null || names.isEmpty())
return;
for (String s : names)
{
//add the name of the class
initializer.addApplicableTypeName(s);
//walk the hierarchy and find all types that extend or implement the class
addInheritedTypes(classMap, initializer, (ConcurrentHashSet<String>)classMap.get(s));
}
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -112,6 +112,9 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno
for (ConstraintMapping m:constraintMappings)
securityHandler.addConstraintMapping(m);
//Servlet Spec 3.1 requires paths with uncovered http methods to be reported
securityHandler.checkPathsWithUncoveredHttpMethods();
}
@ -123,17 +126,10 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno
* @param rolesAllowed
* @param permitOrDeny
* @param transport
* @return
*/
protected Constraint makeConstraint (Class servlet, String[] rolesAllowed, EmptyRoleSemantic permitOrDeny, TransportGuarantee transport)
{
return ConstraintSecurityHandler.createConstraint(servlet.getName(), rolesAllowed, permitOrDeny, transport);
}
@ -141,7 +137,6 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno
/**
* Get the ServletMappings for the servlet's class.
* @param className
* @return
*/
protected List<ServletMapping> getServletMappings(String className)
{
@ -163,7 +158,6 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno
* Check if there are already <security-constraint> elements defined that match the url-patterns for
* the servlet.
* @param servletMappings
* @return
*/
protected boolean constraintsExist (List<ServletMapping> servletMappings, List<ConstraintMapping> constraintMappings)
{

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -68,6 +68,44 @@ public class Util
return isServlet;
}
public static boolean supportsResourceInjection (Class c)
{
if (javax.servlet.Servlet.class.isAssignableFrom(c) ||
javax.servlet.Filter.class.isAssignableFrom(c) ||
javax.servlet.ServletContextListener.class.isAssignableFrom(c) ||
javax.servlet.ServletContextAttributeListener.class.isAssignableFrom(c) ||
javax.servlet.ServletRequestListener.class.isAssignableFrom(c) ||
javax.servlet.ServletRequestAttributeListener.class.isAssignableFrom(c) ||
javax.servlet.http.HttpSessionListener.class.isAssignableFrom(c) ||
javax.servlet.http.HttpSessionAttributeListener.class.isAssignableFrom(c) ||
javax.servlet.http.HttpSessionIdListener.class.isAssignableFrom(c) ||
javax.servlet.AsyncListener.class.isAssignableFrom(c) ||
javax.servlet.http.HttpUpgradeHandler.class.isAssignableFrom(c))
return true;
return false;
}
public static boolean supportsPostConstructPreDestroy (Class c)
{
if (javax.servlet.Servlet.class.isAssignableFrom(c) ||
javax.servlet.Filter.class.isAssignableFrom(c) ||
javax.servlet.ServletContextListener.class.isAssignableFrom(c) ||
javax.servlet.ServletContextAttributeListener.class.isAssignableFrom(c) ||
javax.servlet.ServletRequestListener.class.isAssignableFrom(c) ||
javax.servlet.ServletRequestAttributeListener.class.isAssignableFrom(c) ||
javax.servlet.http.HttpSessionListener.class.isAssignableFrom(c) ||
javax.servlet.http.HttpSessionAttributeListener.class.isAssignableFrom(c) ||
javax.servlet.http.HttpSessionIdListener.class.isAssignableFrom(c) ||
javax.servlet.AsyncListener.class.isAssignableFrom(c) ||
javax.servlet.http.HttpUpgradeHandler.class.isAssignableFrom(c))
return true;
return false;
}
public static boolean isEnvEntryType (Class type)
{

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -18,12 +18,11 @@
package org.eclipse.jetty.annotations;
import java.util.List;
import org.eclipse.jetty.annotations.AnnotationParser.Value;
import org.eclipse.jetty.annotations.AnnotationParser.ClassInfo;
import org.eclipse.jetty.annotations.AnnotationParser.FieldInfo;
import org.eclipse.jetty.annotations.AnnotationParser.MethodInfo;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.DiscoveredAnnotation;
import org.eclipse.jetty.webapp.WebAppContext;
/**
@ -39,38 +38,31 @@ public class WebFilterAnnotationHandler extends AbstractDiscoverableAnnotationHa
{
super(context);
}
public WebFilterAnnotationHandler (WebAppContext context, List<DiscoveredAnnotation> list)
{
super(context, list);
}
@Override
public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation,
List<Value> values)
public void handle(ClassInfo info, String annotationName)
{
WebFilterAnnotation wfAnnotation = new WebFilterAnnotation(_context, className, _resource);
if (annotationName == null || !"javax.servlet.annotation.WebFilter".equals(annotationName))
return;
WebFilterAnnotation wfAnnotation = new WebFilterAnnotation(_context, info.getClassName(), info.getContainingResource());
addAnnotation(wfAnnotation);
}
@Override
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
List<Value> values)
{
LOG.warn ("@WebFilter not applicable for fields: "+className+"."+fieldName);
public void handle(FieldInfo info, String annotationName)
{
if (annotationName == null || !"javax.servlet.annotation.WebFilter".equals(annotationName))
return;
LOG.warn ("@WebFilter not applicable for fields: "+info.getClassInfo().getClassName()+"."+info.getFieldName());
}
@Override
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation,
List<Value> values)
{
LOG.warn ("@WebFilter not applicable for methods: "+className+"."+methodName+" "+signature);
public void handle(MethodInfo info, String annotationName)
{
if (annotationName == null || !"javax.servlet.annotation.WebFilter".equals(annotationName))
return;
LOG.warn ("@WebFilter not applicable for methods: "+info.getClassInfo().getClassName()+"."+info.getMethodName()+" "+info.getSignature());
}
@Override
public String getAnnotationName()
{
return "javax.servlet.annotation.WebFilter";
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -18,13 +18,18 @@
package org.eclipse.jetty.annotations;
import java.util.EventListener;
import javax.servlet.ServletContextAttributeListener;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionIdListener;
import javax.servlet.http.HttpSessionListener;
import org.eclipse.jetty.servlet.BaseHolder.Source;
import org.eclipse.jetty.servlet.ListenerHolder;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
@ -61,9 +66,7 @@ public class WebListenerAnnotation extends DiscoveredAnnotation
*/
public void apply()
{
// TODO check algorithm against ordering rules for descriptors v annotations
Class clazz = getTargetClass();
Class<? extends java.util.EventListener> clazz = (Class<? extends EventListener>)getTargetClass();
if (clazz == null)
{
@ -78,12 +81,18 @@ public class WebListenerAnnotation extends DiscoveredAnnotation
ServletRequestListener.class.isAssignableFrom(clazz) ||
ServletRequestAttributeListener.class.isAssignableFrom(clazz) ||
HttpSessionListener.class.isAssignableFrom(clazz) ||
HttpSessionAttributeListener.class.isAssignableFrom(clazz))
HttpSessionAttributeListener.class.isAssignableFrom(clazz) ||
HttpSessionIdListener.class.isAssignableFrom(clazz))
{
java.util.EventListener listener = (java.util.EventListener)clazz.newInstance();
java.util.EventListener listener = (java.util.EventListener)_context.getServletContext().createInstance(clazz);
MetaData metaData = _context.getMetaData();
if (metaData.getOrigin(clazz.getName()+".listener") == Origin.NotSet)
{
ListenerHolder h = _context.getServletHandler().newListenerHolder(Source.ANNOTATION);
h.setListener(listener);
_context.getServletHandler().addListener(h);
_context.addEventListener(listener);
}
}
else
LOG.warn(clazz.getName()+" does not implement one of the servlet listener interfaces");

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -18,12 +18,11 @@
package org.eclipse.jetty.annotations;
import java.util.List;
import org.eclipse.jetty.annotations.AnnotationParser.Value;
import org.eclipse.jetty.annotations.AnnotationParser.ClassInfo;
import org.eclipse.jetty.annotations.AnnotationParser.FieldInfo;
import org.eclipse.jetty.annotations.AnnotationParser.MethodInfo;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.DiscoveredAnnotation;
import org.eclipse.jetty.webapp.WebAppContext;
public class WebListenerAnnotationHandler extends AbstractDiscoverableAnnotationHandler
@ -35,37 +34,30 @@ public class WebListenerAnnotationHandler extends AbstractDiscoverableAnnotation
super(context);
}
public WebListenerAnnotationHandler (WebAppContext context, List<DiscoveredAnnotation> list)
{
super(context, list);
}
/**
* @see org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler#handleClass(java.lang.String, int, int, java.lang.String, java.lang.String, java.lang.String[], java.lang.String, java.util.List)
* @see org.eclipse.jetty.annotations.AnnotationParser.Handler#handle(ClassInfo, String)
*/
public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation,
List<Value> values)
public void handle(ClassInfo info, String annotationName)
{
WebListenerAnnotation wlAnnotation = new WebListenerAnnotation(_context, className, _resource);
if (annotationName == null || !"javax.servlet.annotation.WebListener".equals(annotationName))
return;
WebListenerAnnotation wlAnnotation = new WebListenerAnnotation(_context, info.getClassName(), info.getContainingResource());
addAnnotation(wlAnnotation);
}
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
List<Value> values)
public void handle(FieldInfo info, String annotationName)
{
LOG.warn ("@WebListener is not applicable to fields: "+className+"."+fieldName);
if (annotationName == null || !"javax.servlet.annotation.WebListener".equals(annotationName))
return;
LOG.warn ("@WebListener is not applicable to fields: "+info.getClassInfo().getClassName()+"."+info.getFieldName());
}
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation,
List<Value> values)
public void handle(MethodInfo info, String annotationName)
{
LOG.warn ("@WebListener is not applicable to methods: "+className+"."+methodName+" "+signature);
if (annotationName == null || !"javax.servlet.annotation.WebListener".equals(annotationName))
return;
LOG.warn ("@WebListener is not applicable to methods: "+info.getClassInfo().getClassName()+"."+info.getMethodName()+" "+info.getSignature());
}
@Override
public String getAnnotationName()
{
return "javax.servlet.annotation.WebListener";
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -18,12 +18,11 @@
package org.eclipse.jetty.annotations;
import java.util.List;
import org.eclipse.jetty.annotations.AnnotationParser.Value;
import org.eclipse.jetty.annotations.AnnotationParser.ClassInfo;
import org.eclipse.jetty.annotations.AnnotationParser.FieldInfo;
import org.eclipse.jetty.annotations.AnnotationParser.MethodInfo;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.DiscoveredAnnotation;
import org.eclipse.jetty.webapp.WebAppContext;
/**
@ -41,47 +40,37 @@ public class WebServletAnnotationHandler extends AbstractDiscoverableAnnotationH
super(context);
}
public WebServletAnnotationHandler (WebAppContext context, List<DiscoveredAnnotation> list)
{
super(context, list);
}
/**
* Handle discovering a WebServlet annotation.
*
*
* @see org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler#handleClass(java.lang.String, int, int, java.lang.String, java.lang.String, java.lang.String[], java.lang.String, java.util.List)
* @see org.eclipse.jetty.annotations.AnnotationParser.Handler#handle(ClassInfo, String)
*/
@Override
public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotationName,
List<Value> values)
public void handle(ClassInfo info, String annotationName)
{
if (!"javax.servlet.annotation.WebServlet".equals(annotationName))
if (annotationName == null || !"javax.servlet.annotation.WebServlet".equals(annotationName))
return;
WebServletAnnotation annotation = new WebServletAnnotation (_context, className, _resource);
WebServletAnnotation annotation = new WebServletAnnotation (_context, info.getClassName(), info.getContainingResource());
addAnnotation(annotation);
}
@Override
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
List<Value> values)
public void handle(FieldInfo info, String annotationName)
{
if (annotationName == null || !"javax.servlet.annotation.WebServlet".equals(annotationName))
return;
LOG.warn ("@WebServlet annotation not supported for fields");
}
@Override
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation,
List<Value> values)
public void handle(MethodInfo info, String annotationName)
{
if (annotationName == null || !"javax.servlet.annotation.WebServlet".equals(annotationName))
return;
LOG.warn ("@WebServlet annotation not supported for methods");
}
@Override
public String getAnnotationName()
{
return "javax.servlet.annotation.WebServlet";
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -24,15 +24,18 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler;
import org.eclipse.jetty.annotations.AnnotationParser.Value;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.annotations.AnnotationParser.AbstractHandler;
import org.eclipse.jetty.annotations.AnnotationParser.ClassInfo;
import org.eclipse.jetty.annotations.AnnotationParser.FieldInfo;
import org.eclipse.jetty.annotations.AnnotationParser.MethodInfo;
import org.eclipse.jetty.util.ConcurrentHashSet;
import org.junit.After;
import org.junit.Test;
@ -44,34 +47,32 @@ public class TestAnnotationInheritance
List<String> classNames = new ArrayList<String>();
class SampleHandler implements DiscoverableAnnotationHandler
class SampleHandler extends AbstractHandler
{
public final List<String> annotatedClassNames = new ArrayList<String>();
public final List<String> annotatedMethods = new ArrayList<String>();
public final List<String> annotatedFields = new ArrayList<String>();
public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation,
List<Value> values)
public void handle(ClassInfo info, String annotation)
{
annotatedClassNames.add(className);
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
return;
annotatedClassNames.add(info.getClassName());
}
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
List<Value> values)
{
annotatedFields.add(className+"."+fieldName);
public void handle(FieldInfo info, String annotation)
{
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
return;
annotatedFields.add(info.getClassInfo().getClassName()+"."+info.getFieldName());
}
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation,
List<Value> values)
public void handle(MethodInfo info, String annotation)
{
annotatedMethods.add(className+"."+methodName);
}
@Override
public String getAnnotationName()
{
return "org.eclipse.jetty.annotations.Sample";
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
return;
annotatedMethods.add(info.getClassInfo().getClassName()+"."+info.getMethodName());
}
}
@ -92,8 +93,7 @@ public class TestAnnotationInheritance
SampleHandler handler = new SampleHandler();
AnnotationParser parser = new AnnotationParser();
parser.registerHandler(handler);
parser.parse(classNames, new ClassNameResolver ()
parser.parse(Collections.singleton(handler), classNames, new ClassNameResolver ()
{
public boolean isExcluded(String name)
{
@ -129,8 +129,7 @@ public class TestAnnotationInheritance
{
SampleHandler handler = new SampleHandler();
AnnotationParser parser = new AnnotationParser();
parser.registerAnnotationHandler("org.eclipse.jetty.annotations.Sample", handler);
parser.parse(ClassB.class, new ClassNameResolver ()
parser.parse(Collections.singleton(handler), ClassB.class, new ClassNameResolver ()
{
public boolean isExcluded(String name)
{
@ -166,8 +165,7 @@ public class TestAnnotationInheritance
{
AnnotationParser parser = new AnnotationParser();
SampleHandler handler = new SampleHandler();
parser.registerAnnotationHandler("org.eclipse.jetty.annotations.Sample", handler);
parser.parse(ClassA.class.getName(), new ClassNameResolver()
parser.parse(Collections.singleton(handler), ClassA.class.getName(), new ClassNameResolver()
{
public boolean isExcluded(String name)
{
@ -187,7 +185,7 @@ public class TestAnnotationInheritance
handler.annotatedFields.clear();
handler.annotatedMethods.clear();
parser.parse (ClassA.class.getName(), new ClassNameResolver()
parser.parse (Collections.singleton(handler), ClassA.class.getName(), new ClassNameResolver()
{
public boolean isExcluded(String name)
{
@ -205,9 +203,10 @@ public class TestAnnotationInheritance
@Test
public void testTypeInheritanceHandling() throws Exception
{
ConcurrentHashMap<String, ConcurrentHashSet<String>> map = new ConcurrentHashMap<String, ConcurrentHashSet<String>>();
AnnotationParser parser = new AnnotationParser();
ClassInheritanceHandler handler = new ClassInheritanceHandler();
parser.registerClassHandler(handler);
ClassInheritanceHandler handler = new ClassInheritanceHandler(map);
class Foo implements InterfaceD
{
@ -219,22 +218,22 @@ public class TestAnnotationInheritance
classNames.add(InterfaceD.class.getName());
classNames.add(Foo.class.getName());
parser.parse(classNames, null);
parser.parse(Collections.singleton(handler), classNames, null);
MultiMap map = handler.getMap();
assertNotNull(map);
assertFalse(map.isEmpty());
assertEquals(2, map.size());
Map stringArrayMap = map.toStringArrayMap();
assertTrue (stringArrayMap.keySet().contains("org.eclipse.jetty.annotations.ClassA"));
assertTrue (stringArrayMap.keySet().contains("org.eclipse.jetty.annotations.InterfaceD"));
String[] classes = (String[])stringArrayMap.get("org.eclipse.jetty.annotations.ClassA");
assertEquals(1, classes.length);
assertEquals ("org.eclipse.jetty.annotations.ClassB", classes[0]);
assertTrue (map.keySet().contains("org.eclipse.jetty.annotations.ClassA"));
assertTrue (map.keySet().contains("org.eclipse.jetty.annotations.InterfaceD"));
ConcurrentHashSet<String> classes = map.get("org.eclipse.jetty.annotations.ClassA");
assertEquals(1, classes.size());
assertEquals ("org.eclipse.jetty.annotations.ClassB", classes.iterator().next());
classes = (String[])stringArrayMap.get("org.eclipse.jetty.annotations.InterfaceD");
assertEquals(2, classes.length);
assertEquals ("org.eclipse.jetty.annotations.ClassB", classes[0]);
assertEquals(Foo.class.getName(), classes[1]);
classes = map.get("org.eclipse.jetty.annotations.InterfaceD");
assertEquals(2, classes.size());
assertTrue(classes.contains("org.eclipse.jetty.annotations.ClassB"));
assertTrue(classes.contains(Foo.class.getName()));
}
}

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -18,8 +18,11 @@
package org.eclipse.jetty.annotations;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.File;
import java.io.FileOutputStream;
@ -28,12 +31,15 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler;
import org.eclipse.jetty.annotations.AnnotationParser.Value;
import org.eclipse.jetty.annotations.AnnotationParser.ClassInfo;
import org.eclipse.jetty.annotations.AnnotationParser.FieldInfo;
import org.eclipse.jetty.annotations.AnnotationParser.Handler;
import org.eclipse.jetty.annotations.AnnotationParser.MethodInfo;
import org.eclipse.jetty.toolchain.test.FS;
import org.eclipse.jetty.toolchain.test.IO;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
@ -44,7 +50,7 @@ import org.junit.Test;
public class TestAnnotationParser
{
public static class TrackingAnnotationHandler implements DiscoverableAnnotationHandler
public static class TrackingAnnotationHandler extends AnnotationParser.AbstractHandler
{
private final String annotationName;
public final Set<String> foundClasses;
@ -56,30 +62,11 @@ public class TestAnnotationParser
}
@Override
public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation,
List<Value> values)
public void handle(ClassInfo info, String annotation)
{
foundClasses.add(className);
}
@Override
public void handleMethod(String className, String methodName, int access, String desc, String signature, String[] exceptions, String annotation,
List<Value> values)
{
/* ignore */
}
@Override
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
List<Value> values)
{
/* ignore */
}
@Override
public String getAnnotationName()
{
return this.annotationName;
if (annotation == null || !annotationName.equals(annotation))
return;
foundClasses.add(info.getClassName());
}
}
@ -93,47 +80,38 @@ public class TestAnnotationParser
{ "org.eclipse.jetty.annotations.ClassA" };
AnnotationParser parser = new AnnotationParser();
class SampleAnnotationHandler implements DiscoverableAnnotationHandler
class SampleAnnotationHandler extends AnnotationParser.AbstractHandler
{
private List<String> methods = Arrays.asList("a","b","c","d","l");
public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation,
List<Value> values)
public void handle(ClassInfo info, String annotation)
{
assertEquals("org.eclipse.jetty.annotations.ClassA",className);
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
return;
assertEquals("org.eclipse.jetty.annotations.ClassA",info.getClassName());
}
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
List<Value> values)
{
assertEquals("m",fieldName);
assertEquals(org.objectweb.asm.Type.OBJECT,org.objectweb.asm.Type.getType(fieldType).getSort());
assertEquals(1,values.size());
Value anv1 = values.get(0);
assertEquals("value",anv1.getName());
assertEquals(7,anv1.getValue());
public void handle(FieldInfo info, String annotation)
{
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
return;
assertEquals("m",info.getFieldName());
assertEquals(org.objectweb.asm.Type.OBJECT,org.objectweb.asm.Type.getType(info.getFieldType()).getSort());
}
public void handleMethod(String className, String methodName, int access, String desc, String signature, String[] exceptions, String annotation,
List<Value> values)
{
assertEquals("org.eclipse.jetty.annotations.ClassA",className);
assertTrue(methods.contains(methodName));
public void handle(MethodInfo info, String annotation)
{
if (annotation == null || !"org.eclipse.jetty.annotations.Sample".equals(annotation))
return;
assertEquals("org.eclipse.jetty.annotations.ClassA",info.getClassInfo().getClassName());
assertTrue(methods.contains(info.getMethodName()));
assertEquals("org.eclipse.jetty.annotations.Sample",annotation);
}
@Override
public String getAnnotationName()
{
return "org.eclipse.jetty.annotations.Sample";
}
}
parser.registerHandler(new SampleAnnotationHandler());
long start = System.currentTimeMillis();
parser.parse(classNames,new ClassNameResolver()
//long start = System.currentTimeMillis();
parser.parse(Collections.singleton(new SampleAnnotationHandler()), classNames,new ClassNameResolver()
{
public boolean isExcluded(String name)
{
@ -146,7 +124,7 @@ public class TestAnnotationParser
}
});
long end = System.currentTimeMillis();
//long end = System.currentTimeMillis();
//System.err.println("Time to parse class: " + ((end - start)));
}
@ -158,38 +136,33 @@ public class TestAnnotationParser
{ "org.eclipse.jetty.annotations.ClassB" };
AnnotationParser parser = new AnnotationParser();
class MultiAnnotationHandler implements DiscoverableAnnotationHandler
class MultiAnnotationHandler extends AnnotationParser.AbstractHandler
{
public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation,
List<Value> values)
public void handle(ClassInfo info, String annotation)
{
assertTrue("org.eclipse.jetty.annotations.ClassB".equals(className));
if (annotation == null || ! "org.eclipse.jetty.annotations.Multi".equals(annotation))
return;
assertTrue("org.eclipse.jetty.annotations.ClassB".equals(info.getClassName()));
}
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
List<Value> values)
{
public void handle(FieldInfo info, String annotation)
{
if (annotation == null || ! "org.eclipse.jetty.annotations.Multi".equals(annotation))
return;
// there should not be any
fail();
}
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation,
List<Value> values)
{
assertTrue("org.eclipse.jetty.annotations.ClassB".equals(className));
assertTrue("a".equals(methodName));
public void handle(MethodInfo info, String annotation)
{
if (annotation == null || ! "org.eclipse.jetty.annotations.Multi".equals(annotation))
return;
assertTrue("org.eclipse.jetty.annotations.ClassB".equals(info.getClassInfo().getClassName()));
assertTrue("a".equals(info.getMethodName()));
}
@Override
public String getAnnotationName()
{
return "org.eclipse.jetty.annotations.Multi";
}
}
parser.registerHandler(new MultiAnnotationHandler());
parser.parse(classNames,null);
parser.parse(Collections.singleton(new MultiAnnotationHandler()), classNames,null);
}
@Test
@ -197,7 +170,8 @@ public class TestAnnotationParser
{
File badClassesJar = MavenTestingUtils.getTestResourceFile("bad-classes.jar");
AnnotationParser parser = new AnnotationParser();
parser.parse(badClassesJar.toURI(),null);
Set<Handler> emptySet = Collections.emptySet();
parser.parse(emptySet, badClassesJar.toURI(),null);
// only the valid classes inside bad-classes.jar should be parsed. If any invalid classes are parsed and exception would be thrown here
}
@ -220,10 +194,9 @@ public class TestAnnotationParser
// Setup annotation scanning
AnnotationParser parser = new AnnotationParser();
parser.registerHandler(tracker);
// Parse
parser.parse(basedir.toURI(),null);
parser.parse(Collections.singleton(tracker), basedir.toURI(),null);
// Validate
Assert.assertThat("Found Class", tracker.foundClasses, contains(ClassA.class.getName()));

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -115,21 +115,12 @@ public class TestSecurityAnnotationConversions
introspector.registerHandler(annotationHandler);
//set up the expected outcomes:
//set up the expected outcomes - no constraints at all as per Servlet Spec 3.1 pg 129
//1 ConstraintMapping per ServletMapping pathSpec
Constraint expectedConstraint = new Constraint();
expectedConstraint.setAuthenticate(false);
expectedConstraint.setDataConstraint(Constraint.DC_NONE);
ConstraintMapping[] expectedMappings = new ConstraintMapping[2];
expectedMappings[0] = new ConstraintMapping();
expectedMappings[0].setConstraint(expectedConstraint);
expectedMappings[0].setPathSpec("/foo/*");
expectedMappings[1] = new ConstraintMapping();
expectedMappings[1].setConstraint(expectedConstraint);
expectedMappings[1].setPathSpec("*.foo");
ConstraintMapping[] expectedMappings = new ConstraintMapping[]{};
introspector.introspect(PermitServlet.class);
compareResults (expectedMappings, ((ConstraintAware)wac.getSecurityHandler()).getConstraintMappings());

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -25,12 +25,14 @@ import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlet.ServletMapping;
import org.eclipse.jetty.webapp.DiscoveredAnnotation;
import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.Test;
@ -41,6 +43,27 @@ import org.junit.Test;
*/
public class TestServletAnnotations
{
public class TestWebServletAnnotationHandler extends WebServletAnnotationHandler
{
List<DiscoveredAnnotation> _list = null;
public TestWebServletAnnotationHandler(WebAppContext context, List<DiscoveredAnnotation> list)
{
super(context);
_list = list;
}
@Override
public void addAnnotation(DiscoveredAnnotation a)
{
super.addAnnotation(a);
_list.add(a);
}
}
@Test
public void testServletAnnotation() throws Exception
{
@ -49,10 +72,11 @@ public class TestServletAnnotations
AnnotationParser parser = new AnnotationParser();
WebAppContext wac = new WebAppContext();
WebServletAnnotationHandler handler = new WebServletAnnotationHandler(wac);
parser.registerAnnotationHandler("javax.servlet.annotation.WebServlet", handler);
parser.parse(classes, new ClassNameResolver ()
List<DiscoveredAnnotation> results = new ArrayList<DiscoveredAnnotation>();
TestWebServletAnnotationHandler handler = new TestWebServletAnnotationHandler(wac, results);
parser.parse(Collections.singleton(handler), classes, new ClassNameResolver ()
{
public boolean isExcluded(String name)
{
@ -65,10 +89,11 @@ public class TestServletAnnotations
}
});
assertEquals(1, handler.getAnnotationList().size());
assertTrue(handler.getAnnotationList().get(0) instanceof WebServletAnnotation);
assertEquals(1, results.size());
assertTrue(results.get(0) instanceof WebServletAnnotation);
handler.getAnnotationList().get(0).apply();
results.get(0).apply();
ServletHolder[] holders = wac.getServletHandler().getServlets();
assertNotNull(holders);

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

View File

@ -2,7 +2,7 @@
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>9.0.7-SNAPSHOT</version>
<version>9.1.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ant</artifactId>

View File

@ -22,8 +22,6 @@ package org.eclipse.jetty.ant;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Array;
import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
import java.security.CodeSource;
@ -50,7 +48,6 @@ import org.eclipse.jetty.ant.types.FileMatchingConfiguration;
import org.eclipse.jetty.ant.utils.TaskLog;
import org.eclipse.jetty.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.plus.webapp.PlusConfiguration;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.FilterMapping;
import org.eclipse.jetty.servlet.Holder;
@ -432,9 +429,9 @@ public class AntWebAppContext extends WebAppContext
/**
* Default constructor. Takes application name as an argument
* Default constructor. Takes project as an argument
*
* @param name web application name.
* @param project the project.
*/
public AntWebAppContext(Project project) throws Exception
{
@ -669,9 +666,6 @@ public class AntWebAppContext extends WebAppContext
}
}
/**
* @see WebApplicationProxy#stop()
*/
public void doStop()
{
try

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -40,12 +40,7 @@ public class AntWebInfConfiguration extends WebInfConfiguration
@Override
public void preConfigure(final WebAppContext context) throws Exception
{
// Look for a work directory
File work = findWorkDirectory(context);
if (work != null)
makeTempDirectory(work, context, false);
{
//Make a temp directory for the webapp if one is not already set
resolveTempDirectory(context);
@ -142,6 +137,9 @@ public class AntWebInfConfiguration extends WebInfConfiguration
}
}
webInfJarNameMatcher.match(webInfPattern, uris, true); //null is inclusive, no pattern == all jars match
//No pattern to appy to classes, just add to metadata
context.getMetaData().setWebInfClassesDirs(findClassDirs(context));
}

View File

@ -136,9 +136,6 @@ public class JettyRunTask extends Task
this.contextHandlers = handlers;
}
/**
* @return
*/
public File getTempDirectory()
{
return tempDirectory;
@ -152,9 +149,6 @@ public class JettyRunTask extends Task
this.tempDirectory = tempDirectory;
}
/**
* @return
*/
public File getJettyXml()
{
return jettyXml;
@ -191,9 +185,6 @@ public class JettyRunTask extends Task
}
}
/**
* @return
*/
public String getRequestLog()
{
if (requestLog != null)
@ -301,9 +292,6 @@ public class JettyRunTask extends Task
TaskLog.log("Daemon="+daemon);
}
/**
* @return
*/
public int getScanIntervalSeconds()
{
return scanIntervalSeconds;

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
@ -16,7 +16,6 @@
// ========================================================================
//
package org.eclipse.jetty.ant;
import java.io.InputStreamReader;

View File

@ -1,6 +1,6 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0

Some files were not shown because too many files have changed in this diff Show More