2016-04-03 18 views
0

Ben formayı kullanarak bir jax-rs hizmetini yazdım, sınıf, İstenen kaynak mevcut değil jax-rs hizmet

böyle aşağıdakiler için url tanımlamak istiyorsanız, aşağıdaki gibidir

Bir parametreler ileterek rapor almak için

http://localhost:8085/DiginReport/rs/Reports/getreport/ {test1: değer, dnm2: değer}

Bir Motor başlatmak için: i url bu tip

@Path("Reports") public class ReportService { @GET @Path("/getreport}/{parameters}") @Produces(MediaType.TEXT_PLAIN) public Response getReport(@PathParam("reportName") String reportName,@PathParam("parameters") String parameters) throws KettleXMLException, KettleMissingPluginsException, JSONException, UnknownParamException { JSONArray jsonarr; return Response.status(200).entity("ok").build(); } @GET @Path("{start}") @Produces(MediaType.TEXT_PLAIN) public Response startEngine(@PathParam("start") String command) { return Response.status(200).entity("ok").build(); } } 

http://localhost:8085/DiginReport/rs/Reports/start

, bu kullanılabilir olmadığını kaynak diyor, http://localhost:8085/DiginReport/rs/Reports/start

+1

'@Yol ("/getreport}/{parameters} ") Bu doğrudur, çünkü getReports'un bir traling'i vardır:}? –

+0

nasıl değiştirilmeli? – Sajeetharan

+0

'@Path ("/getreport/{parameters} ")' –

cevap

0

Aşağıdaki kodu deneyin.

Ben de şunları dikkate alacağını. Bunun yerine yol parametresi (kaçmak gerektiğini unutmayın olarak dizesinin application/json olarak

Geçiş Json verilerini

Kullanım motoru çalıştırmak için GET daha başka bir yöntem (örn POST), get sadece veri almak için.

Kullanım kaynaklarını yerine start veya getreports ait URL içinde kullanılmalıdır beri.

@Path("Reports") 
public class ReportService { 

    @GET 
    @Path("/getreport/{parameters}") 
    @Produces(MediaType.TEXT_PLAIN) 
    public Response getReport(@PathParam("parameters") String parameters) throws KettleXMLException, KettleMissingPluginsException, JSONException, UnknownParamException { 
     JSONArray jsonarr; 
     return Response.status(200).entity("ok").build(); 
    } 


    @GET 
    @Path("/start") 
    @Produces(MediaType.TEXT_PLAIN) 
    public Response startEngine() { 
     return Response.status(200).entity("ok").build(); 
    } 
} 
+0

, bağımsız bir uygulama olarak dağıtıldığında düzeltildi. – Sajeetharan