开发者

grails remoting plugin - always 404?

I'm trying to expose a remote interface to a spring web application, and I'm having issues, always getting 404. What's wrong with my setup below?

Grails:

services - package mypackage

class RemoteUserService implements RemoteUserServiceInterface {
    static expose = ['httpinvoker']

    User findUser(String userId) {
        return User.findByUserId(userId);
    }
}

src/groovy/mypackage

class RemoteUserService implements RemoteUserServiceInterface {
    static expose = ['httpinvoker']

    User findUser(String userId) {
        return User.findByUserId(userId);
    }
}

Spring:

mypackage

public class MyController extends AbstractController {
    RemoteUserServiceInterface remoteUserService
}

appContext

<bean id="viewController" class="mypackage.MyController">
    <property name="remoteUserService" ref="remoteUserService"/>
</bean>

<bean id="remoteUserService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
    <property name="serviceUrl" value="http://localhost:8080/grails-app-name/httpinvoker/RemoteUserService"/>
    <property name="serviceInterf开发者_如何学运维ace" value="mypackage.RemoteUserServiceInterface"/>
</bean>


You need to define a UrlMapping of

"$controller/$action?/$id?" {}

or else the plugin won't work correctly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜