Question

I want to set a restlet client to follow redirects. To do this I need to make a Context, set the Client to use the Context and then run it.

However, to add the parameter:

Parameter param = new Parameter("followRedirects", "true");

To the Context, I need to make a Series<Parameter>. This causes a problem, as the Series class is absract and to subclass it I need to implement what looks like a copy constructor, and an addEntry method.

How do you implement the following abstract method? Since its got to return a Series<Parameter> you have to make a Series to return, but I haven't got a working Series class yet to make one to return!

public Series<Parameter> createSeries(List<Parameter> delegate) {
}

Thanks!

Was it helpful?

Solution

Call:

Series<Parameter> params = myNewContext.getParameters();
params.add("followRedirects", "true);

If you look at the source code for Context.java, you'll see that its parameters are initialized to an empty Form (a concrete subclass of Series). This is done as a convenience so you don't have to worry about creating the Series.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top