You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2017/03/23 13:22:15 UTC
[1/2] cxf git commit: Moving the direct Servlet API imports out of
JAXRSUtils
Repository: cxf
Updated Branches:
refs/heads/master ee248ce7a -> 3da566423
Moving the direct Servlet API imports out of JAXRSUtils
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/726c0aa6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/726c0aa6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/726c0aa6
Branch: refs/heads/master
Commit: 726c0aa641e408a18fa5f4ff82df682d489874f4
Parents: 64070aa
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Thu Mar 23 13:20:49 2017 +0000
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Thu Mar 23 13:21:30 2017 +0000
----------------------------------------------------------------------
.../org/apache/cxf/jaxrs/utils/FormUtils.java | 12 ++++++++
.../org/apache/cxf/jaxrs/utils/HttpUtils.java | 23 +++++++++++++++
.../org/apache/cxf/jaxrs/utils/JAXRSUtils.java | 30 ++------------------
3 files changed, 38 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/726c0aa6/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
index eb7bb55..a216b2d 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
@@ -32,6 +32,7 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Form;
@@ -50,6 +51,7 @@ import org.apache.cxf.jaxrs.provider.FormEncodingProvider;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageUtils;
import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.transport.http.AbstractHTTPDestination;
public final class FormUtils {
public static final String FORM_PARAMS_FROM_HTTP_PARAMS = "set.form.parameters.from.http.parameters";
@@ -151,6 +153,16 @@ public final class FormUtils {
}
+ public static void populateMapFromStringOrHttpRequest(MultivaluedMap<String, String> params,
+ Message m,
+ String postBody,
+ String enc,
+ boolean decode) {
+ HttpServletRequest request = (HttpServletRequest)m.get(AbstractHTTPDestination.HTTP_REQUEST);
+ populateMapFromString(params, m, postBody, enc, decode, request);
+
+ }
+
public static void populateMapFromString(MultivaluedMap<String, String> params,
Message m,
String postBody,
http://git-wip-us.apache.org/repos/asf/cxf/blob/726c0aa6/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
index 63c87b7..537d34b 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
@@ -35,7 +35,10 @@ import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
@@ -52,6 +55,8 @@ import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.common.util.UrlUtils;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.jaxrs.impl.HttpHeadersImpl;
+import org.apache.cxf.jaxrs.impl.HttpServletRequestFilter;
+import org.apache.cxf.jaxrs.impl.HttpServletResponseFilter;
import org.apache.cxf.jaxrs.impl.MetadataMap;
import org.apache.cxf.jaxrs.impl.PathSegmentImpl;
import org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl;
@@ -643,4 +648,22 @@ public final class HttpUtils {
return false;
}
+
+ public static <T> T createServletResourceValue(Message m, Class<T> clazz) {
+
+ Object value = null;
+ if (clazz == HttpServletRequest.class) {
+ HttpServletRequest request = (HttpServletRequest)m.get(AbstractHTTPDestination.HTTP_REQUEST);
+ value = request != null ? new HttpServletRequestFilter(request, m) : null;
+ } else if (clazz == HttpServletResponse.class) {
+ HttpServletResponse response = (HttpServletResponse)m.get(AbstractHTTPDestination.HTTP_RESPONSE);
+ value = response != null ? new HttpServletResponseFilter(response, m) : null;
+ } else if (clazz == ServletContext.class) {
+ value = m.get(AbstractHTTPDestination.HTTP_CONTEXT);
+ } else if (clazz == ServletConfig.class) {
+ value = m.get(AbstractHTTPDestination.HTTP_CONFIG);
+ }
+
+ return clazz.cast(value);
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/726c0aa6/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
index f3643f9..4628ba3 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
@@ -46,10 +46,6 @@ import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.Produces;
@@ -104,8 +100,6 @@ import org.apache.cxf.jaxrs.impl.AsyncResponseImpl;
import org.apache.cxf.jaxrs.impl.ContainerRequestContextImpl;
import org.apache.cxf.jaxrs.impl.ContainerResponseContextImpl;
import org.apache.cxf.jaxrs.impl.HttpHeadersImpl;
-import org.apache.cxf.jaxrs.impl.HttpServletRequestFilter;
-import org.apache.cxf.jaxrs.impl.HttpServletResponseFilter;
import org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider;
import org.apache.cxf.jaxrs.impl.MetadataMap;
import org.apache.cxf.jaxrs.impl.PathSegmentImpl;
@@ -142,7 +136,6 @@ import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageUtils;
import org.apache.cxf.phase.PhaseInterceptorChain;
import org.apache.cxf.service.Service;
-import org.apache.cxf.transport.http.AbstractHTTPDestination;
public final class JAXRSUtils {
@@ -955,8 +948,7 @@ public final class JAXRSUtils {
if (mt == null || mt.isCompatible(MediaType.APPLICATION_FORM_URLENCODED_TYPE)) {
String enc = HttpUtils.getEncoding(mt, StandardCharsets.UTF_8.name());
String body = FormUtils.readBody(m.getContent(InputStream.class), enc);
- HttpServletRequest request = (HttpServletRequest)m.get(AbstractHTTPDestination.HTTP_REQUEST);
- FormUtils.populateMapFromString(params, m, body, enc, decode, request);
+ FormUtils.populateMapFromStringOrHttpRequest(params, m, body, enc, decode);
} else {
if ("multipart".equalsIgnoreCase(mt.getType())
&& MediaType.MULTIPART_FORM_DATA_TYPE.isCompatible(mt)) {
@@ -1117,7 +1109,7 @@ public final class JAXRSUtils {
}
}
if (o == null && contextMessage != null && !MessageUtils.isRequestor(contextMessage)) {
- o = createServletResourceValue(contextMessage, clazz);
+ o = HttpUtils.createServletResourceValue(contextMessage, clazz);
}
return clazz.cast(o);
}
@@ -1157,23 +1149,7 @@ public final class JAXRSUtils {
return createContextValue(m, genericType, clazz);
}
- public static <T> T createServletResourceValue(Message m, Class<T> clazz) {
-
- Object value = null;
- if (clazz == HttpServletRequest.class) {
- HttpServletRequest request = (HttpServletRequest)m.get(AbstractHTTPDestination.HTTP_REQUEST);
- value = request != null ? new HttpServletRequestFilter(request, m) : null;
- } else if (clazz == HttpServletResponse.class) {
- HttpServletResponse response = (HttpServletResponse)m.get(AbstractHTTPDestination.HTTP_RESPONSE);
- value = response != null ? new HttpServletResponseFilter(response, m) : null;
- } else if (clazz == ServletContext.class) {
- value = m.get(AbstractHTTPDestination.HTTP_CONTEXT);
- } else if (clazz == ServletConfig.class) {
- value = m.get(AbstractHTTPDestination.HTTP_CONFIG);
- }
-
- return clazz.cast(value);
- }
+
//CHECKSTYLE:OFF
private static Object readFromUriParam(Message m,
String parameterName,
[2/2] cxf git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/cxf
Posted by se...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cxf
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3da56642
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3da56642
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3da56642
Branch: refs/heads/master
Commit: 3da566423f8a02305612959018412306769ad94d
Parents: 726c0aa ee248ce
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Thu Mar 23 13:22:01 2017 +0000
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Thu Mar 23 13:22:01 2017 +0000
----------------------------------------------------------------------
.../org/apache/cxf/common/util/ClassHelper.java | 5 ----
.../cxf/staxutils/W3CDOMStreamReader.java | 7 ++++--
.../cxf/transport/TransportURIResolver.java | 9 ++++++-
.../cxf/maven_plugin/AbstractCodegenMoho.java | 13 ++++++----
.../cxf/transport/jms/JMSMessageUtils.java | 26 +++++++++++++++++++-
.../cxf/transport/jms/JMSPropertyType.java | 19 +++++++-------
6 files changed, 55 insertions(+), 24 deletions(-)
----------------------------------------------------------------------