Examples of IMAPRequest


Examples of org.apache.james.imap.api.message.request.ImapRequest

        if (logger != null && logger.isDebugEnabled()) {
            logger.debug("Unknown message: " + message);
        }
        final ImapResponseMessage result;
        if (message instanceof ImapRequest) {
            ImapRequest request = (ImapRequest) message;
            final String tag = request.getTag();
            final ImapCommand command = request.getCommand();
            result = factory.taggedBad(tag, command, HumanReadableText.UNKNOWN_COMMAND);
        } else {
            result = factory.untaggedBad(HumanReadableText.UNKNOWN_COMMAND);
        }
        return result;
View Full Code Here

Examples of org.apache.james.protocols.imap.IMAPRequest

    private final static Pattern LITERAL_PATTERN = Pattern.compile(".*\\{(\\d+)\\}.*");
   
    @Override
    protected Request parseRequest(IMAPSession session, ByteBuffer buffer) throws Exception {
        IMAPRequest request = new IMAPRequest(buffer);
        Matcher matcher = LITERAL_PATTERN.matcher(request.getArgument());
        if (matcher.matches()) {
            final long bytesToRead = Long.parseLong(matcher.group(1));
            MultiLineHandler<IMAPSession> handler = new MultiLineHandler<IMAPSession>() {
               
                private static final String BYTES_READ = "BYTES_READ";
               
                /*
                 * (non-Javadoc)
                 * @see org.apache.james.protocols.api.handler.MultiLineHandler#isReady(org.apache.james.protocols.api.ProtocolSession, java.nio.ByteBuffer)
                 */
                protected boolean isReady(IMAPSession session, ByteBuffer line) {
                    long bytesRead = (Long) session.setAttachment(BYTES_READ, null, State.Transaction);
                    bytesRead += line.remaining();
                    if (bytesRead >= bytesToRead) {
                        return true;
                    } else {
                        session.setAttachment(BYTES_READ, bytesRead, State.Transaction);
                        return false;
                    }
                }

                @Override
                protected Response onLines(IMAPSession session, Collection<ByteBuffer> lines) {
                    session.popLineHandler();
                    return dispatchCommandHandlers(session, new IMAPRequest(lines));
                }
            };
            buffer.rewind();
           
            // push the line to the handler
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.