This is an automated email from the ASF dual-hosted git repository.
robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git
The following commit(s) were added to refs/heads/master by this push:
new a1ea6835da AXIS2-5929 REST GET request using Accept HTTP Header to
indicate JSON, does not working
a1ea6835da is described below
commit a1ea6835dac83d7d80904e45d8e069cee47d7add
Author: Robert Lazarski <[email protected]>
AuthorDate: Mon Nov 11 15:53:04 2024 -1000
AXIS2-5929 REST GET request using Accept HTTP Header to indicate JSON, does
not working
---
.../org/apache/axis2/json/AbstractJSONOMBuilder.java | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java
b/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java
index af3af8531a..da1fa31acc 100644
--- a/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java
+++ b/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java
@@ -35,6 +35,8 @@ import java.io.Reader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
+import javax.servlet.http.HttpServletRequest;
+
/** Makes the OMSourcedElement object with the JSONDataSource inside. */
public abstract class AbstractJSONOMBuilder implements Builder {
@@ -86,7 +88,20 @@ public abstract class AbstractJSONOMBuilder implements
Builder {
jsonString = requestURL.substring(index + 1);
reader = new StringReader(jsonString);
} else {
- throw new AxisFault("No JSON message received through HTTP GET
or POST");
+ /*
+ * AXIS2-5929 REST GET request using Accept HTTP Header to
indicate JSON, does not working
+ * MARTI PAMIES SOLA
+ * Get JSON message from request URI if not present as
parameter.
+ * To be able to response to full URL requests
+ */
+ HttpServletRequest httpServeltRqst
=(HttpServletRequest)messageContext.getProperty("transport.http.servletRequest");
+ String requestParam=httpServeltRqst.getRequestURI();
+ if (!(requestParam.equals(""))) {
+ jsonString = requestParam;
+ reader = new StringReader(jsonString);
+ }else {
+ throw new AxisFault("No JSON message received
through HTTP GET or POST");
+ }
}
} else {
// Not sure where this is specified, but SOAPBuilder also
determines the charset