public TaskHandle add(TaskOptions taskOptions) {
return add(null, taskOptions);
}
public TaskHandle add(Transaction transaction, TaskOptions taskOptions) {
TaskOptionsAccessor accessor = new TaskOptionsAccessor(taskOptions);
try {
PostMethodWebRequest request = new PostMethodWebRequest(accessor.getUrl(), accessor.getPayload(), null);
request.setHeaderField(GTaskBinding.GAE_QUEUE_NAME, name);
request.setHeaderField(GTaskBinding.GAE_RETRY_COUNT, "0");
if (accessor.getTaskName() != null) {
request.setHeaderField(GTaskBinding.GAE_TASK_NAME, accessor.getTaskName());
}
for (Map.Entry<String, List<String>> entry : accessor.getHeaders().entrySet()) {
request.setHeaderField(entry.getKey(), entry.getValue().get(0));
}
servletUnitClient.getResponse(request);
} catch (Exception e) {
Assert.fail(e.getMessage());