jicarilla-sandbox/platform/components/http/impl/src/java/org/jicarilla/http ProtocolPolicyTransformerImpl.java,NONE,1.1

Leo Simons <[email protected]>
Newsgroups gmane.comp.java.jicarilla.cvs
Message-ID <[email protected]>
Update of /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/impl/src/java/org/jicarilla/http
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22610/platform/components/http/impl/src/java/org/jicarilla/http

Added Files:
	ProtocolPolicyTransformerImpl.java 
Log Message:
start some early code to tackle the higher-level protocol issues

--- NEW FILE: ProtocolPolicyTransformerImpl.java ---
/* ====================================================================
The Jicarilla Software License

Copyright (c) 2003 Leo Simons.
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
==================================================================== */
package org.jicarilla.http;

import org.jicarilla.http.util.RFC2119;

import java.util.Date;

/**
 * 
 *
 * @author <a href="lsimons at jicarilla dot org">Leo Simons</a>
 * @version $Id: ProtocolPolicyTransformerImpl.java,v 1.1 2004/04/09 18:56:00 lsimons Exp $
 */
public class ProtocolPolicyTransformerImpl
{
    public void apply( ProtocolPolicy policy, Message response )
    {
        applyPersistentConnectionRequirement(
                policy.persistentConnectionRequirement(),
                response );
        applyLastModifiedDate( policy.getLastModifiedDate(), response );
        applyEntityTag( policy.getEntityTag(), response );
        applyCachePolicy( policy.getCachePolicy(), response );
        applyCookies( policy.getCookies(), response );
        applyContentType( policy.getContentType(), response );
        applyChunkedTransferEncodingRequirement(
                policy.chunkedTransferCodingRequirement(),
                response );
        applyContentLength( policy.getContentLength(), response );
        applyContentCoding( policy.getContentCoding(), response );
    }

    protected void applyPersistentConnectionRequirement( RFC2119.Level level,
            Message response )
    {
        if( level.compareTo( RFC2119.SHOULD_NOT ) <= 0 )
            response.addHeader( Encoding.HEADER_CONNECTION_BUFFER,
                    Encoding.HEADER_CONNECTION_CLOSE_BUFFER );
    }

    protected void applyLastModifiedDate( Date lastModifiedDate,
            Message response )
    {
        response.addHeader( Encoding.HEADER_LAST_MODIFIED_BUFFER,
                Encoding.dateToBuffer( lastModifiedDate ) );
    }

    protected void applyEntityTag( EntityTag entityTag, Message response )
    {
    }

    protected void applyCachePolicy( CachePolicy cachePolicy, Message response )
    {
    }

    protected void applyCookies( Cookie[] cookies, Message response )
    {
    }

    protected void applyContentType( String contentType, Message response )
    {
    }

    protected void applyChunkedTransferEncodingRequirement( RFC2119.Level level,
            Message response )
    {
    }

    protected void applyContentLength( int contentLength, Message response )
    {
    }

    protected void applyContentCoding( ContentCoding contentCoding,
            Message response )
    {
    }
}



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.