2

I have deployed simple REST interface. Lets say my REST service is deployed in this context path:

http://localhost:8080/Engine/services/Evaluation

Then I invoke URL like this:

http://localhost:8080/Engine/services/Evaluation?_wadl

I can see the XML output:

<application>
    <grammars/>
    <resources base="http://localhost:8080/Engine/services/Evaluation">
        <resource path="/Evaluation/">
            <resource path="initializeEvaluation/{localeCode}">
                <param name="localeCode" style="template" type="xs:string"/>
                <method name="GET">
                    <request>
                        <representation mediaType="application/octet-stream"/>
                    </request>
                    <response>
                        <representation mediaType="application/json"/>
                    </response>
                </method>
            </resource>
        </resource>
    </resources>
</application>

The question is how to call the method with the URL from the browser?

I've tried to enter:

http://localhost:8080/Engine/services/Evaluation/initializeEvaluation?localeCode=en-GB

But I've got:

2013-01-30 11:22:13,477 [http-bio-8080-exec-3] WARN   JAXRSInInterceptor - No root resource matching request path /Engine/services/Evaluation/initializeEvaluation has been found, Relative Path: /initializeEvaluation. Please enable FINE/TRACE log level for more details.
2013-01-30 11:22:13,479 [http-bio-8080-exec-3] WARN   WebApplicationExceptionMapper - javax.ws.rs.NotFoundException

I am very new at REST but as far as I understand the URL should be like above. Why then I am getting and exception?

My java interface:

@Path("/Evaluation/")
@Produces(MediaType.APPLICATION_JSON)
public interface EvaluationService {

    @GET
    @Path("initializeEvaluation/{localeCode}")
    EvaluationStatus initializeEvaluation(ClientType client, @PathParam("localeCode") String localeCode)
            throws EvaluationException;

}

I am using Apache CXF 2.7.0, JDK 1.7, Tomcat 7.

4

3 Answers 3

3

It's a path param. Thus, I believe the URL should be:

http://localhost:8080/Engine/services/Evaluation/initializeEvaluation/en-GB
Sign up to request clarification or add additional context in comments.

Comments

1

You are missing a / in your @Path annotation.

@Path("/initializeEvaluation/{localeCode}")

1 Comment

The same error. Please note that I have / on @Path("/Evaluation/"), so I don't need it on the method.
0

Use RestClient plugin , it makes your life easier.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.