[GitHub] incubator-guacamole-client pull request #16: GUACAMOLE-44: Implement uploads...
Github user asfgit closed the pull request at: https://github.com/apache/incubator-guacamole-client/pull/16 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [email protected] or file a JIRA ticket with INFRA. ---
[GitHub] incubator-guacamole-client pull request #16: GUACAMOLE-44: Implement uploads...
Github user jmuehlner commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/16#discussion_r65933244
--- Diff:
guacamole/src/main/java/org/apache/guacamole/tunnel/InterceptedStream.java ---
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.tunnel;
+
+import java.io.Closeable;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.protocol.GuacamoleStatus;
+
+/**
+ * A simple pairing of the index of an intercepted Guacamole stream with
the
+ * stream-type object which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ *
+ * @author Michael Jumper
+ * @param
+ * The type of object which will produce or consume the data sent over
the
+ * intercepted Guacamole stream. Usually, this will be either
InputStream
+ * or OutputStream.
+ */
+public class InterceptedStream {
+
+/**
+ * The index of the Guacamole stream being intercepted.
+ */
+private final String index;
+
+/**
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+private final T stream;
+
+/**
+ * The exception which prevented the stream from completing
successfully,
+ * if any. If the stream completed successfully, or has not
encountered any
+ * exception yet, this will be null.
+ */
+private GuacamoleException streamError = null;
+
+/**
+ * Creates a new InterceptedStream which associated the given Guacamole
+ * stream index with the given stream object.
+ *
+ * @param index
+ * The index of the Guacamole stream being intercepted.
+ *
+ * @param stream
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+public InterceptedStream(String index, T stream) {
+this.index = index;
+this.stream = stream;
+}
+
+/**
+ * Returns the index of the Guacamole stream being intercepted.
+ *
+ * @return
+ * The index of the Guacamole stream being intercepted.
+ */
+public String getIndex() {
+return index;
+}
+
+/**
+ * Returns the stream which will produce or consume the data sent over
the
+ * intercepted Guacamole stream.
+ *
+ * @return
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+public T getStream() {
+return stream;
+}
+
+/**
+ * Reports that this InterceptedStream did not complete successfully
due to
+ * the given GuacamoleException, which could not be thrown at the time
due
+ * to asynchronous handling of the stream contents.
+ *
+ * @param streamError
+ * The exception which prevented the stream from completing
+ * successfully.
+ */
+public void setStreamError(GuacamoleException streamError) {
+this.streamError = streamError;
+}
+
+/**
+ * Reports that this InterceptedStream did not complete successfully
due to
+ * an error described by the given status code and human-readable
message.
+ * The error reported by this call can later be retrieved as a
+ * GuacamoleStreamException by calling getStreamError().
--- End diff --
Ok
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-guacamole-client pull request #16: GUACAMOLE-44: Implement uploads...
Github user mike-jumper commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/16#discussion_r65933168
--- Diff:
guacamole/src/main/java/org/apache/guacamole/tunnel/InterceptedStream.java ---
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.tunnel;
+
+import java.io.Closeable;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.protocol.GuacamoleStatus;
+
+/**
+ * A simple pairing of the index of an intercepted Guacamole stream with
the
+ * stream-type object which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ *
+ * @author Michael Jumper
+ * @param
+ * The type of object which will produce or consume the data sent over
the
+ * intercepted Guacamole stream. Usually, this will be either
InputStream
+ * or OutputStream.
+ */
+public class InterceptedStream {
+
+/**
+ * The index of the Guacamole stream being intercepted.
+ */
+private final String index;
+
+/**
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+private final T stream;
+
+/**
+ * The exception which prevented the stream from completing
successfully,
+ * if any. If the stream completed successfully, or has not
encountered any
+ * exception yet, this will be null.
+ */
+private GuacamoleException streamError = null;
+
+/**
+ * Creates a new InterceptedStream which associated the given Guacamole
+ * stream index with the given stream object.
+ *
+ * @param index
+ * The index of the Guacamole stream being intercepted.
+ *
+ * @param stream
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+public InterceptedStream(String index, T stream) {
+this.index = index;
+this.stream = stream;
+}
+
+/**
+ * Returns the index of the Guacamole stream being intercepted.
+ *
+ * @return
+ * The index of the Guacamole stream being intercepted.
+ */
+public String getIndex() {
+return index;
+}
+
+/**
+ * Returns the stream which will produce or consume the data sent over
the
+ * intercepted Guacamole stream.
+ *
+ * @return
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+public T getStream() {
+return stream;
+}
+
+/**
+ * Reports that this InterceptedStream did not complete successfully
due to
+ * the given GuacamoleException, which could not be thrown at the time
due
+ * to asynchronous handling of the stream contents.
+ *
+ * @param streamError
+ * The exception which prevented the stream from completing
+ * successfully.
+ */
+public void setStreamError(GuacamoleException streamError) {
+this.streamError = streamError;
+}
+
+/**
+ * Reports that this InterceptedStream did not complete successfully
due to
+ * an error described by the given status code and human-readable
message.
+ * The error reported by this call can later be retrieved as a
+ * GuacamoleStreamException by calling getStreamError().
--- End diff --
Since `GuacamoleStreamException` represents a received "ack" instruction,
it can really only apply to streams where we are acting as the source of data
and the server is sending acknowledgements ("ack" is only sent in response to
"blob" or the instructions which start a stream). In practical terms of this
change, if we changed `GuacamoleException` to
[GitHub] incubator-guacamole-client pull request #16: GUACAMOLE-44: Implement uploads...
Github user jmuehlner commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/16#discussion_r65931141
--- Diff:
guacamole/src/main/java/org/apache/guacamole/tunnel/InterceptedStream.java ---
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.tunnel;
+
+import java.io.Closeable;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.protocol.GuacamoleStatus;
+
+/**
+ * A simple pairing of the index of an intercepted Guacamole stream with
the
+ * stream-type object which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ *
+ * @author Michael Jumper
+ * @param
+ * The type of object which will produce or consume the data sent over
the
+ * intercepted Guacamole stream. Usually, this will be either
InputStream
+ * or OutputStream.
+ */
+public class InterceptedStream {
+
+/**
+ * The index of the Guacamole stream being intercepted.
+ */
+private final String index;
+
+/**
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+private final T stream;
+
+/**
+ * The exception which prevented the stream from completing
successfully,
+ * if any. If the stream completed successfully, or has not
encountered any
+ * exception yet, this will be null.
+ */
+private GuacamoleException streamError = null;
+
+/**
+ * Creates a new InterceptedStream which associated the given Guacamole
+ * stream index with the given stream object.
+ *
+ * @param index
+ * The index of the Guacamole stream being intercepted.
+ *
+ * @param stream
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+public InterceptedStream(String index, T stream) {
+this.index = index;
+this.stream = stream;
+}
+
+/**
+ * Returns the index of the Guacamole stream being intercepted.
+ *
+ * @return
+ * The index of the Guacamole stream being intercepted.
+ */
+public String getIndex() {
+return index;
+}
+
+/**
+ * Returns the stream which will produce or consume the data sent over
the
+ * intercepted Guacamole stream.
+ *
+ * @return
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+public T getStream() {
+return stream;
+}
+
+/**
+ * Reports that this InterceptedStream did not complete successfully
due to
+ * the given GuacamoleException, which could not be thrown at the time
due
+ * to asynchronous handling of the stream contents.
+ *
+ * @param streamError
+ * The exception which prevented the stream from completing
+ * successfully.
+ */
+public void setStreamError(GuacamoleException streamError) {
+this.streamError = streamError;
+}
+
+/**
+ * Reports that this InterceptedStream did not complete successfully
due to
+ * an error described by the given status code and human-readable
message.
+ * The error reported by this call can later be retrieved as a
+ * GuacamoleStreamException by calling getStreamError().
--- End diff --
Why not make the returned and stored type that then?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticke
[GitHub] incubator-guacamole-client pull request #16: GUACAMOLE-44: Implement uploads...
Github user mike-jumper commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/16#discussion_r65928947
--- Diff:
guacamole/src/main/java/org/apache/guacamole/rest/tunnel/TunnelRESTService.java
---
@@ -143,4 +150,53 @@ public void write(OutputStream output) throws
IOException {
}
+/**
+ * Intercepts a specific stream, sending the contents of the given
+ * InputStream over that stream as "blob" instructions.
+ *
+ * @param authToken
+ * The authentication token that is used to authenticate the user
+ * performing the operation.
+ *
+ * @param tunnelUUID
+ * The UUID of the tunnel containing the stream being intercepted.
+ *
+ * @param streamIndex
+ * The index of the stream to intercept.
+ *
+ * @param filename
+ * The filename to use for the sake of identifying the data being
sent.
+ *
+ * @param data
+ * An InputStream containing the data to be sent over the
intercepted
+ * stream.
+ *
+ * @throws GuacamoleException
+ * If the session associated with the given auth
--- End diff --
True. Will fix.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-guacamole-client pull request #16: GUACAMOLE-44: Implement uploads...
Github user mike-jumper commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/16#discussion_r65929193
--- Diff:
guacamole/src/main/java/org/apache/guacamole/tunnel/InterceptedStream.java ---
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.tunnel;
+
+import java.io.Closeable;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.protocol.GuacamoleStatus;
+
+/**
+ * A simple pairing of the index of an intercepted Guacamole stream with
the
+ * stream-type object which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ *
+ * @author Michael Jumper
+ * @param
+ * The type of object which will produce or consume the data sent over
the
+ * intercepted Guacamole stream. Usually, this will be either
InputStream
+ * or OutputStream.
+ */
+public class InterceptedStream {
+
+/**
+ * The index of the Guacamole stream being intercepted.
+ */
+private final String index;
+
+/**
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+private final T stream;
+
+/**
+ * The exception which prevented the stream from completing
successfully,
+ * if any. If the stream completed successfully, or has not
encountered any
+ * exception yet, this will be null.
+ */
+private GuacamoleException streamError = null;
+
+/**
+ * Creates a new InterceptedStream which associated the given Guacamole
+ * stream index with the given stream object.
+ *
+ * @param index
+ * The index of the Guacamole stream being intercepted.
+ *
+ * @param stream
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+public InterceptedStream(String index, T stream) {
+this.index = index;
+this.stream = stream;
+}
+
+/**
+ * Returns the index of the Guacamole stream being intercepted.
+ *
+ * @return
+ * The index of the Guacamole stream being intercepted.
+ */
+public String getIndex() {
+return index;
+}
+
+/**
+ * Returns the stream which will produce or consume the data sent over
the
+ * intercepted Guacamole stream.
+ *
+ * @return
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+public T getStream() {
+return stream;
+}
+
+/**
+ * Reports that this InterceptedStream did not complete successfully
due to
+ * the given GuacamoleException, which could not be thrown at the time
due
+ * to asynchronous handling of the stream contents.
+ *
+ * @param streamError
+ * The exception which prevented the stream from completing
+ * successfully.
+ */
+public void setStreamError(GuacamoleException streamError) {
+this.streamError = streamError;
+}
+
+/**
+ * Reports that this InterceptedStream did not complete successfully
due to
+ * an error described by the given status code and human-readable
message.
+ * The error reported by this call can later be retrieved as a
+ * GuacamoleStreamException by calling getStreamError().
--- End diff --
It's just a `GuacamoleException`, but the subclass of `GuacamoleException`
that will be set due to an invocation of this function will be
`GuacamoleStreamException`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the
[GitHub] incubator-guacamole-client pull request #16: GUACAMOLE-44: Implement uploads...
Github user jmuehlner commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/16#discussion_r65923500
--- Diff:
guacamole/src/main/java/org/apache/guacamole/rest/tunnel/TunnelRESTService.java
---
@@ -143,4 +150,53 @@ public void write(OutputStream output) throws
IOException {
}
+/**
+ * Intercepts a specific stream, sending the contents of the given
+ * InputStream over that stream as "blob" instructions.
+ *
+ * @param authToken
+ * The authentication token that is used to authenticate the user
+ * performing the operation.
+ *
+ * @param tunnelUUID
+ * The UUID of the tunnel containing the stream being intercepted.
+ *
+ * @param streamIndex
+ * The index of the stream to intercept.
+ *
+ * @param filename
+ * The filename to use for the sake of identifying the data being
sent.
+ *
+ * @param data
+ * An InputStream containing the data to be sent over the
intercepted
+ * stream.
+ *
+ * @throws GuacamoleException
+ * If the session associated with the given auth
--- End diff --
Not a big deal, but this is a strange place to wrap this comment.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-guacamole-client pull request #16: GUACAMOLE-44: Implement uploads...
Github user jmuehlner commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/16#discussion_r65923641
--- Diff:
guacamole/src/main/java/org/apache/guacamole/tunnel/GuacamoleStreamException.java
---
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.tunnel;
+
+import org.apache.guacamole.GuacamoleServerException;
+import org.apache.guacamole.protocol.GuacamoleStatus;
+
+/**
+ * A generic exception thrown when an intercepted Guacamole stream has
closed
+ * with an error condition. Guacamole streams report errors using the "ack"
+ * instruction, which provides a status code and human-readable message.
+ *
+ * @author Michael Jumper
+ */
+public class GuacamoleStreamException extends GuacamoleServerException {
+
+/**
+ * The error condition reported by the intercepted Guacamole stream.
+ */
+private final GuacamoleStatus status;
+
+/**
+ * Creates a new GuacamoleStreamException representing an error
returned by
+ * an intercepted stream.
+ *
+ * @param status
+ * The status code of the error condition reported by the
intercepted
+ * Guacamole stream.
+ *
+ * @param message
+ * The human readable description of the error that occurred, as
--- End diff --
"as as"
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-guacamole-client pull request #16: GUACAMOLE-44: Implement uploads...
Github user jmuehlner commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/16#discussion_r6592
--- Diff:
guacamole/src/main/java/org/apache/guacamole/tunnel/InterceptedStream.java ---
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.tunnel;
+
+import java.io.Closeable;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.protocol.GuacamoleStatus;
+
+/**
+ * A simple pairing of the index of an intercepted Guacamole stream with
the
+ * stream-type object which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ *
+ * @author Michael Jumper
+ * @param
+ * The type of object which will produce or consume the data sent over
the
+ * intercepted Guacamole stream. Usually, this will be either
InputStream
+ * or OutputStream.
+ */
+public class InterceptedStream {
+
+/**
+ * The index of the Guacamole stream being intercepted.
+ */
+private final String index;
+
+/**
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+private final T stream;
+
+/**
+ * The exception which prevented the stream from completing
successfully,
+ * if any. If the stream completed successfully, or has not
encountered any
+ * exception yet, this will be null.
+ */
+private GuacamoleException streamError = null;
+
+/**
+ * Creates a new InterceptedStream which associated the given Guacamole
+ * stream index with the given stream object.
+ *
+ * @param index
+ * The index of the Guacamole stream being intercepted.
+ *
+ * @param stream
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+public InterceptedStream(String index, T stream) {
+this.index = index;
+this.stream = stream;
+}
+
+/**
+ * Returns the index of the Guacamole stream being intercepted.
+ *
+ * @return
+ * The index of the Guacamole stream being intercepted.
+ */
+public String getIndex() {
+return index;
+}
+
+/**
+ * Returns the stream which will produce or consume the data sent over
the
+ * intercepted Guacamole stream.
+ *
+ * @return
+ * The stream which will produce or consume the data sent over the
+ * intercepted Guacamole stream.
+ */
+public T getStream() {
+return stream;
+}
+
+/**
+ * Reports that this InterceptedStream did not complete successfully
due to
+ * the given GuacamoleException, which could not be thrown at the time
due
+ * to asynchronous handling of the stream contents.
+ *
+ * @param streamError
+ * The exception which prevented the stream from completing
+ * successfully.
+ */
+public void setStreamError(GuacamoleException streamError) {
+this.streamError = streamError;
+}
+
+/**
+ * Reports that this InterceptedStream did not complete successfully
due to
+ * an error described by the given status code and human-readable
message.
+ * The error reported by this call can later be retrieved as a
+ * GuacamoleStreamException by calling getStreamError().
--- End diff --
Isn't it just a GuacamoleException here? Or was the type meant to be
"GuacamoleStreamException"?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at in
[GitHub] incubator-guacamole-client pull request #16: GUACAMOLE-44: Implement uploads...
GitHub user mike-jumper opened a pull request: https://github.com/apache/incubator-guacamole-client/pull/16 GUACAMOLE-44: Implement uploads within tunnel REST endpoint Similar to apache/incubator-guacamole-client#13, this change implements the upload half of the tunnel REST endpoint. While it is possible to upload using JavaScript alone via the new `Guacamole.FileWriter` added via apache/incubator-guacamole-client#14, doing so instead via native HTTP is **much faster**. To facilitate translation of Guacamole protocol status codes (received via "ack" instructions along the stream) to HTTP errors and `APIError` entities, this change also: 1. Adds a new `fromGuacamoleStatusCode()` to the `GuacamoleStatus` enum, allowing the integer status codes to be directly translated to typesafe `GuacamoleStatus` values. 2. Adds a new `statusCode` property to `APIError` (and it's JavaScript sibling `Error`), along with a new error type, `STREAM_ERROR`, for the sake of representing errors received along an intercepted Guacamole stream. The logic surrounding routing a Guacamole stream to an `OutputStream` has been extracted and generalized such that the corresponding `InputStream` implementation can leverage much of the same logic. This is done through the following new classes: 1. `InterceptedStream` - a pairing of `OutputStream` or `InputStream` with the stream index used by the Guacamole protocol, here represented by a `String` despite its integer nature due to the way such things are represented internally. It's only parsed out as an integer when actually needed as such. 2. `InterceptedStreamMap` - a mapping of stream index (again, in `String` form) to the corresponding `InterceptedStream`. This class also automatically handles notification of stream closure, and provides its own `waitFor()` function that blocks until a given stream has closed. This logic used to be part of `StreamInterceptingTunnel` when it was `OutputStream`-specific. 3. `StreamInterceptingFilter` - a filter which intercepts stream-related instructions for streams of an arbitrary type, automatically handling mapping of stream indices and blocking. It is up to the implementation to filter the instructions it is actually interested in, and route the I/O associated with those instructions accordingly. 4. `OutputStreamInterceptingFilter` - an `OutputStream`-specific implementation of `StreamInterceptingFilter`. This contains the remaining logic that used to be part of `StreamInterceptingTunnel`. 5. `InputStreamInterceptingFilter` - an `InputStream`-specific implementation of `StreamInterceptingFilter`. This is the new logic, implementing support for routing uploaded file data along an established Guacamole stream. As receipt of the error via "ack" happens asynchronously and outside the blocking call to `interceptStream()`, errors are instead reported via a call to the `setStreamError()` function of the newly-added `InterceptedStream` object. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mike-jumper/incubator-guacamole-client upload-endpoint Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-guacamole-client/pull/16.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #16 commit f391f00c7ba9d146c5bb1717f80a0bb291fd5bac Author: Michael Jumper Date: 2016-06-04T08:58:01Z GUACAMOLE-44: Extract logic of StreamInterceptingTunnel. commit 131785a442084a2631421daa313541e0a9760b2d Author: Michael Jumper Date: 2016-06-04T09:18:34Z GUACAMOLE-44: Implement intercepting of input streams. commit 75baa69ceadd42b767fe9b70d6fd21f64a647d88 Author: Michael Jumper Date: 2016-06-05T22:41:52Z GUACAMOLE-44: Add GuacamoleStreamException for reporting errors from intercepted streams. commit 2bb5260144697316e5c93cfca9812511ee0b3354 Author: Michael Jumper Date: 2016-06-05T23:01:08Z GUACAMOLE-44: Provide for direct translation of status codes into GuacamoleStatus values. commit e79d019fe6253f9bacc16285dc728c6d2c44df40 Author: Michael Jumper Date: 2016-06-05T23:00:03Z GUACAMOLE-44: Allow intercepted streams to report errors. commit ef5329dbe1ebdeecfbb81b820d4fef79b201401c Author: Michael Jumper Date: 2016-06-05T23:12:37Z GUACAMOLE-44: Implement JavaScript service for uploading files to a stream via the REST tunnel endpoint. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [email protected] or file a JIRA ticket with INFRA. ---
