JBossWS SVN: r19609 - stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-03-30 11:11:57 -0400 (Mon, 30 Mar 2015)
New Revision: 19609
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
Log:
[JBWS-3900] Moving the check on bindingoperation out of the invocation try-finally block
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2015-03-30 13:17:24 UTC (rev 19608)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2015-03-30 15:11:57 UTC (rev 19609)
@@ -132,6 +132,11 @@
{
targetBean = this.getServiceObject(exchange);
}
+ final Method method = (bop == null) ? null : md.getMethod(bop);
+ if (method == null)
+ {
+ throw Messages.MESSAGES.missingBindingOpeartionAndDispatchedMethod();
+ }
//[JBWS-3843] workaround: set the CallbackHandler threadlocal again; as a matter of fact, if that's in the Exchange,
//DIGEST auth is being used and that will cause the EJB layer to re-do authentication because of the bug
@@ -143,13 +148,8 @@
{
CallbackHandlerPolicyContextHandler.setCallbackHandler(cbHandler);
}
- Method method = bop == null ? null : md.getMethod(bop);
- if (bop == null && method == null)
- {
- throw Messages.MESSAGES.missingBindingOpeartionAndDispatchedMethod();
- }
obj = invoke(exchange, targetBean,
- adjustMethodAndParams(md.getMethod(bop), exchange, params, targetBean.getClass()), params);
+ adjustMethodAndParams(method, exchange, params, targetBean.getClass()), params);
}
finally
{
9 years, 8 months
JBossWS SVN: r19608 - in stack/cxf/trunk/modules: server/src/main/java/org/jboss/wsf/stack/cxf and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2015-03-30 09:17:24 -0400 (Mon, 30 Mar 2015)
New Revision: 19608
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
stack/cxf/trunk/modules/server/src/test/java/org/jboss/wsf/stack/cxf/JBossWSInvokerTest.java
Log:
[JBWS-3900]:Throw proper exception instead of NPE for wrong url access
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java 2015-03-30 08:47:32 UTC (rev 19607)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/Messages.java 2015-03-30 13:17:24 UTC (rev 19608)
@@ -217,4 +217,7 @@
@Message(id = 24104, value = "Service class %s is missing required JAX-WS 2.2 additional constructors")
WSFException missingJAXWS22ServiceConstructor(String className, @Cause Throwable cause);
+
+ @Message(id = 24108, value = "BindingOperation and dispatched method is missing for service implementation invocation")
+ IllegalArgumentException missingBindingOpeartionAndDispatchedMethod();
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2015-03-30 08:47:32 UTC (rev 19607)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2015-03-30 13:17:24 UTC (rev 19608)
@@ -143,6 +143,11 @@
{
CallbackHandlerPolicyContextHandler.setCallbackHandler(cbHandler);
}
+ Method method = bop == null ? null : md.getMethod(bop);
+ if (bop == null && method == null)
+ {
+ throw Messages.MESSAGES.missingBindingOpeartionAndDispatchedMethod();
+ }
obj = invoke(exchange, targetBean,
adjustMethodAndParams(md.getMethod(bop), exchange, params, targetBean.getClass()), params);
}
Modified: stack/cxf/trunk/modules/server/src/test/java/org/jboss/wsf/stack/cxf/JBossWSInvokerTest.java
===================================================================
--- stack/cxf/trunk/modules/server/src/test/java/org/jboss/wsf/stack/cxf/JBossWSInvokerTest.java 2015-03-30 08:47:32 UTC (rev 19607)
+++ stack/cxf/trunk/modules/server/src/test/java/org/jboss/wsf/stack/cxf/JBossWSInvokerTest.java 2015-03-30 13:17:24 UTC (rev 19608)
@@ -84,6 +84,7 @@
Message message = new MessageImpl();
message.setExchange(exchange);
exchange.setInMessage(message);
+ exchange.put(BindingOperationInfo.class, new BindingOperationInfo());
Service service = new ServiceImpl();
MethodDispatcher md = new MethodDispatcher() {
@Override
9 years, 8 months
JBossWS SVN: r19607 - hudson/trunk.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-03-30 04:47:32 -0400 (Mon, 30 Mar 2015)
New Revision: 19607
Modified:
hudson/trunk/ant.properties.example
Log:
Updating wfly900 version
Modified: hudson/trunk/ant.properties.example
===================================================================
--- hudson/trunk/ant.properties.example 2015-03-30 08:32:46 UTC (rev 19606)
+++ hudson/trunk/ant.properties.example 2015-03-30 08:47:32 UTC (rev 19607)
@@ -32,7 +32,7 @@
hudson.jboss820.rev=8.2.0.Final
hudson.jboss900.url=https://github.com/wildfly/wildfly
-hudson.jboss900.build=wildfly-9.0.0.Alpha2-SNAPSHOT
+hudson.jboss900.build=wildfly-9.0.0.CR1-SNAPSHOT
hudson.jboss900.rev=master
hudson.mail.recipients=
9 years, 8 months
JBossWS SVN: r19606 - stack/cxf/trunk.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2015-03-30 04:32:46 -0400 (Mon, 30 Mar 2015)
New Revision: 19606
Modified:
stack/cxf/trunk/pom.xml
Log:
Updating wfly900 target component version after WildFly 9.0.0.Beta1 release
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2015-03-30 06:12:11 UTC (rev 19605)
+++ stack/cxf/trunk/pom.xml 2015-03-30 08:32:46 UTC (rev 19606)
@@ -71,7 +71,7 @@
<wildfly800.version>8.0.0.Final</wildfly800.version>
<wildfly810.version>8.1.0.Final</wildfly810.version>
<wildfly820.version>8.2.0.Final</wildfly820.version>
- <wildfly900.version>9.0.0.Alpha2-SNAPSHOT</wildfly900.version>
+ <wildfly900.version>9.0.0.CR1-SNAPSHOT</wildfly900.version>
<ejb.api.version>1.0.2.Final</ejb.api.version>
<cxf.version>3.0.4</cxf.version>
<cxf.asm.version>3.3.1</cxf.asm.version>
9 years, 8 months
JBossWS SVN: r19605 - stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2015-03-30 02:12:11 -0400 (Mon, 30 Mar 2015)
New Revision: 19605
Modified:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetOutIntercetpor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutOutIntercetpor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java
Log:
[JBWS-3896]:Set json http header in management out interceptor
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java 2015-03-26 16:06:10 UTC (rev 19604)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java 2015-03-30 06:12:11 UTC (rev 19605)
@@ -56,4 +56,10 @@
return encoding;
}
+ protected void setContentType(Message message)
+ {
+ message.put(Message.CONTENT_TYPE, "application/json");
+
+ }
+
}
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java 2015-03-26 16:06:10 UTC (rev 19604)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java 2015-03-30 06:12:11 UTC (rev 19605)
@@ -85,6 +85,7 @@
mout.setExchange(message.getExchange());
mout = message.getExchange().get(org.apache.cxf.endpoint.Endpoint.class).getBinding().createMessage(mout);
mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange()));
+ this.setContentType(mout);
message.getExchange().setOutMessage(mout);
return mout;
}
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetInterceptor.java 2015-03-26 16:06:10 UTC (rev 19604)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetInterceptor.java 2015-03-30 06:12:11 UTC (rev 19605)
@@ -51,7 +51,7 @@
}
public EndpointConfigsGetInterceptor() {
super(Phase.READ);
- getAfter().add(EndpointSelectionInterceptor.class.getName());
+ this.addAfter(EndpointSelectionInterceptor.class.getName());
}
public EndpointConfigsGetInterceptor(Interceptor<Message> outInterceptor) {
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetOutIntercetpor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetOutIntercetpor.java 2015-03-26 16:06:10 UTC (rev 19604)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetOutIntercetpor.java 2015-03-30 06:12:11 UTC (rev 19605)
@@ -27,10 +27,8 @@
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.StaxOutInterceptor;
-import org.apache.cxf.message.Exchange;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
import org.apache.cxf.message.Message;
-import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.staxutils.StaxUtils;
import org.codehaus.jettison.AbstractXMLStreamWriter;
@@ -43,14 +41,14 @@
*@author <a href="mailto:ema@redhat.com>Jim Ma</a>
*
*/
-public class EndpointConfigsGetOutIntercetpor extends AbstractPhaseInterceptor<Message>
+public class EndpointConfigsGetOutIntercetpor extends AbstractManagementInterceptor
{
public static final EndpointConfigsGetOutIntercetpor INSTANCE = new EndpointConfigsGetOutIntercetpor();
public EndpointConfigsGetOutIntercetpor()
{
- super(Phase.PRE_STREAM);
- getAfter().add(StaxOutInterceptor.class.getName());
+ super(Phase.PREPARE_SEND);
+ this.addAfter(MessageSenderInterceptor.class.getName());
}
public void handleMessage(Message message) throws Fault
@@ -67,7 +65,7 @@
{
return;
}
- message.put(Message.CONTENT_TYPE, "text/xml");
+ setContentType(message);
OutputStreamWriter writer = null;
AbstractXMLStreamWriter mappedWriter = null;
try
@@ -102,22 +100,4 @@
}
}
-
- private String getEncoding(Message message)
- {
- Exchange ex = message.getExchange();
- String encoding = (String)message.get(Message.ENCODING);
- if (encoding == null && ex.getInMessage() != null)
- {
- encoding = (String)ex.getInMessage().get(Message.ENCODING);
- message.put(Message.ENCODING, encoding);
- }
-
- if (encoding == null)
- {
- encoding = "UTF-8";
- message.put(Message.ENCODING, encoding);
- }
- return encoding;
- }
}
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutOutIntercetpor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutOutIntercetpor.java 2015-03-26 16:06:10 UTC (rev 19604)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutOutIntercetpor.java 2015-03-30 06:12:11 UTC (rev 19605)
@@ -25,10 +25,8 @@
import java.io.OutputStreamWriter;
import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.StaxOutInterceptor;
-import org.apache.cxf.message.Exchange;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
import org.apache.cxf.message.Message;
-import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.staxutils.StaxUtils;
import org.codehaus.jettison.AbstractXMLStreamWriter;
@@ -41,14 +39,14 @@
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
*
*/
-public class EndpointConfigsPutOutIntercetpor extends AbstractPhaseInterceptor<Message>
+public class EndpointConfigsPutOutIntercetpor extends AbstractManagementInterceptor
{
public static final EndpointConfigsPutOutIntercetpor INSTANCE = new EndpointConfigsPutOutIntercetpor();
public EndpointConfigsPutOutIntercetpor()
{
- super(Phase.PRE_STREAM);
- getAfter().add(StaxOutInterceptor.class.getName());
+ super(Phase.PREPARE_SEND);
+ this.addAfter(MessageSenderInterceptor.class.getName());
}
public void handleMessage(Message message) throws Fault
@@ -64,7 +62,7 @@
{
return;
}
- message.put(Message.CONTENT_TYPE, "text/xml");
+ setContentType(message);
OutputStreamWriter writer = null;
AbstractXMLStreamWriter mappedWriter = null;
try
@@ -91,21 +89,4 @@
}
- private String getEncoding(Message message)
- {
- Exchange ex = message.getExchange();
- String encoding = (String)message.get(Message.ENCODING);
- if (encoding == null && ex.getInMessage() != null)
- {
- encoding = (String)ex.getInMessage().get(Message.ENCODING);
- message.put(Message.ENCODING, encoding);
- }
-
- if (encoding == null)
- {
- encoding = "UTF-8";
- message.put(Message.ENCODING, encoding);
- }
- return encoding;
- }
}
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java 2015-03-26 16:06:10 UTC (rev 19604)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java 2015-03-30 06:12:11 UTC (rev 19605)
@@ -25,10 +25,8 @@
import java.io.OutputStreamWriter;
import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.StaxOutInterceptor;
-import org.apache.cxf.message.Exchange;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
import org.apache.cxf.message.Message;
-import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.staxutils.StaxUtils;
import org.codehaus.jettison.AbstractXMLStreamWriter;
@@ -42,14 +40,14 @@
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
*
*/
-public class EndpointMetricsGetOutInterceptor extends AbstractPhaseInterceptor<Message>
+public class EndpointMetricsGetOutInterceptor extends AbstractManagementInterceptor
{
public static final EndpointMetricsGetOutInterceptor INSTANCE = new EndpointMetricsGetOutInterceptor();
public EndpointMetricsGetOutInterceptor()
{
- super(Phase.PRE_STREAM);
- getAfter().add(StaxOutInterceptor.class.getName());
+ super(Phase.PREPARE_SEND);
+ this.addAfter(MessageSenderInterceptor.class.getName());
}
public void handleMessage(Message message) throws Fault
@@ -61,7 +59,7 @@
{
return;
}
- message.put(Message.CONTENT_TYPE, "text/xml");
+ setContentType(message);
OutputStreamWriter writer = null;
AbstractXMLStreamWriter mappedWriter = null;
try
@@ -100,22 +98,5 @@
writter.writeEndElement();
}
- private String getEncoding(Message message)
- {
- Exchange ex = message.getExchange();
- String encoding = (String)message.get(Message.ENCODING);
- if (encoding == null && ex.getInMessage() != null)
- {
- encoding = (String)ex.getInMessage().get(Message.ENCODING);
- message.put(Message.ENCODING, encoding);
- }
- if (encoding == null)
- {
- encoding = "UTF-8";
- message.put(Message.ENCODING, encoding);
- }
- return encoding;
- }
-
}
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java 2015-03-26 16:06:10 UTC (rev 19604)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java 2015-03-30 06:12:11 UTC (rev 19605)
@@ -27,7 +27,7 @@
import java.util.Map;
import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.StaxOutInterceptor;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.staxutils.StaxUtils;
@@ -48,8 +48,8 @@
public EndpointRecordGetOutInterceptor()
{
- super(Phase.PRE_STREAM);
- getAfter().add(StaxOutInterceptor.class.getName());
+ super(Phase.PREPARE_SEND);
+ this.addAfter(MessageSenderInterceptor.class.getName());
}
public void handleMessage(Message message) throws Fault
@@ -62,7 +62,7 @@
{
return;
}
- message.put(Message.CONTENT_TYPE, "text/xml");
+ setContentType(message);
OutputStreamWriter writer = null;
AbstractXMLStreamWriter mappedWriter = null;
try
9 years, 8 months
JBossWS SVN: r19604 - common/trunk/src/main/java/org/jboss/ws/common/deployment.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2015-03-26 12:06:10 -0400 (Thu, 26 Mar 2015)
New Revision: 19604
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java
Log:
removed unwanted imports
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java 2015-03-25 09:58:49 UTC (rev 19603)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java 2015-03-26 16:06:10 UTC (rev 19604)
@@ -28,7 +28,6 @@
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.ResourceResolver;
import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
-import org.jboss.wsf.spi.deployment.DeploymentType;
/**
* A general web service deployment that is based on an archive.
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java 2015-03-25 09:58:49 UTC (rev 19603)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java 2015-03-26 16:06:10 UTC (rev 19604)
@@ -24,7 +24,6 @@
import org.jboss.wsf.spi.deployment.AbstractExtensible;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Service;
-import org.jboss.wsf.spi.deployment.DeploymentType;
/**
* A general web service deployment dep.
9 years, 9 months
JBossWS SVN: r19603 - in stack/cxf/branches/management/modules: server/src/main/java/org/jboss/wsf/stack/cxf/configuration and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2015-03-25 05:58:49 -0400 (Wed, 25 Mar 2015)
New Revision: 19603
Added:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RecordConfigListener.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListener.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListenerManager.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListenerManagerImpl.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java
Removed:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractEndpintManagementInterceptor.java
Modified:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java
stack/cxf/branches/management/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java
Log:
[JBWS-3895]:Add interceptors to enable record processor and return Records
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RecordConfigListener.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RecordConfigListener.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RecordConfigListener.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.config;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.xml.ws.handler.Handler;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.InterceptorProvider;
+import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
+import org.apache.cxf.message.Message;
+import org.jboss.ws.common.invocation.RecordingServerHandler;
+import org.jboss.wsf.spi.deployment.RuntimeConfig;
+/**
+ * Config listener to add RecodingServerHandler when record-enabled config changes
+ * @author <a href="mailto:ema@redhat.com>Jim Ma</a>
+ *
+ */
+@NoJSR250Annotations(unlessNull = "bus")
+public class RecordConfigListener implements RuntimeConfigListener
+{
+ private String propertyName;
+ private Class<? extends InterceptorProvider> claz;
+ private RuntimeConfigListenerManager configListenManager;
+ private RecordingServerHandler newRecordingServerHandler;
+
+ public RecordConfigListener()
+ {
+ this(RuntimeConfig.RECORD_ENABLED, Endpoint.class);
+ }
+
+ public RecordConfigListener(String propertyName, Class<? extends InterceptorProvider> target)
+ {
+ this.propertyName = propertyName;
+ this.claz = target;
+ }
+
+ @Resource
+ public final void setBus(Bus bus)
+ {
+ if (null != bus)
+ {
+ configListenManager = bus.getExtension(RuntimeConfigListenerManager.class);
+ if (null != configListenManager)
+ {
+ configListenManager.registerListener(propertyName, this);
+ }
+ }
+ }
+
+ public void configChange(Message message, String configValue)
+ {
+ if ("false".equals(configValue))
+ {
+ onDisable(message);
+ }
+ if ("true".equals(configValue))
+ {
+ onEnable(message);
+ }
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void onEnable(Message message)
+ {
+ org.jboss.wsf.spi.deployment.Endpoint endpoint = message.getExchange().get(org.jboss.wsf.spi.deployment.Endpoint.class);
+ endpoint.setRuntimeProperty(RuntimeConfig.PROCESSOR, "MemoryBufferRecorder");
+ boolean handlerAdded = false;
+ if (message.getExchange().getEndpoint() instanceof JaxWsEndpointImpl)
+ {
+ //RecordingServerHandler handler = new RecordingServerHandler();
+
+ List<Handler> chain = ((JaxWsEndpointImpl)message.getExchange().getEndpoint()).getJaxwsBinding().getHandlerChain();
+ for (Handler handler : chain)
+ {
+ if (handler instanceof RecordingServerHandler)
+ {
+ handlerAdded = true;
+ break;
+ }
+
+ }
+ if (!handlerAdded)
+ {
+ newRecordingServerHandler = new RecordingServerHandler();
+ chain.add(newRecordingServerHandler);
+ ((JaxWsEndpointImpl)message.getExchange().getEndpoint()).getJaxwsBinding().setHandlerChain(chain);
+ }
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void onDisable(Message message)
+ {
+ org.jboss.wsf.spi.deployment.Endpoint endpoint = message.getExchange().get(org.jboss.wsf.spi.deployment.Endpoint.class);
+ endpoint.removeProperty(RuntimeConfig.PROCESSOR);
+ if (message.getExchange().getEndpoint() instanceof JaxWsEndpointImpl)
+ {
+ List<Handler> chain = ((JaxWsEndpointImpl)message.getExchange().getEndpoint()).getJaxwsBinding().getHandlerChain();
+ chain.remove(newRecordingServerHandler);
+ ((JaxWsEndpointImpl)message.getExchange().getEndpoint()).getJaxwsBinding().setHandlerChain(chain);
+ }
+ }
+
+ public String getConfigName()
+ {
+ return propertyName;
+
+ }
+
+ @Override
+ public Class<? extends InterceptorProvider> getTarget()
+ {
+ return claz;
+ }
+
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RecordConfigListener.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListener.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListener.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListener.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.config;
+
+import org.apache.cxf.interceptor.InterceptorProvider;
+import org.apache.cxf.message.Message;
+/**
+ *
+ *@author <a href="mailto:ema@redhat.com>Jim Ma</a>
+ *
+ */
+public interface RuntimeConfigListener
+{
+ void configChange(Message message, String configValue);
+ String getConfigName();
+ Class < ? extends InterceptorProvider> getTarget();
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListener.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListenerManager.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListenerManager.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListenerManager.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.config;
+
+/**
+ * Interceptor to set runtime configuration with http put url like: http://localhost:8080/context/endpoint?statistics-enabled=true
+ *@author <a href="mailto:ema@redhat.com>Jim Ma</a>
+ *
+ */
+public interface RuntimeConfigListenerManager
+{
+ void registerListener(String config, RuntimeConfigListener listener);
+ void unRegisterListener(String config,RuntimeConfigListener listener);
+ RuntimeConfigListener getListeners(String config);
+
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListenerManager.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListenerManagerImpl.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListenerManagerImpl.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListenerManagerImpl.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.config;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.annotation.Resource;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+/**
+ * Interceptor to set runtime configuration with http put url like: http://localhost:8080/context/endpoint?statistics-enabled=true
+ *@author <a href="mailto:ema@redhat.com>Jim Ma</a>
+ *
+ */
+@NoJSR250Annotations(unlessNull = "bus")
+public class RuntimeConfigListenerManagerImpl implements RuntimeConfigListenerManager
+{
+
+ private final ConcurrentHashMap<String, RuntimeConfigListener> listeners;
+ private Bus bus;
+
+ public RuntimeConfigListenerManagerImpl() {
+ listeners = new ConcurrentHashMap<String, RuntimeConfigListener>();
+ }
+ public RuntimeConfigListenerManagerImpl(Bus b) {
+ listeners = new ConcurrentHashMap<String, RuntimeConfigListener>();
+ setBus(b);
+ }
+
+ @Resource
+ public final void setBus(Bus b) {
+ bus = b;
+ if (null != bus) {
+ bus.setExtension(this, RuntimeConfigListenerManager.class);
+ }
+ }
+
+ @Override
+ public void registerListener(String config, RuntimeConfigListener listener)
+ {
+ listeners.putIfAbsent(config, listener);
+
+ }
+ @Override
+ public void unRegisterListener(String config, RuntimeConfigListener listener)
+ {
+ listeners.remove(config, listener);
+
+ }
+ @Override
+ public RuntimeConfigListener getListeners(String config)
+ {
+ return listeners.get(config);
+ }
+
+ }
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/config/RuntimeConfigListenerManagerImpl.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2015-03-25 09:53:57 UTC (rev 19602)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -60,6 +60,7 @@
import org.jboss.wsf.spi.deployment.AnnotationsInfo;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.RuntimeConfig;
import org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata;
import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
import org.jboss.wsf.spi.security.JASPIAuthenticationProvider;
@@ -67,6 +68,9 @@
import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
import org.jboss.wsf.stack.cxf.client.Constants;
import org.jboss.wsf.stack.cxf.client.configuration.InterceptorUtils;
+import org.jboss.wsf.stack.cxf.config.RecordConfigListener;
+import org.jboss.wsf.stack.cxf.config.RuntimeConfigListenerManager;
+import org.jboss.wsf.stack.cxf.config.RuntimeConfigListenerManagerImpl;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
import org.jboss.wsf.stack.cxf.extensions.policy.PolicySetsAnnotationListener;
import org.jboss.wsf.stack.cxf.interceptor.EnableDecoupledFaultInterceptor;
@@ -74,6 +78,7 @@
import org.jboss.wsf.stack.cxf.interceptor.EndpointConfigsGetInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.EndpointConfigsPutInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.EndpointMetricsGetInterceptor;
+import org.jboss.wsf.stack.cxf.interceptor.EndpointRecordGetInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.HandlerAuthInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.NsCtxSelectorStoreInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.WSDLSoapAddressRewriteInterceptor;
@@ -126,6 +131,10 @@
{
bus.setExtension(configurer, Configurer.class);
}
+ //add runtime config extension
+ RuntimeConfigListenerManager configManager = new RuntimeConfigListenerManagerImpl(bus);
+ configManager.registerListener(RuntimeConfig.RECORD_ENABLED, new RecordConfigListener());
+ bus.setExtension(configManager, RuntimeConfigListenerManager.class);
Map<String, String> props = getProperties(wsmd);
setInterceptors(bus, dep, props);
@@ -210,6 +219,7 @@
bus.getInInterceptors().add(new EndpointConfigsGetInterceptor());
bus.getInInterceptors().add(new EndpointConfigsPutInterceptor());
bus.getInInterceptors().add(new EndpointMetricsGetInterceptor());
+ bus.getInInterceptors().add(new EndpointRecordGetInterceptor());
bus.getInInterceptors().add(new NsCtxSelectorStoreInterceptor());
final String p = (props != null) ? props.get(Constants.JBWS_CXF_DISABLE_HANDLER_AUTH_CHECKS) : null;
Deleted: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractEndpintManagementInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractEndpintManagementInterceptor.java 2015-03-25 09:53:57 UTC (rev 19602)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractEndpintManagementInterceptor.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2015, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.cxf.interceptor;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.cxf.common.util.UrlUtils;
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.Interceptor;
-import org.apache.cxf.interceptor.MessageSenderInterceptor;
-import org.apache.cxf.interceptor.OutgoingChainInterceptor;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageImpl;
-import org.apache.cxf.phase.AbstractPhaseInterceptor;
-import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
-
-/**
- * All endpoint management interceptor should extend this class to get allowed http methods etc.
- * @author <a href="mailto:ema@redhat.com/>Jim Ma</a>
- *
- */
-public abstract class AbstractEndpintManagementInterceptor extends AbstractPhaseInterceptor<Message>
-{
- private static final String TRANSFORM_SKIP = "transform.skip";
-
- public AbstractEndpintManagementInterceptor(String phase)
- {
- super(phase);
- }
-
- abstract Set<String> getAllowedMethod();
-
- protected boolean isAllowed(final Message message) throws Fault
- {
- String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
- if (getAllowedMethod().contains(method) && isValidUser(getHttpRequest(message)))
- {
- return true;
- }
- return false;
-
- }
-
- private boolean isValidUser(final HttpServletRequest req)
- {
- if (req.getUserPrincipal() != null && req.isUserInRole("admin"))
- {
- return true;
- }
- return false;
- }
-
- protected HttpServletRequest getHttpRequest(Message message)
- {
- return (HttpServletRequest)message.get("HTTP.REQUEST");
- }
-
- protected Map<String, String> getQueryMap(Message message)
- {
- String query = (String)message.get(Message.QUERY_STRING);
- Map<String, String> map = UrlUtils.parseQueryString(query);
- return map;
- }
-
- protected void cleanUpOutInterceptors(Message outMessage)
- {
- // TODO - how can I improve this to provide a specific interceptor chain that just has the
- // stax, gzip and message sender components, while also ensuring that GZIP is only provided
- // if its already configured for the endpoint.
- Iterator<Interceptor<? extends Message>> iterator = outMessage.getInterceptorChain().iterator();
- while (iterator.hasNext())
- {
- Interceptor<? extends Message> inInterceptor = iterator.next();
- if (!inInterceptor.getClass().equals(GZIPOutInterceptor.class) && !inInterceptor.getClass().equals(MessageSenderInterceptor.class))
- {
- outMessage.getInterceptorChain().remove(inInterceptor);
- }
- }
- outMessage.getExchange().put(TRANSFORM_SKIP, Boolean.TRUE);
-
- }
-
- protected Message createOutMessage(Message message)
- {
- Message mout = new MessageImpl();
- mout.setExchange(message.getExchange());
- mout = message.getExchange().get(org.apache.cxf.endpoint.Endpoint.class).getBinding().createMessage(mout);
- mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange()));
- message.getExchange().setOutMessage(mout);
- return mout;
- }
-}
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.interceptor;
+
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+
+/**
+ * All endpoint management interceptor should extend this class to get allowed http methods etc.
+ * @author <a href="mailto:ema@redhat.com/>Jim Ma</a>
+ *
+ */
+public abstract class AbstractManagementInterceptor extends AbstractPhaseInterceptor<Message>
+{
+ public AbstractManagementInterceptor(String phase)
+ {
+ super(phase);
+ // TODO Auto-generated constructor stub
+ }
+
+ protected String getEncoding(Message message)
+ {
+ Exchange ex = message.getExchange();
+ String encoding = (String)message.get(Message.ENCODING);
+ if (encoding == null && ex.getInMessage() != null)
+ {
+ encoding = (String)ex.getInMessage().get(Message.ENCODING);
+ message.put(Message.ENCODING, encoding);
+ }
+
+ if (encoding == null)
+ {
+ encoding = "UTF-8";
+ message.put(Message.ENCODING, encoding);
+ }
+ return encoding;
+ }
+
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractManagementInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -0,0 +1,91 @@
+package org.jboss.wsf.stack.cxf.interceptor;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.cxf.common.util.UrlUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
+import org.apache.cxf.interceptor.OutgoingChainInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
+
+public abstract class AbstractMangementInInterceptor extends AbstractManagementInterceptor
+{
+ public AbstractMangementInInterceptor(String phase)
+ {
+ super(phase);
+ }
+
+
+ private static final String TRANSFORM_SKIP = "transform.skip";
+
+
+
+ abstract Set<String> getAllowedMethod();
+
+ protected boolean isAllowed(final Message message) throws Fault
+ {
+ String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
+ if (getAllowedMethod().contains(method) && isValidUser(getHttpRequest(message)))
+ {
+ return true;
+ }
+ return false;
+
+ }
+
+ private boolean isValidUser(final HttpServletRequest req)
+ {
+ if (req.getUserPrincipal() != null && req.isUserInRole("admin"))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ protected HttpServletRequest getHttpRequest(Message message)
+ {
+ return (HttpServletRequest)message.get("HTTP.REQUEST");
+ }
+
+ protected Map<String, String> getQueryMap(Message message)
+ {
+ String query = (String)message.get(Message.QUERY_STRING);
+ Map<String, String> map = UrlUtils.parseQueryString(query);
+ return map;
+ }
+
+ protected void cleanUpOutInterceptors(Message outMessage)
+ {
+ // TODO - how can I improve this to provide a specific interceptor chain that just has the
+ // stax, gzip and message sender components, while also ensuring that GZIP is only provided
+ // if its already configured for the endpoint.
+ Iterator<Interceptor<? extends Message>> iterator = outMessage.getInterceptorChain().iterator();
+ while (iterator.hasNext())
+ {
+ Interceptor<? extends Message> inInterceptor = iterator.next();
+ if (!inInterceptor.getClass().equals(GZIPOutInterceptor.class) && !inInterceptor.getClass().equals(MessageSenderInterceptor.class))
+ {
+ outMessage.getInterceptorChain().remove(inInterceptor);
+ }
+ }
+ outMessage.getExchange().put(TRANSFORM_SKIP, Boolean.TRUE);
+
+ }
+
+ protected Message createOutMessage(Message message)
+ {
+ Message mout = new MessageImpl();
+ mout.setExchange(message.getExchange());
+ mout = message.getExchange().get(org.apache.cxf.endpoint.Endpoint.class).getBinding().createMessage(mout);
+ mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange()));
+ message.getExchange().setOutMessage(mout);
+ return mout;
+ }
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/AbstractMangementInInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetInterceptor.java 2015-03-25 09:53:57 UTC (rev 19602)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsGetInterceptor.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -39,7 +39,7 @@
*
*/
-public class EndpointConfigsGetInterceptor extends AbstractEndpintManagementInterceptor {
+public class EndpointConfigsGetInterceptor extends AbstractMangementInInterceptor {
public static final EndpointConfigsGetInterceptor INSTANCE = new EndpointConfigsGetInterceptor();
public static final String ENDPOINT_CONFIGS = EndpointConfigsGetInterceptor.class.getName() + ".EndpointConfigs";
public static final Set<String> httpMethods = new HashSet<String>(4);
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutInterceptor.java 2015-03-25 09:53:57 UTC (rev 19602)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointConfigsPutInterceptor.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -32,13 +32,14 @@
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.Phase;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.stack.cxf.config.RuntimeConfigListenerManager;
/**
* Interceptor to set runtime configuration with http put url like: http://localhost:8080/context/endpoint?statistics-enabled=true
*@author <a href="mailto:ema@redhat.com>Jim Ma</a>
*
*/
-public class EndpointConfigsPutInterceptor extends AbstractEndpintManagementInterceptor
+public class EndpointConfigsPutInterceptor extends AbstractMangementInInterceptor
{
public static final EndpointConfigsPutInterceptor INSTANCE = new EndpointConfigsPutInterceptor();
public static final String CONFIG_RESULT = EndpointConfigsPutInterceptor.class.getName() + ".EndpointConfigPutResult";
@@ -84,6 +85,11 @@
for (String key : queryMaps.keySet())
{
endpoint.setRuntimeProperty(key, queryMaps.get(key));
+ RuntimeConfigListenerManager listenerManager = message.getExchange().getBus().getExtension(RuntimeConfigListenerManager.class);
+ if (listenerManager != null && listenerManager.getListeners(key) != null)
+ {
+ listenerManager.getListeners(key).configChange(message, queryMaps.get(key));
+ }
}
mout.put(CONFIG_RESULT, "Successfully set endpoint runtime configurations.");
cleanUpOutInterceptors(mout);
Modified: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java 2015-03-25 09:53:57 UTC (rev 19602)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -40,7 +40,7 @@
*@author <a href="mailto:ema@redhat.com>Jim Ma</a>
*
*/
-public class EndpointMetricsGetInterceptor extends AbstractEndpintManagementInterceptor
+public class EndpointMetricsGetInterceptor extends AbstractMangementInInterceptor
{
public static final EndpointMetricsGetInterceptor INSTANCE = new EndpointMetricsGetInterceptor();
public static final String ENDPOINT_METRICS = EndpointMetricsGetInterceptor.class.getName() + ".EndpointMetrics";
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetInterceptor.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetInterceptor.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -0,0 +1,206 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.interceptor;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.OutgoingChainInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.jboss.ws.api.monitoring.Record;
+import org.jboss.ws.api.monitoring.RecordFilter;
+import org.jboss.ws.api.monitoring.RecordProcessor;
+import org.jboss.ws.common.monitoring.AndFilter;
+import org.jboss.ws.common.monitoring.HostFilter;
+import org.jboss.ws.common.monitoring.MemoryBufferRecorder;
+import org.jboss.ws.common.monitoring.NotFilter;
+import org.jboss.ws.common.monitoring.OperationFilter;
+import org.jboss.ws.common.monitoring.OrFilter;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+/**
+ * Interceptor to get json format endpoint records. This interceptor is only
+ * responds to get url like http://localhost:8080/context/wsendpoint/management?records&query='sender is localhost'
+ *@author <a href="mailto:ema@redhat.com>Jim Ma</a>
+ *
+ */
+public class EndpointRecordGetInterceptor extends AbstractMangementInInterceptor
+{
+
+ public static final EndpointRecordGetInterceptor INSTANCE = new EndpointRecordGetInterceptor();
+ public static final String RECORDS = EndpointRecordGetInterceptor.class.getName() + ".RECORDS";
+
+ public static final Set<String> httpMethods = new HashSet<String>(4);
+ private static final String QUERY_REGEX = "^(sender|operation)\\s(not|is)\\s(\\S*)+(\\s(and|or)\\s(sender|operation)\\s(not|is)\\s\\S*)?(\\s)*$";
+ private Interceptor<Message> recordOutInteceptor = EndpointRecordGetOutInterceptor.INSTANCE;
+ private static final String TRANSFORM_SKIP = "transform.skip";
+ private static final Pattern pattern = Pattern.compile(QUERY_REGEX);
+ static
+ {
+ httpMethods.add("GET");
+ }
+
+ public EndpointRecordGetInterceptor()
+ {
+ super(Phase.READ);
+ getAfter().add(EndpointSelectionInterceptor.class.getName());
+ }
+
+ public EndpointRecordGetInterceptor(Interceptor<Message> outInterceptor)
+ {
+ this();
+ // Let people override the EndpointConfigsGetOutIntercetpor
+ //configsOutInteceptor = outInterceptor;
+ }
+
+ public void handleMessage(Message message) throws Fault
+ {
+ if (!isAllowed(message))
+ {
+ return;
+ }
+ if (isRecognizedQuery(getQueryMap(message)))
+ {
+ String query = getQueryMap(message).get("query");
+ Endpoint endpoint = message.getExchange().get(Endpoint.class);
+ List<RecordProcessor> processors = endpoint.getRecordProcessors();
+ try
+ {
+ if (query != null && !isValid(query = URLDecoder.decode(query, this.getEncoding(message)).toLowerCase()))
+ {
+ //TODO:return a better error message
+ return;
+ }
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new Fault(e);
+ }
+ MemoryBufferRecorder memRecorder = null;
+ for (RecordProcessor processor : processors)
+ {
+ if (processor.getName().equals("MemoryBufferRecorder"))
+ {
+ memRecorder = (MemoryBufferRecorder)processor;
+ break;
+ }
+ }
+ if (memRecorder == null)
+ {
+ return;
+ }
+
+ List<RecordFilter> filterList = new ArrayList<RecordFilter>();
+ if (query != null)
+ {
+ String[] elements = query.split("\\s(and|or)\\s");
+ if (elements.length > 1)
+ {
+ RecordFilter left = getFilter(elements[0]);
+ RecordFilter right = getFilter(elements[1]);
+ if (query.contains("and"))
+ {
+ filterList.add(new AndFilter(left, right));
+ }
+ if (query.contains("or"))
+ {
+ filterList.add(new OrFilter(left, right));
+ }
+ }
+ else
+ {
+ filterList.add(getFilter(elements[0]));
+ }
+ }
+ Map<String, List<Record>> records = memRecorder.getMatchingRecords(filterList.toArray(new RecordFilter[] {}));
+ Message mout = this.createOutMessage(message);
+ mout.put(RECORDS, records);
+ mout.put(Message.CONTENT_TYPE, "text/xml");
+ // just remove the interceptor which should not be used
+ cleanUpOutInterceptors(mout);
+ // notice this is being added after the purge above, don't swap the order!
+
+ mout.getInterceptorChain().add(recordOutInteceptor);
+ message.getExchange().put(TRANSFORM_SKIP, Boolean.TRUE);
+ // skip the service executor and goto the end of the chain.
+ message.getInterceptorChain().doInterceptStartingAt(message, OutgoingChainInterceptor.class.getName());
+
+ }
+ }
+
+ private RecordFilter getFilter(final String query)
+ {
+ String[] elements = query.split("\\s(is|not)\\s");
+ RecordFilter result = null;
+ if (elements[0].equals("sender"))
+ {
+ result = new HostFilter(elements[1], true);
+ }
+ else
+ {
+ result = new OperationFilter(elements[1]);
+ }
+ if (query.contains("not"))
+ {
+ result = new NotFilter(result);
+ }
+ return result;
+ }
+
+ private boolean isRecognizedQuery(final Map<String, String> map)
+ {
+ if (map.containsKey("records") && map.size() == 1)
+ {
+ return true;
+ }
+ if (map.size() == 2 && map.containsKey("records") && map.containsKey("query"))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ Set<String> getAllowedMethod()
+ {
+ return httpMethods;
+ }
+
+ private boolean isValid(final String query)
+ {
+ if (query == null || query.length() == 0)
+ {
+ return false;
+ }
+ return pattern.matcher(query).find();
+ }
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java
===================================================================
--- stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java (rev 0)
+++ stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.interceptor;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.StaxOutInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.codehaus.jettison.AbstractXMLStreamWriter;
+import org.codehaus.jettison.mapped.MappedNamespaceConvention;
+import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
+import org.jboss.ws.api.monitoring.Record;
+
+/**
+ * Out Interceptor to write json format endpoint request records. This interceptor is added to interceptorchain by
+ * @see org.jboss.wsf.stack.cxf.interceptor.EndpointRecordGetInterceptor
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public class EndpointRecordGetOutInterceptor extends AbstractManagementInterceptor
+{
+ public static final EndpointRecordGetOutInterceptor INSTANCE = new EndpointRecordGetOutInterceptor();
+
+ public EndpointRecordGetOutInterceptor()
+ {
+ super(Phase.PRE_STREAM);
+ getAfter().add(StaxOutInterceptor.class.getName());
+ }
+
+ public void handleMessage(Message message) throws Fault
+ {
+ @SuppressWarnings("unchecked")
+ Map<String, List<Record>> records = (Map<String, List<Record>>)message.get(EndpointRecordGetInterceptor.RECORDS);
+ message.remove(EndpointRecordGetInterceptor.RECORDS);
+ OutputStream out = message.getContent(OutputStream.class);
+ if (out == null)
+ {
+ return;
+ }
+ message.put(Message.CONTENT_TYPE, "text/xml");
+ OutputStreamWriter writer = null;
+ AbstractXMLStreamWriter mappedWriter = null;
+ try
+ {
+ writer = new OutputStreamWriter(out, getEncoding(message));
+ mappedWriter = new MappedXMLStreamWriter(new MappedNamespaceConvention(), writer);
+ mappedWriter.writeStartDocument();
+ for (String group : records.keySet()) {
+ mappedWriter.writeStartElement(group);
+ for(Record record : records.get(group)) {
+ mappedWriter.writeStartElement(record.getMessageType().toString());
+ writeElement(mappedWriter, "data", record.getDate());
+ writeElement(mappedWriter, "sender", record.getSourceHost());
+ writeElement(mappedWriter, "receiver", record.getDestinationHost());
+ writeElement(mappedWriter, "operation", record.getOperation());
+ writeElement(mappedWriter, "envelope", record.getEnvelope());
+ mappedWriter.writeStartElement("headers");
+ for(String key : record.getHeaders().keySet()) {
+ writeElement(mappedWriter, key, record.getHeaders().get(key));
+ }
+ mappedWriter.writeEndElement();
+ mappedWriter.writeEndElement();
+ }
+ mappedWriter.writeEndElement();
+ }
+ mappedWriter.writeEndDocument();
+ out.flush();
+ }
+ catch (Exception e)
+ {
+ throw new Fault(e);
+ }
+ finally
+ {
+ StaxUtils.close(mappedWriter);
+ }
+ }
+
+ private void writeElement(AbstractXMLStreamWriter writter, String key, Object value) throws Exception
+ {
+ writter.writeStartElement(key);
+ if (value != null)
+ {
+ writter.writeCharacters(value.toString());
+ }
+ writter.writeEndElement();
+
+ }
+}
Property changes on: stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointRecordGetOutInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/branches/management/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java
===================================================================
--- stack/cxf/branches/management/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java 2015-03-25 09:53:57 UTC (rev 19602)
+++ stack/cxf/branches/management/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java 2015-03-25 09:58:49 UTC (rev 19603)
@@ -159,6 +159,24 @@
assertTrue("Unexpected rquestCount response", bout.toString().contains("\"requestCount\":1"));
assertTrue("Unexpected invocation count", bout.toString().contains("\"Method(testMessageContextProperties())InvocationCount:\":1"));
+ //get records
+ url = new URL(baseURL + "/jaxws-samples-context-jse/management?record-enabled=true");
+ connenction = (HttpURLConnection)url.openConnection();
+ connenction.setRequestProperty("Authorization", "Basic " + encoding);
+ connenction.connect();
+ assertEquals(200, connenction.getResponseCode());
+ port.testGetUserPrincipal();
+ port.testMessageContextProperties();
+ url = new URL(baseURL + "/jaxws-samples-context-jse/management?records");
+ connenction = (HttpURLConnection)url.openConnection();
+ connenction.setRequestProperty("Authorization", "Basic " + encoding);
+ connenction.connect();
+ assertEquals(200, connenction.getResponseCode());
+ bout = new ByteArrayOutputStream();
+ IOUtils.copy(connenction.getInputStream(), bout);
+ assertTrue("Unexpected records response", bout.toString().contains("{\"INBOUND\":{\"data\""));
+
+
}
}
9 years, 9 months
JBossWS SVN: r19602 - in common/branches/management/src/main/java/org/jboss/ws/common: invocation and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2015-03-25 05:53:57 -0400 (Wed, 25 Mar 2015)
New Revision: 19602
Modified:
common/branches/management/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java
common/branches/management/src/main/java/org/jboss/ws/common/invocation/RecordingServerHandler.java
common/branches/management/src/main/java/org/jboss/ws/common/monitoring/OperationFilter.java
Log:
[JBWS-3895]:Refactor work for enable RecordProcessor in runtime
Modified: common/branches/management/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java
===================================================================
--- common/branches/management/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java 2015-03-25 09:51:59 UTC (rev 19601)
+++ common/branches/management/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java 2015-03-25 09:53:57 UTC (rev 19602)
@@ -23,7 +23,6 @@
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -33,7 +32,6 @@
import javax.management.ObjectName;
import org.jboss.ws.api.monitoring.Record;
-import org.jboss.ws.api.monitoring.RecordFilter;
import org.jboss.ws.api.monitoring.RecordProcessor;
import org.jboss.ws.common.Messages;
import org.jboss.ws.common.injection.PreDestroyHolder;
@@ -84,6 +82,7 @@
protected Map<String, String> configsMap = new HashMap<String, String>(64);
static {
RUNTIME_CONFIG_FLAGS.add(RuntimeConfig.STATISTICS_ENABLED);
+ RUNTIME_CONFIG_FLAGS.add(RuntimeConfig.RECORD_ENABLED);
}
AbstractDefaultEndpoint(String targetBean)
@@ -291,20 +290,9 @@
{
for (RecordProcessor processor : recordProcessors)
{
- if (processor.isRecording())
+ if (processor.isRecording() || ("true".equals(getRuntimeProperty(RuntimeConfig.RECORD_ENABLED)) && processor.getName().equals(getRuntimeProperty(RuntimeConfig.PROCESSOR))))
{
- boolean match = true;
- if (processor.getFilters() != null)
- {
- for (Iterator<RecordFilter> it = processor.getFilters().iterator(); it.hasNext() && match;)
- {
- match = it.next().match(record);
- }
- }
- if (match)
- {
- processor.processRecord(record);
- }
+ processor.processRecord(record);
}
}
}
@@ -370,10 +358,11 @@
return endpointConfig;
}
- public Map<String, String> getAllConfigsMap() {
- configsMap.put(Endpoint.ADDRESS, this.getAddress());
- configsMap.putAll(this.getRuntimeProperties());
- return configsMap;
+ public Map<String, String> getAllConfigsMap()
+ {
+ configsMap.put(Endpoint.ADDRESS, this.getAddress());
+ configsMap.putAll(this.getRuntimeProperties());
+ return configsMap;
}
@Override
Modified: common/branches/management/src/main/java/org/jboss/ws/common/invocation/RecordingServerHandler.java
===================================================================
--- common/branches/management/src/main/java/org/jboss/ws/common/invocation/RecordingServerHandler.java 2015-03-25 09:51:59 UTC (rev 19601)
+++ common/branches/management/src/main/java/org/jboss/ws/common/invocation/RecordingServerHandler.java 2015-03-25 09:53:57 UTC (rev 19602)
@@ -44,6 +44,7 @@
import org.jboss.ws.common.DOMWriter;
import org.jboss.ws.common.monitoring.RecordFactory;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.RuntimeConfig;
import org.jboss.wsf.spi.invocation.EndpointAssociation;
/**
@@ -162,9 +163,12 @@
{
return false;
}
+
for (RecordProcessor processor : processors)
{
- if (processor.isRecording())
+ if (processor.isRecording()
+ || ("true".equals(endpoint.getRuntimeProperty(RuntimeConfig.RECORD_ENABLED)) && processor.getName().equals(
+ endpoint.getRuntimeProperty(RuntimeConfig.PROCESSOR))))
{
return true;
}
Modified: common/branches/management/src/main/java/org/jboss/ws/common/monitoring/OperationFilter.java
===================================================================
--- common/branches/management/src/main/java/org/jboss/ws/common/monitoring/OperationFilter.java 2015-03-25 09:51:59 UTC (rev 19601)
+++ common/branches/management/src/main/java/org/jboss/ws/common/monitoring/OperationFilter.java 2015-03-25 09:53:57 UTC (rev 19602)
@@ -37,7 +37,13 @@
private static final long serialVersionUID = -726794729964445956L;
private QName operation;
+
+ private String opeationName;
+ public OperationFilter(String operation) {
+ opeationName = operation;
+ }
+
public OperationFilter(QName operation)
{
this.operation = operation;
@@ -51,7 +57,7 @@
{
return true;
}
- else if (operation != null && operation.equals(record.getOperation()))
+ else if ((operation != null && operation.equals(record.getOperation())) || (opeationName != null && opeationName.equalsIgnoreCase(record.getOperation().getLocalPart())))
{
return true;
}
9 years, 9 months
JBossWS SVN: r19601 - spi/branches/management/src/main/java/org/jboss/wsf/spi/deployment.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2015-03-25 05:51:59 -0400 (Wed, 25 Mar 2015)
New Revision: 19601
Modified:
spi/branches/management/src/main/java/org/jboss/wsf/spi/deployment/RuntimeConfig.java
Log:
[JBWS-3895]:Add constant for record-enabled setting through url
Modified: spi/branches/management/src/main/java/org/jboss/wsf/spi/deployment/RuntimeConfig.java
===================================================================
--- spi/branches/management/src/main/java/org/jboss/wsf/spi/deployment/RuntimeConfig.java 2015-03-24 18:00:52 UTC (rev 19600)
+++ spi/branches/management/src/main/java/org/jboss/wsf/spi/deployment/RuntimeConfig.java 2015-03-25 09:51:59 UTC (rev 19601)
@@ -32,6 +32,8 @@
public interface RuntimeConfig
{
static final String STATISTICS_ENABLED = "statistics-enabled";
+ static final String RECORD_ENABLED= "record-enabled";
+ static final String PROCESSOR = "record-processor";
/** Get runtime changeable property */
String getRuntimeProperty(String key);
9 years, 9 months
JBossWS SVN: r19600 - common/trunk/src/main/java/org/jboss/ws/common/deployment.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2015-03-24 14:00:52 -0400 (Tue, 24 Mar 2015)
New Revision: 19600
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java
Log:
[JBWS-3878] removed unintended methods
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java 2015-03-24 17:58:25 UTC (rev 19599)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java 2015-03-24 18:00:52 UTC (rev 19600)
@@ -45,7 +45,6 @@
private final UnifiedVirtualFile rootFile;
private List<UnifiedVirtualFile> metadataFiles;
- private DeploymentType deploymentType;
ArchiveDeploymentImpl(String simpleName, ClassLoader classLoader, UnifiedVirtualFile rootFile)
{
@@ -100,12 +99,4 @@
{
return new ResourceResolverImpl(this);
}
-
- public void setType(DeploymentType deploymentType) {
- this.deploymentType = deploymentType;
- }
-
- public DeploymentType getType() {
- return deploymentType;
- }
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java 2015-03-24 17:58:25 UTC (rev 19599)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java 2015-03-24 18:00:52 UTC (rev 19600)
@@ -42,7 +42,6 @@
private final Service service;
// The runtime class loader
private final ClassLoader classLoader;
- private DeploymentType deploymentType;
DefaultDeployment(String name, ClassLoader classLoader)
{
@@ -66,12 +65,4 @@
{
return service;
}
-
- public void setType(DeploymentType deploymentType) {
- this.deploymentType = deploymentType;
- }
-
- public DeploymentType getType() {
- return deploymentType;
- }
}
9 years, 9 months