if (request.getMethod().equals("GET")) throw new ProcessingException(Messages.MESSAGES.getRequestCannotHaveBody());
throw new RuntimeException(Messages.MESSAGES.mustSetLinkHeaderParam(method.getClass().getName(), method.getName())); throw new RuntimeException(Messages.MESSAGES.canOnlySetOneLinkHeaderParam(method.getClass().getName(), method.getName()));
@Override protected ClientInvocation apply(ClientInvocation invocation, Object object) { Form form = null; Object entity = invocation.getEntity(); if (entity != null) { if (entity instanceof Form) { form = (Form) entity; } else { throw new RuntimeException(Messages.MESSAGES.cannotSetFormParameter()); } } else { form = new Form(); invocation.setEntity(Entity.form(form)); } String value = invocation.getClientConfiguration().toString(object); form.param(paramName, value); return invocation; }
} catch (IOException e) throw new ProcessingException(Messages.MESSAGES.unableToInvokeRequest(), e);
public String toString() { return Messages.MESSAGES.clientProxyFor(clazz.getName()); } }
/** * Log that the file did not get deleted but prevent the request from failing by eating the exception. * Register the file to be deleted on exit, so it will get deleted eventually. * * @param tempRequestFile - * @param ex - a null may be passed in which case this param gets ignored. */ private void handleFileNotDeletedError(File tempRequestFile, Exception ex) { LogMessages.LOGGER.warn(Messages.MESSAGES.couldNotDeleteFile(tempRequestFile.getAbsolutePath()), ex); tempRequestFile.deleteOnExit(); }
private URL getURL(final Method method, final LinkHeaderParam link, ClientContext context) { URI uri = getURI(method, link, context); try { return uri == null ? null : uri.toURL(); } catch (MalformedURLException e) { throw new RuntimeException(Messages.MESSAGES.couldNotCreateURL(uri.toASCIIString(), method.getClass().getName(), method.getName()), e); } } }
public void abortIfClosed() { if (isClosed()) throw new IllegalStateException(Messages.MESSAGES.clientIsClosed()); }
public Object invoke(Object o, Method method, Object[] args) throws Throwable { // equals and hashCode were added for cases where the proxy is added to // collections. The Spring transaction management, for example, adds // transactional Resources to a Collection, and it calls equals and // hashCode. if (method.getName().equals("equals")) { return this.equals(o); } else if (method.getName().equals("hashCode")) { return this.hashCode(); } EntityExtractor entityExtractor = methodMap.get(method); if (entityExtractor == null) throw new RuntimeException(Messages.MESSAGES.couldNotProcessMethod(method)); return entityExtractor.extractEntity(context, entityExtractor, args); }
throw new RuntimeException(Messages.MESSAGES.couldNotFindMethod(method));
throw new ProcessingException(Messages.MESSAGES.unableToInvokeRequest(), e);
public String toString() { return Messages.MESSAGES.clientProxyFor(clazz.getName()); } }
/** * Log that the file did not get deleted but prevent the request from failing by eating the exception. * Register the file to be deleted on exit, so it will get deleted eventually. * * @param tempRequestFile - * @param ex - a null may be passed in which case this param gets ignored. */ private void handleFileNotDeletedError(File tempRequestFile, Exception ex) { LogMessages.LOGGER.warn(Messages.MESSAGES.couldNotDeleteFile(tempRequestFile.getAbsolutePath()), ex); tempRequestFile.deleteOnExit(); }
private URL getURL(final Method method, final LinkHeaderParam link, ClientContext context) { URI uri = getURI(method, link, context); try { return uri == null ? null : uri.toURL(); } catch (MalformedURLException e) { throw new RuntimeException(Messages.MESSAGES.couldNotCreateURL(uri.toASCIIString(), method.getClass().getName(), method.getName()), e); } } }
public void abortIfClosed() { if (isClosed()) throw new IllegalStateException(Messages.MESSAGES.clientIsClosed()); }
public Object invoke(Object o, Method method, Object[] args) throws Throwable { // equals and hashCode were added for cases where the proxy is added to // collections. The Spring transaction management, for example, adds // transactional Resources to a Collection, and it calls equals and // hashCode. if (method.getName().equals("equals")) { return this.equals(o); } else if (method.getName().equals("hashCode")) { return this.hashCode(); } EntityExtractor entityExtractor = methodMap.get(method); if (entityExtractor == null) throw new RuntimeException(Messages.MESSAGES.couldNotProcessMethod(method)); return entityExtractor.extractEntity(context, entityExtractor, args); }
throw new RuntimeException(Messages.MESSAGES.couldNotFindMethod(method));
throw new ProcessingException(Messages.MESSAGES.getRequestCannotHaveBody());
public ClientResponse invoke(ClientInvocation request) { final HttpURLConnection connection; int status; try { connection = this.createConnection(request); this.executeRequest(request, connection); status = connection.getResponseCode(); } catch (IOException ex) { throw new ProcessingException(Messages.MESSAGES.unableToInvokeRequest(), ex); } ClientResponse response = new JavaNetConnectionClientResponse(request, connection); response.setStatus(status); response.setHeaders(this.getHeaders(connection)); return response; }
throw new RuntimeException(Messages.MESSAGES.mustSetLinkHeaderParam(method.getClass().getName(), method.getName())); throw new RuntimeException(Messages.MESSAGES.canOnlySetOneLinkHeaderParam(method.getClass().getName(), method.getName()));