ReferenceList references = getVariantsReferences(true); if (!references.isEmpty()) { contextRequest.setResourceRef(references.get(0)); getDispatcher().handle(contextRequest, contextResponse); } else { contextRequest.setResourceRef(this.targetUri); getDispatcher().handle(contextRequest, contextResponse); }
contextRequest.setResourceRef(this.targetUri); getDispatcher().handle(contextRequest, contextResponse);
	public Result put(Representation variant)	{		Status status;		// We allow the transfer of the PUT calls only if the readOnly flag is not set		if (!getDirectory().isModifiable())		{			status = Status.CLIENT_ERROR_FORBIDDEN;		}		else		{			Request contextRequest = new Request(Method.PUT, this.targetUri);			Response contextResponse = new Response(contextRequest);			contextRequest.setEntity(variant);			if (targetDirectory)			{				contextRequest.setResourceRef(this.targetUri);				getDispatcher().handle(contextRequest, contextResponse);			}			else			{				//Try to get the unique representation of the resource, if any				ReferenceList references = getVariantsReferences(true);				if (!references.isEmpty())				{					contextRequest.setResourceRef(references.get(0));					getDispatcher().handle(contextRequest, contextResponse);				}				else				{					contextRequest.setResourceRef(this.targetUri);					getDispatcher().handle(contextRequest, contextResponse);				}			}			status = contextResponse.getStatus();		}		return new Result(status);	}