public List<Job> jobs(Printer printer) throws ClientProtocolException,
			IOException, JSONException {
		HttpPost post = new HttpPost(GCP_BASE_URL + "/" + GCP_CMD_JOBS);
		addGcpHeaders(post);

		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
		if (printer != null) {
			nvps.add(new BasicNameValuePair("printerid", printer.getId()));
		}
		nvps.add(new BasicNameValuePair("output", "json"));

		post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));

		HttpResponse response = httpclient.execute(post);
		int code = response.getStatusLine().getStatusCode();

		String responseStr = EntityUtils.toString(response.getEntity());
System.out.println(responseStr);
		if (code == HttpStatus.SC_OK) {
			JSONObject json = new JSONObject(responseStr);
			if (json.has("message")) {
				lastResponse.setMessage(json.getString("message"));
			}

			if (json.getBoolean("success")) {
				List<Job> list = new ArrayList<Job>();

				for (int i = 0; i < json.getJSONArray("jobs").length(); i++) {
					JSONObject obj = json.getJSONArray("jobs").getJSONObject(i);
					Job job = new Job();
					job.setId(obj.getString("id"));
					job.setPrinterId(obj.getString("printerid"));
					job.setTitle(obj.getString("title"));
					job.setContentType(obj.getString("contentType"));
					job.setFileUrl(obj.getString("fileUrl"));
					job.setTicketUrl(obj.getString("ticketUrl"));
					job.setStatus(obj.getString("status"));
					job.setErrorCode(obj.getString("errorCode"));
					job.setMessage(obj.getString("message"));

					List<String> tags = new ArrayList<String>();
					for (int j = 0; j < obj.getJSONArray("tags").length(); j++) {
						tags.add(obj.getJSONArray("tags").getString(j));
					}
					job.setTags(tags);

					job.setCreateTime(new Date(Long.parseLong(obj
							.getString("createTime"))));
					job.setUpdateTime(new Date(Long.parseLong(obj
							.getString("updateTime"))));
					list.add(job);
				}

				lastResponse.setSuccess(true);
				return list;
			} else {
				lastResponse.setSuccess(false);
				return null;
			}
		} else {
			lastResponse.setSuccess(false);
			lastResponse.setMessage("HTTP result code: " + code);
			return null;
		}
	}