01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 2007.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.http.webclient;
07:
08: import java.io.IOException;
09:
10: import javax.servlet.jsp.JspException;
11: import javax.servlet.jsp.JspWriter;
12: import javax.servlet.jsp.tagext.TagSupport;
13:
14: import info.aduna.net.http.HttpClientUtil;
15:
16: import org.openrdf.http.protocol.Protocol;
17: import org.openrdf.model.Value;
18:
19: public class ParameterValueTag extends TagSupport {
20:
21: private static final long serialVersionUID = -1315546760001420840L;
22:
23: private String name;
24:
25: private Value value;
26:
27: @Override
28: public int doStartTag() throws JspException {
29: // write the result to the page
30: JspWriter out = pageContext.getOut();
31: try {
32: String encValue = Protocol.encodeValue(value);
33: out.write(HttpClientUtil.encodeParameter(name, encValue));
34: } catch (IOException e) {
35: throw new JspException(e);
36: }
37: return SKIP_BODY;
38: }
39:
40: public void setName(String name) {
41: this .name = name;
42: }
43:
44: public void setValue(Value value) {
45: this.value = value;
46: }
47: }
|