-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #5320 - using jetty-websocket-httpclient.xml within webapp Jetty 10 #5563
Merged
lachlan-roberts
merged 12 commits into
jetty-10.0.x
from
jetty-10.0.x-5320-WebSocketHttpClient2
Nov 11, 2020
Merged
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
64655f7
Issue #5320 - allow websocket client jars to be provided by server
lachlan-roberts 8d21bb7
Issue #5320 - fix the XmlHttpClientProvider for jetty 10, re-enable t…
lachlan-roberts fc4e263
Add module and configuration for websocket-client provided to webapp.
lachlan-roberts 416579a
fix formatting in DistributionTests
lachlan-roberts fa1914a
Update Jetty WebSocketConfiguration classes
lachlan-roberts 80a8248
Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-10.0.x-…
lachlan-roberts 32433b1
revert change to the classloader used in isAvailable
lachlan-roberts b6688c0
Issue #5320 - changes from review
lachlan-roberts e842c16
osgi AnnotationConfiguration should replace the standard one
lachlan-roberts 42ebdc1
Issue #5320 - changes from review
lachlan-roberts 8ff545f
Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-10.0.x-…
lachlan-roberts a4160c4
Fix javadoc on websocket configuration classes.
lachlan-roberts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
jetty-websocket/websocket-jetty-client/src/main/config/modules/websocket-jetty-client.mod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html | ||
|
||
[description] | ||
Expose the Jetty WebSocket Client classes to deployed web applications. | ||
|
||
[tags] | ||
websocket | ||
|
||
[depend] | ||
client | ||
annotations | ||
|
||
gregw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[lib] | ||
lib/websocket/websocket-core-common-${jetty.version}.jar | ||
lib/websocket/websocket-core-client-${jetty.version}.jar | ||
lib/websocket/websocket-util-${jetty.version}.jar | ||
lib/websocket/websocket-jetty-api-${jetty.version}.jar | ||
lib/websocket/websocket-jetty-common-${jetty.version}.jar | ||
lib/websocket/websocket-jetty-client-${jetty.version}.jar | ||
|
||
[jpms] | ||
# The implementation needs to access method handles in | ||
# classes that are in the web application classloader. | ||
add-reads: org.eclipse.jetty.websocket.jetty.common=ALL-UNNAMED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...ain/java/org/eclipse/jetty/websocket/client/config/JettyWebSocketClientConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under | ||
// the terms of the Eclipse Public License 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0 | ||
// | ||
// This Source Code may also be made available under the following | ||
// Secondary Licenses when the conditions for such availability set | ||
// forth in the Eclipse Public License, v. 2.0 are satisfied: | ||
// the Apache License v2.0 which is available at | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.websocket.client.config; | ||
|
||
import java.util.ServiceLoader; | ||
|
||
import org.eclipse.jetty.util.Loader; | ||
import org.eclipse.jetty.webapp.AbstractConfiguration; | ||
import org.eclipse.jetty.webapp.Configuration; | ||
import org.eclipse.jetty.webapp.FragmentConfiguration; | ||
import org.eclipse.jetty.webapp.MetaInfConfiguration; | ||
import org.eclipse.jetty.webapp.WebAppConfiguration; | ||
import org.eclipse.jetty.webapp.WebInfConfiguration; | ||
import org.eclipse.jetty.webapp.WebXmlConfiguration; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* <p>Websocket Configuration</p> | ||
* <p>This configuration configures the WebAppContext server/system classes to | ||
* be able to see the {@code org.eclipse.jetty.websocket.client} package. | ||
* This class is defined in the webapp package, as it implements the {@link Configuration} interface, | ||
* which is unknown to the websocket package. However, the corresponding {@link ServiceLoader} | ||
* resource is defined in the websocket package, so that this configuration only be | ||
* loaded if the jetty-websocket jars are on the classpath. | ||
lachlan-roberts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* </p> | ||
*/ | ||
public class JettyWebSocketClientConfiguration extends AbstractConfiguration | ||
{ | ||
private static final Logger LOG = LoggerFactory.getLogger(JettyWebSocketClientConfiguration.class); | ||
|
||
public JettyWebSocketClientConfiguration() | ||
{ | ||
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class); | ||
|
||
if (isAvailable("org.eclipse.jetty.osgi.annotations.AnnotationConfiguration")) | ||
lachlan-roberts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
addDependents("org.eclipse.jetty.osgi.annotations.AnnotationConfiguration", WebAppConfiguration.class.getName()); | ||
else if (isAvailable("org.eclipse.jetty.annotations.AnnotationConfiguration")) | ||
addDependents("org.eclipse.jetty.annotations.AnnotationConfiguration", WebAppConfiguration.class.getName()); | ||
else | ||
throw new RuntimeException("Unable to add AnnotationConfiguration dependent (not present in classpath)"); | ||
|
||
protectAndExpose("org.eclipse.jetty.websocket.api."); | ||
protectAndExpose("org.eclipse.jetty.websocket.client."); | ||
hide("org.eclipse.jetty.client.impl."); | ||
hide("org.eclipse.jetty.client.config."); | ||
} | ||
|
||
@Override | ||
public boolean isAvailable() | ||
{ | ||
return isAvailable("org.eclipse.jetty.websocket.client.WebSocketClient"); | ||
} | ||
|
||
private boolean isAvailable(String classname) | ||
{ | ||
try | ||
{ | ||
return Loader.loadClass(classname) != null; | ||
lachlan-roberts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
catch (Throwable e) | ||
{ | ||
LOG.trace("IGNORED", e); | ||
return false; | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-jetty-client/src/main/resources/META-INF/services/org.eclipse.jetty.webapp.Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.eclipse.jetty.websocket.client.config.JettyWebSocketClientConfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these 2 lines, the link is now obsolete with the new Jetty 10 docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines are present on every single .mod file I can find. Maybe the change to fix all these should all be done in a separate PR?