-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from newrelic/enhancments/websphere-lib-NR-30…
…3483 NR-303483: Server Configuration for WebSphere Liberty
- Loading branch information
Showing
5 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
instrumentation-security/websphere-liberty-profile-environment-8.5.5.5/build.gradle
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,29 @@ | ||
dependencies { | ||
implementation(project(":newrelic-security-api")) | ||
implementation("com.newrelic.agent.java:newrelic-api:${nrAPIVersion}") | ||
implementation("com.newrelic.agent.java:newrelic-weaver-api:${nrAPIVersion}") | ||
implementation(fileTree(include: ["*.jar"], dir: "lib")) | ||
} | ||
|
||
def shouldBuild = fileTree(include: ["*.jar"], dir: "lib").size() > 0 | ||
|
||
compileJava { | ||
enabled(shouldBuild) | ||
} | ||
|
||
compileTestJava { | ||
enabled(shouldBuild) | ||
} | ||
|
||
tasks.getByName("writeCachedWeaveAttributes").enabled(shouldBuild) | ||
|
||
jar { | ||
enabled(shouldBuild) | ||
manifest { attributes 'Implementation-Title': 'com.newrelic.instrumentation.security.websphere-liberty' } | ||
} | ||
|
||
site { | ||
title 'WebSphere Liberty' | ||
type 'Appserver' | ||
versionOverride '[8.5,)' | ||
} |
2 changes: 2 additions & 0 deletions
2
instrumentation-security/websphere-liberty-profile-environment-8.5.5.5/lib/.gitignore
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,2 @@ | ||
* | ||
!.gitignore |
37 changes: 37 additions & 0 deletions
37
...e-environment-8.5.5.5/src/main/java/com/ibm/ws/tcpchannel/internal/TCPChannelFactory.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,37 @@ | ||
package com.ibm.ws.tcpchannel.internal; | ||
|
||
import com.ibm.websphere.channelfw.ChannelData; | ||
import com.ibm.wsspi.channelfw.Channel; | ||
import com.ibm.wsspi.channelfw.exception.ChannelException; | ||
import com.newrelic.api.agent.security.NewRelicSecurity; | ||
import com.newrelic.api.agent.security.instrumentation.helpers.GenericHelper; | ||
import com.newrelic.api.agent.security.utils.logging.LogLevel; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
import java.util.Map; | ||
|
||
@Weave | ||
public class TCPChannelFactory { | ||
|
||
protected Channel createChannel(final ChannelData channelData) throws ChannelException { | ||
try { | ||
if (channelData.isInbound() && "defaultHttpEndpoint".equals(channelData.getExternalName())) { | ||
Map<Object, Object> propertyBag = channelData.getPropertyBag(); | ||
if (propertyBag.containsKey("port")) { | ||
try { | ||
int port = Integer.parseInt((String) propertyBag.get("port")); | ||
NewRelicSecurity.getAgent().setApplicationConnectionConfig(port, "http"); | ||
} catch (NumberFormatException e) { | ||
NewRelicSecurity.getAgent().log(LogLevel.WARNING, String.format(GenericHelper.SERVER_CONFIG_ERROR, "WEBSPHERE_LIBERTY", e.getMessage()), e, this.getClass().getName()); | ||
} | ||
} else { | ||
NewRelicSecurity.getAgent().log(LogLevel.WARNING, String.format(GenericHelper.SERVER_CONFIG_ERROR, "WEBSPHERE_LIBERTY", null), null, this.getClass().getName()); | ||
} | ||
} else { | ||
NewRelicSecurity.getAgent().log(LogLevel.WARNING, String.format(GenericHelper.SERVER_CONFIG_ERROR, "WEBSPHERE_LIBERTY", null), null, this.getClass().getName()); | ||
} | ||
} catch (Exception ignored) { | ||
} | ||
return Weaver.callOriginal(); | ||
} | ||
} |
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