01: /*
02: * Copyright 2005-2007 Noelios Consulting.
03: *
04: * The contents of this file are subject to the terms of the Common Development
05: * and Distribution License (the "License"). You may not use this file except in
06: * compliance with the License.
07: *
08: * You can obtain a copy of the license at
09: * http://www.opensource.org/licenses/cddl1.txt See the License for the specific
10: * language governing permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL HEADER in each file and
13: * include the License file at http://www.opensource.org/licenses/cddl1.txt If
14: * applicable, add the following below this CDDL HEADER, with the fields
15: * enclosed by brackets "[]" replaced with your own identifying information:
16: * Portions Copyright [yyyy] [name of copyright owner]
17: */
18:
19: package com.noelios.restlet;
20:
21: import java.util.logging.Logger;
22:
23: import org.restlet.Client;
24: import org.restlet.Context;
25: import org.restlet.data.Form;
26: import org.restlet.data.Parameter;
27: import org.restlet.util.Series;
28:
29: /**
30: * Client connector helper.
31: *
32: * @author Jerome Louvel (contact@noelios.com)
33: */
34: public class ClientHelper extends ConnectorHelper {
35: /** The client to help. */
36: private Client client;
37:
38: /**
39: * Constructor.
40: *
41: * @param client
42: * The client to help.
43: */
44: public ClientHelper(Client client) {
45: this .client = client;
46: }
47:
48: /**
49: * Returns the client to help.
50: *
51: * @return The client to help.
52: */
53: public Client getClient() {
54: return this .client;
55: }
56:
57: /**
58: * Returns the server parameters.
59: *
60: * @return The server parameters.
61: */
62: public Series<Parameter> getParameters() {
63: Series<Parameter> result = (getClient() != null) ? getClient()
64: .getContext().getParameters() : null;
65: if (result == null)
66: result = new Form();
67: return result;
68: }
69:
70: /**
71: * Returns the server logger.
72: *
73: * @return The server logger.
74: */
75: public Logger getLogger() {
76: return getClient().getLogger();
77: }
78:
79: /**
80: * Returns the server context.
81: *
82: * @return The server context.
83: */
84: public Context getContext() {
85: return getClient().getContext();
86: }
87:
88: }
|