public static Exception getCause(BuiltResponse resp) { if (resp == null || resp.getStatus() != Status.EXPECTATION_FAILED.getStatusCode()) return null; String exceptionClass = resp.getHeaderString(EXCEPTION_HEADER); if (!StringUtils.isBlank(exceptionClass)) { String body = resp.readEntity(String.class); resp.close(); try { ByteArrayInputStream bais = new ByteArrayInputStream( Base64.decode(body.getBytes(MotanConstants.DEFAULT_CHARACTER))); ObjectInputStream ois = new ObjectInputStream(bais); return (Exception) ois.readObject(); } catch (Exception e) { LoggerUtil.error("deserialize " + exceptionClass + " error", e); } } return null; }
@Override protected void processMethod(ResourceFactory rf, String base, ResourceLocator method) ResteasyUriBuilder builder = new ResteasyUriBuilder(); if (base != null) { builder.path(base); builder.path(method.getFullpath()); String fullpath = builder.getPath(); if (fullpath == null) { fullpath = ""; builder = new ResteasyUriBuilder(); if (base != null) { builder.path(base); builder.path(method.getResourceClass().getPath()); String classExpression = builder.getPath(); if (classExpression == null) { classExpression = "";
private LinkHeaders getLinkHeaders() { LinkHeaders linkHeaders = new LinkHeaders(); linkHeaders.addLinkObjects(metadata, getHeaderValueProcessor()); return linkHeaders; }
private MultivaluedMap<String, String> getEncodedPathParameters() { if (encodedPathParameters == null) { encodedPathParameters = new MultivaluedMapImpl<String, String>(); } return encodedPathParameters; }
public static <K, V> MultivaluedTreeMap<K, V> clone(MultivaluedMap<K, V> src) { MultivaluedTreeMap<K, V> clone = new MultivaluedTreeMap<K, V>(); copy(src, clone); return clone; }
@Override public MultivaluedMap<String, String> getMutableHeaders() { return httpHeaders.getMutableHeaders(); }
private List<V> getOrCreate(K key) { List<V> list = this.get(key); if (list == null) { list = createValueList(key); this.put(key, list); } return list; }
public BuiltResponse(final int status, final String reason, final Headers<Object> metadata, final Object entity, final Annotation[] entityAnnotations) { setEntity(entity); this.status = status; this.metadata = metadata; this.annotations = entityAnnotations; if (reason != null) { this.reason = reason; } }
@Override public boolean bufferEntity() { abortIfClosed(); // no-op return false; }
@Override public Link getLink(String relation) { return getLinkHeaders().getLinkByRelationship(relation); }
@Override public <T> T readEntity(Class<T> type, Annotation[] annotations) { return readEntity(type, null, annotations); }
@Override public Response.StatusType getStatusInfo() { return jaxrsResponse.getStatusInfo(); }
@Override public Link getLink(String relation) { return jaxrsResponse.getLink(relation); }
@Override public void addAll(K key, List<V> valueList) { for (V value : valueList) { add(key, value); } }
public String getPath(boolean decode) { if (decode) return getPath(); return encodedPath; }
public Map<String, Cookie> getMutableCookies() { mergeCookies(); return cookies; }
public List<PathSegment> getPathSegments(boolean decode) { if (decode) return getPathSegments(); return encodedPathSegments; }
@Override protected void processMethod(ResourceFactory rf, String base, ResourceLocator method) ResteasyUriBuilder builder = new ResteasyUriBuilder(); if (base != null) { builder.path(base); builder.path(method.getFullpath()); String fullpath = builder.getPath(); if (fullpath == null) { fullpath = ""; builder = new ResteasyUriBuilder(); if (base != null) { builder.path(base); builder.path(method.getResourceClass().getPath()); String classExpression = builder.getPath(); if (classExpression == null) { classExpression = "";
@Override public boolean hasLink(String relation) { return getLinkHeaders().getLinkByRelationship(relation) != null; }