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