/** * Indicates if a content is available and can be sent. Several conditions * must be met: the method must allow the sending of content, the content * must exists and have some available data. * * @return True if a content is available and can be sent. */ @Override public boolean isEntityAvailable() { return getWrappedRequest().isEntityAvailable(); }
/** * Handles a POST call by invoking the * {@link #acceptRepresentation(Representation)} method. It also logs a * trace if there is no entity posted. */ @Override public void handlePost() { if (!getRequest().isEntityAvailable()) { getLogger() .fine( "POST request received without any entity. Continuing processing."); } post(getRequest().getEntity()); }
@Override public HttpClientCall create(Request request) { HttpClientCall result = null; try { result = new Hc4MethodCall(this, request.getMethod().toString(), request.getResourceRef().toString(), request .isEntityAvailable()); } catch (IOException ioe) { getLogger().log(Level.WARNING, "Unable to create the HTTP client call", ioe); } return result; }
/** * Creates a low-level HTTP client call from a high-level uniform call. * * @param request * The high-level request. * @return A low-level HTTP client call. */ @Override public HttpClientCall create(Request request) { HttpClientCall result = null; try { result = new HttpMethodCall(this, request.getMethod().toString(), request.getResourceRef().toString(), request .isEntityAvailable()); } catch (IOException ioe) { getLogger().log(Level.WARNING, "Unable to create the HTTP client call", ioe); } return result; }
@Override public Object upload(Context context, Request request, Response response, List<FileItem> files) throws ResourceException { // NEXUS-4151: Do not accept upload/deploy requests with media type (Content-Type) of // "application/x-www-form-urlencoded", since ad 1, it's wrong, ad 2, we do know // Jetty's Request object "eats" up it's body to parse request parameters, invoked // way earlier in security filters if (request.isEntityAvailable()) { MediaType mt = request.getEntity().getMediaType(); if (mt != null && MediaType.APPLICATION_WWW_FORM.isCompatible(mt)) { throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Content-type of \"" + mt.toString() + "\" is not acceptable for uploads!"); } } try { final ResourceStoreRequest req = getResourceStoreRequest(request); for (FileItem fileItem : files) { getResourceStore(request).storeItem(req, fileItem.getInputStream(), null); } } catch (Exception t) { handleException(request, response, t); } return null; }
if ( request.isEntityAvailable() )