Hello everybody,

Could please anyone help me to write a universal redirector to match all
requests and to redirected them to a remote host?


Example:

Start:   /redirect/RESTfulServices/resources/customers/pkey/2176172632
Finish: 
http://192.168.100.1:8080/RESTfulServices/resources/customers/pkey/2176172632



GWT Client side:

ClientResource r = new
ClientResource("/redirect/RESTfulServices/resources/customers/pkey/2176172632");



Server side class TestRestletApplication extends Application (my web.xml was
changed to forward all /redirect/* requests to TestRestletApplication)

Router router = new Router(getContext());
router.attach("/RESTfulServices", new MyRedirector(getContext(), null));  //  
<-- this is wrong


and MyRedirector class:
public class MyRedirector extends Redirector {

    public MyRedirector(Context context, String targetTemplate) {
        // By default, the mode is MODE_CLIENT_DISPATCHER
        super(context, targetTemplate);
    }

    @Override
    protected Reference getTargetRef(Request request, Response response) {
        Reference ref = request.getResourceRef();
        ref.setHostDomain("192.168.100.1");
        ref.setHostPort(8080);
        //   <-- here is missing something
        return ref;
    }
}


Thank you for helping me.


ab
-- 
View this message in context: 
http://n2.nabble.com/How-to-write-an-Universal-redirector-tp4620578p4620578.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2451106

Reply via email to