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=... 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\""));
+
+
}
}