Examples of DirectMemoryException


Examples of org.apache.directmemory.server.commons.DirectMemoryException

                {
                    return request.getSerializer().serialize( request.getObject() );
                }
                catch ( IOException e )
                {
                    throw new DirectMemoryException( e.getMessage(), e );
                }
            case TEXT_PLAIN:
                return request.getObject().toString().getBytes();
            default:
                log.error( "exchange type unknown {}", request.getExchangeType() );
                throw new DirectMemoryException( "exchange type unknown " + request.getExchangeType() );
        }
    }
View Full Code Here

Examples of org.apache.directmemory.server.commons.DirectMemoryException

                    return response;

                }
                catch ( IOException e )
                {
                    throw new DirectMemoryException( e.getMessage(), e );
                }
                catch ( ClassNotFoundException e )
                {
                    throw new DirectMemoryException( e.getMessage(), e );
                }
                catch ( IllegalAccessException e )
                {
                    throw new DirectMemoryException( e.getMessage(), e );
                }
                catch ( InstantiationException e )
                {
                    throw new DirectMemoryException( e.getMessage(), e );
                }
            case TEXT_PLAIN:
                try
                {
                    DirectMemoryResponse<String> response = new DirectMemoryResponse<String>();
                    response.setResponse( IOUtils.toString( inputStream ) );
                    return response;
                }
                catch ( IOException e )
                {
                    throw new DirectMemoryException( e.getMessage(), e );
                }
            default:
                LoggerFactory.getLogger( AbstractDirectMemoryHttpClient.class ).error( "exchange type unknown {}",
                                                                                       request.getExchangeType() );
                throw new DirectMemoryException( "exchange type unknown " + request.getExchangeType() );
        }


    }
View Full Code Here

Examples of org.apache.directmemory.server.commons.DirectMemoryException

            resp.setContentType( MediaType.TEXT_PLAIN );
            return res.getBytes();
        }
        catch ( SerializerNotFoundException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
        catch ( ClassNotFoundException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
        catch ( InstantiationException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
        catch ( IllegalAccessException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
    }
View Full Code Here

Examples of org.apache.directmemory.server.commons.DirectMemoryException

            Serializer serializer = getSerializer( req );
            request.setCacheContent( serializer.serialize( IOUtils.toString( req.getInputStream() ) ) );
        }
        catch ( SerializerNotFoundException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }

        String expiresInHeader = req.getHeader( DirectMemoryHttpConstants.EXPIRES_IN_HTTP_HEADER );
        int expiresIn = StringUtils.isEmpty( expiresInHeader ) ? 0 : Integer.valueOf( expiresInHeader );
        log.debug( "expiresIn: {} for header value: {}", expiresIn, expiresInHeader );
View Full Code Here

Examples of org.apache.directmemory.server.commons.DirectMemoryException

                    int storedSize = header == null ? -1 : Integer.valueOf( header.getValue() );
                    return new DirectMemoryResponse().setStored( Boolean.TRUE ).setStoredSize( storedSize );
                case 204:
                    return new DirectMemoryResponse().setStored( Boolean.FALSE );
                default:
                    throw new DirectMemoryException(
                        "put cache content return http code:'" + statusLine.getStatusCode() + "', reasonPhrase:"
                            + statusLine.getReasonPhrase() );

            }

        }
        catch ( IOException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
    }
View Full Code Here

Examples of org.apache.directmemory.server.commons.DirectMemoryException

            return buildResponse( httpResponse.getEntity().getContent(), request ).setFound( true );
        }
        catch ( IOException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
    }
View Full Code Here

Examples of org.apache.directmemory.server.commons.DirectMemoryException

            return new DirectMemoryResponse().setFound( true ).setDeleted( true );

        }
        catch ( IOException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
    }
View Full Code Here

Examples of org.apache.directmemory.server.commons.DirectMemoryException

        {
            return internalPut( request ).get( configuration.getReadTimeOut(), TimeUnit.MILLISECONDS );
        }
        catch ( InterruptedException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
        catch ( TimeoutException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
        catch ( ExecutionException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }

    }
View Full Code Here

Examples of org.apache.directmemory.server.commons.DirectMemoryException

        {
            return asyncHttpClient.executeRequest( requestBuilder.build(), new DirectMemoryPutHandler( request ) );
        }
        catch ( IOException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }

    }
View Full Code Here

Examples of org.apache.directmemory.server.commons.DirectMemoryException

        {
            return internalGet( request ).get( configuration.getReadTimeOut(), TimeUnit.MILLISECONDS );
        }
        catch ( InterruptedException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
        catch ( TimeoutException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
        catch ( ExecutionException e )
        {
            throw new DirectMemoryException( e.getMessage(), e );
        }
    }
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.