Package org.glyptodon.guacamole

Examples of org.glyptodon.guacamole.GuacamoleServerException


            // Detach and close
            session.detachTunnel(tunnel);
            tunnel.close();

            throw new GuacamoleServerException("I/O Error sending data to server: " + e.getMessage(), e);
        }
        finally {
            tunnel.releaseWriter();
        }
View Full Code Here


                length -= parsed;
            }

            // If no instruction is available, it must be incomplete
            if (!parser.hasNext())
                throw new GuacamoleServerException("Filtered write() contained an incomplete instruction.");

            // Write single instruction through filter
            writeInstruction(parser.next());

        }
View Full Code Here

                    response.setContentType(clipboard.getMimetype());
                    response.getOutputStream().write(clipboard.getContents());
                }
            }
            catch (IOException e) {
                throw new GuacamoleServerException("Unable to send clipboard contents", e);
            }

        }

        // Otherwise, inform not supported
View Full Code Here

        throws GuacamoleException {

        // Wait for an instruction
        GuacamoleInstruction instruction = reader.readInstruction();
        if (instruction == null)
            throw new GuacamoleServerException("End of stream while waiting for \"" + opcode + "\".");

        // Ensure instruction has expected opcode
        if (!instruction.getOpcode().equals(opcode))
            throw new GuacamoleServerException("Expected \"" + opcode + "\" instruction but instead received \"" + instruction.getOpcode() + "\".");

        return instruction;

    }
View Full Code Here

        // Wait for ready, store ID
        GuacamoleInstruction ready = expect(reader, "ready");

        List<String> ready_args = ready.getArgs();
        if (ready_args.isEmpty())
            throw new GuacamoleServerException("No connection ID received");

        id = ready.getArgs().get(0);

    }
View Full Code Here

        int charsParsed = 0;

        // Do not exceed maximum number of elements
        if (elementCount == INSTRUCTION_MAX_ELEMENTS && state != State.COMPLETE) {
            state = State.ERROR;
            throw new GuacamoleServerException("Instruction contains too many elements.");
        }

        // Parse element length
        if (state == State.PARSING_LENGTH) {

            int parsedLength = elementLength;
            while (charsParsed < length) {

                // Pull next character
                char c = chunk[offset + charsParsed++];

                // If digit, add to length
                if (c >= '0' && c <= '9')
                    parsedLength = parsedLength*10 + c - '0';

                // If period, switch to parsing content
                else if (c == '.') {
                    state = State.PARSING_CONTENT;
                    break;
                }

                // If not digit, parse error
                else {
                    state = State.ERROR;
                    throw new GuacamoleServerException("Non-numeric character in element length.");
                }

            }

            // If too long, parse error
            if (parsedLength > INSTRUCTION_MAX_LENGTH) {
                state = State.ERROR;
                throw new GuacamoleServerException("Instruction exceeds maximum length.");
            }

            // Save length
            elementLength = parsedLength;

        } // end parse length

        // Parse element content, if available
        if (state == State.PARSING_CONTENT && charsParsed + elementLength + 1 <= length) {

            // Read element
            String element = new String(chunk, offset + charsParsed, elementLength);
            charsParsed += elementLength;
            elementLength = 0;

            // Read terminator char following element
            char terminator = chunk[offset + charsParsed++];

            // Add element to currently parsed elements
            elements[elementCount++] = element;
           
            // If semicolon, store end-of-instruction
            if (terminator == ';') {
                state = State.COMPLETE;
                parsedInstruction = new GuacamoleInstruction(elements[0],
                        Arrays.asList(elements).subList(1, elementCount));
            }

            // If comma, move on to next element
            else if (terminator == ',')
                state = State.PARSING_LENGTH;

            // Otherwise, parse error
            else {
                state = State.ERROR;
                throw new GuacamoleServerException("Element terminator of instruction was not ';' nor ','");
            }

        } // end parse content

        return charsParsed;
View Full Code Here

            xml.writeEndElement();
            xml.writeEndDocument();

        }
        catch (XMLStreamException e) {
            throw new GuacamoleServerException(
                    "Unable to write configuration list XML.", e);
        }
        catch (IOException e) {
            throw new GuacamoleServerException(
                    "I/O error writing configuration list XML.", e);
        }

    }
View Full Code Here

            writeConnectionGroup(self, xml, root);
            xml.writeEndDocument();

        }
        catch (XMLStreamException e) {
            throw new GuacamoleServerException(
                    "Unable to write connection group list XML.", e);
        }
        catch (IOException e) {
            throw new GuacamoleServerException(
                    "I/O error writing connection group list XML.", e);
        }

    }
View Full Code Here

            writeConnectionGroup(self, xml, root);
            xml.writeEndDocument();

        }
        catch (XMLStreamException e) {
            throw new GuacamoleServerException(
                    "Unable to write configuration list XML.", e);
        }
        catch (IOException e) {
            throw new GuacamoleServerException(
                    "I/O error writing configuration list XML.", e);
        }

    }
View Full Code Here

    public boolean available() throws GuacamoleException {
        try {
            return input.ready() || usedLength != 0;
        }
        catch (IOException e) {
            throw new GuacamoleServerException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.glyptodon.guacamole.GuacamoleServerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.