Quantcast
Channel: Pentaho Community Forums - BI Platform
Viewing all articles
Browse latest Browse all 2893

Sample Pentaho plugin

$
0
0
Hi folks,
I'm trying to figure out why echo-plugin REST doesn't work. I downloaded the source from pentaho repository, build and deploy into my biserver. I copy the jar to tomcat lib and the echo-plugin folder into system. The html page and action works like a charm but the REST show me a 404 not found response. I wrote a new one based in the echo-plugin and it doesn't work too. Follows the code:


My REST

Code:

package com.dgos.pentaho.xDownloader.rest;


import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static javax.ws.rs.core.MediaType.APPLICATION_XML;


@Path("/xdownloader/api/download")
public class DownloaderRest {


    @GET
    @Path("/export")
    @Produces({ APPLICATION_XML, APPLICATION_JSON })
    public void getFile() {
        System.out.println ("ENTROU!");
    }


}

Spring XML

Code:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://jax-ws.dev.java.net/spring/core"
    xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
                          http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
                          http://jax-ws.dev.java.net/spring/core http://jax-ws.dev.java.net/spring/core.xsd
                          http://jax-ws.dev.java.net/spring/servlet http://jax-ws.dev.java.net/spring/servlet.xsd">


    <context:annotation-config />


    <!-- REST resources -->
    <bean id="api" class="org.pentaho.platform.web.servlet.JAXRSPluginServlet" />
    <bean class="com.dgos.pentaho.xDownloader.rest.DownloaderRest" />


</beans>

Plugin xml

Code:

<?xml version="1.0" encoding="UTF-8"?>
<plugin title='xDownloader plugin'>
  <bean id='xDownloaderAction' class='org.dgos.xDownloader.xDownloaderAction' />
</plugin>

My action is empty for now.

I call the rest like this:
http://localhost:8080/mypentaho/plugin/xdownloader/api/download/export
Why the plugin doesn't work?
Any suggestion?

Viewing all articles
Browse latest Browse all 2893

Trending Articles