如何使用Series类为Restlet设置属性?
我想设置一个 Restlet 客户端来跟踪重定向。为此,我需要创建一个上下文,将客户端设置为使用该上下文,然后运行它。
但是,要添加参数:
Parameter param = new Parameter("followRedirects", "true");
到上下文,我需要创建一个 Series
如何实现以下抽象方法?因为它必须返回一个 Series
public Series<Parameter> createSeries(List<Parameter> delegate) {
}
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
调用:
如果您查看 Context.java 的源代码,您将看到它的参数被初始化为一个空 Form(Series 的具体子类)。这样做是为了方便,因此您不必担心创建系列。
Call:
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.