次のようなJSONデータを使用してURLを作成する必要があります
http://someurl.com/passfail?parameter= {"data1":"123456789","data2":"123456789"}、JBoss の ClientResponse を使用してそれを渡し、応答ステータスを取得する必要があります。最初にリテラル文字列データを渡そうとしました
ClientRequest clientrequest = new ClientRequest("http://someurl.com/passfail?parameter={\"data1\":\"123456789\",\"data2\":\"123456789\"});// assuming the "\" is formulated correctly
しかし、それは例外を与えます。したがって、URL url = new URL(the url) も使用してみましたが、うまくいきません。
次の例外が試行中にキャッチされ、かなり行き詰まっていると感じており、誰かが助けてくれることを望んでいます。
IllegalArgumentException:
org.jboss.resteasy.specimpl.UriBuilderImpl.buildFromMap(UriBuilderImpl.java:408)>
org.jboss.resteasy.specimpl.UriBuilderImpl.buildFromValues(UriBuilderImpl.java:558)>
org.jboss.resteasy.specimpl.UriBuilderImpl.build(UriBuilderImpl.java:539)>
org.jboss.resteasy.client.ClientRequest.getUri(ClientRequest.java:786)>
org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor.execute(ApacheHttpClientExecutor.java:77)>
org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:39)>
org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor.execute(AcceptEncodingGZIPInterceptor.java:40)>
org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:45)>
org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:473)>
org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:704)>
org.jboss.resteasy.client.ClientRequest.get(ClientRequest.java:509)>
org.jboss.resteasy.client.ClientRequest.get(ClientRequest.java:537)>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX at line personal Servlet
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX at line personal Servlet
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)>
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)>
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)>
weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:505)>
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:251)>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX at line personal Servlet JSP
weblogic.servlet.jsp.JspBase.service(JspBase.java:34)>
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)>
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)>
weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:505)>
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:251)>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX at line personal Servlet
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX at line personal Servlet
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)>
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)>
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)>
weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:505)>
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:251)>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX at line personal Servlet
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX at line personal Servlet
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)>
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)>
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)>
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)>
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)>
weblogic.security.service.SecurityManager.runAs(Unknown Source)>
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)>
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)>
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)>
weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)>
weblogic.work.ExecuteThread.run(ExecuteThread.java:173)>
Caused by: java.lang.IllegalArgumentException>
java.net.URI.create(URI.java:842)>
org.jboss.resteasy.specimpl.UriBuilderImpl.buildFromMap(UriBuilderImpl.java:404)>
... 60 more>
Caused by: java.net.URISyntaxException: Illegal character in query index 77: http://someurl.com/passfail?parameter={"data1":"123456789","data2":"123456789"}>
java.net.URI$Parser.fail(URI.java:2809)>
java.net.URI$Parser.checkChars(URI.java:2982)>
java.net.URI$Parser.parseHierarchical(URI.java:3072)>
java.net.URI$Parser.parse(URI.java:3014)>
java.net.URI.<init>(URI.java:578)>
java.net.URI.create(URI.java:840)>
... 61 more>