@Override public String redirectURL() { if (resourcePath != null) { return resourcePath.toString(); } else { return redirectURI.toString(); } }
@Override public Map<String, ?> properties(RequestContext ctx) throws Exception { Map<String, String> result = new HashMap<>(); result.put("resourcepath", subscription.resourcePath().toString()); return result; }
public DefaultResourceRef(ResourcePath resourcePath) throws URISyntaxException { this.resourcePath = resourcePath; uri(new URI(resourcePath.toString())); }
@Override public Map<String, ?> properties(RequestContext ctx) throws Exception { Map<String, String> result = new HashMap<>(); result.put("type", "http"); result.put("path", this.subscription.resourcePath().toString()); result.put("destination", this.subscription.destination().toString()); return result; }
String resPathString = resourcePath.toString();
@Override protected String getParentUri() { return path().parent().toString(); }
@Override protected String getParentUri() { return path().parent().toString(); }
@Override protected String getParentUri() { return path().parent().toString(); }
public DefaultResourceRef(ResourceRef parent, String id) throws URISyntaxException { this.resourcePath = new ResourcePath(parent.uri() + "/" + id); this.parent = parent; uri(new URI(resourcePath.toString())); }
public synchronized void updateApplication(InternalApplication application) throws IOException { ObjectNode tree = read(); tree.put("name", application.name()); ResourcePath htmlAppPath = application.htmlApplicationResourcePath(); if (htmlAppPath != null) { if (htmlAppPath.head().name().equals(application.id())) { htmlAppPath = htmlAppPath.subPath(); } tree.put("html-app", htmlAppPath.toString()); } tree.put("visible", application.visible()); String versioningResourceId = application.versionResourceId(); if (versioningResourceId != null) { tree.put("version-resource-id", versioningResourceId); } write(tree); }
request.resourcePath().toString(), filename, contentType, "binary", Charset.forName("utf-8"), clen);
/** * Encode (for some cheap value of 'encode') a resulting resource into a ResourceState. * * @param ctx * @param response The response to encode. * @throws Exception */ protected void encode(ChannelHandlerContext ctx, ResourceResponse response) { final ClientResourceResponse.ResponseType responseType = ClientResourceResponse.ResponseType.OK; if (response.resource() == null) { ctx.writeAndFlush(new ClientResourceResponseImpl(response.inReplyTo(), responseType, response.inReplyTo().resourcePath().toString(), null)); ctx.fireUserEventTriggered(new RequestCompleteEvent(response.requestId())); return; } ctx.writeAndFlush(new ClientResourceResponseImpl(response.inReplyTo(), responseType, response.inReplyTo().resourcePath().toString(), response.state())); ctx.fireUserEventTriggered(new RequestCompleteEvent(response.requestId())); }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof ResourceResponse) { ResourceResponse response = (ResourceResponse) msg; if (msg instanceof ResourceErrorResponse) { ClientResourceResponse.ResponseType responseType = decodeResponseType(((ResourceErrorResponse) msg).errorType()); ctx.writeAndFlush(new ClientResourceResponseImpl(response.inReplyTo(), responseType, response.inReplyTo().resourcePath().toString(), ((ResourceErrorResponse) msg).state())); } else { encode(ctx, response); } } else { super.write(ctx, msg, promise); } }
String prefix = new ResourcePath(state.uri().toString()).parent().parent().toString() + "/" + refTable.id() + "/"; List<String> currentUris = prefixElements(extractPksFromResults(results, refTable), prefix);
/** * Encode (for some cheap value of 'encode') a resulting resource into a ResourceState. * * @param ctx * @param response The response to encode. * @throws Exception */ protected void encode(ChannelHandlerContext ctx, ResourceResponse response, ChannelPromise promise) { final ClientResourceResponse.ResponseType responseType = ClientResourceResponse.ResponseType.OK; if (response.resource() == null) { ctx.writeAndFlush(new ClientResourceResponseImpl(response.inReplyTo(), responseType, response.inReplyTo().resourcePath().toString(), null)); ctx.fireUserEventTriggered(new RequestCompleteEvent(response.requestId())); return; } final ResourceStateEncoder encoder = new ResourceStateEncoder(); RootEncodingDriver driver = new RootEncodingDriver(response.inReplyTo().requestContext(), encoder, response.resource(), () -> { ResourceState state = encoder.root(); response.setState(state); ctx.writeAndFlush(response, promise).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE).addListener(ChannelFutureListener.CLOSE_ON_FAILURE); }, t -> handleError(ctx, response.inReplyTo(), t)); try { driver.encode(); } catch (Throwable e) { handleError(ctx, response.inReplyTo(), e); } }
response.headers().add(HttpHeaders.Names.LOCATION, msg.resource().uri().toString()); } else { response.headers().add(HttpHeaders.Names.LOCATION, msg.inReplyTo().resourcePath().toString());