我的服務器端代碼: -在寧靜的實施滯留(JAX-RS)
@ApplicationPath("/externalpartnerws")
public class ExternalPartnerApplication extends javax.ws.rs.core.Application {
public Set<Class<?>> getClasses() {
return new HashSet<Class<?>>() { { add(ExternalPartnerApplicationResource.class); } };
}
}
@Path(value="/retrievetier2")
public class ExternalPartnerApplicationResource {
/**
* public constructor according to JSR-3.1.2 specification.
*/
public ExternalPartnerApplicationResource() {}
@GET
@Path("/bycountry/{distributorId}/{countryCd}")
// type "text/plain"
@Produces("application/xml")
public String retrieveTier2ByCountry(
@PathParam("distributorId") String distributorId,
@PathParam("countryCd") String countryCd
) {
if(distributorId == null && countryCd == null)
return null;
else //Moving logic from Controller to (Business) Model.
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><retrieveTier2ByCountry/>";
}
的web.xml
<servlet>
<description>JAX-RS Tools Generated - Do not modify</description>
<servlet-name>RestServlet</servlet-name>
<servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>
com.ibm.drit.lib.extws.ExternalPartnerApplication
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>RestServlet</servlet-name>
<url-pattern>/retrievetier2/bycountry/*</url-pattern>
</servlet-mapping>
客戶: - 在7.0與RAD 8.0.3
RestClient restClient = new RestClient();
Resource resource = restClient.resource("http://localhost:9080/externalpartnerws/retrievetier2/bycountry/distributorId/2/countryCd/2");
resource.contentType(props.getProperty("text/plain"));
resource.accept(props.getProperty("application/xml"));
ClientResponse response = resource.get();
String responseXml = response.getEntity(String.class);
我是Jax-RS中的新成員,現在處於Jax-RS小代碼的死鎖狀態。
我越來越
The following error occurred during the invocation of the handlers chain: 404 - Not Found with message ''null'' while processing GET request sent to ......
我做任何基本的錯誤呢?最近兩天我花了這個錢。 如果您需要更多信息,請讓我知道。
只是爲了增加,我在運行服務器時收到以下消息。 SystemErr R 250 [SoapConnectorThreadPool:1] INFO org.apache.wink.server.internal.log.Providers - 在應用程序中沒有定義自定義JAX-RS提供程序。 – kkjava