Examples of HttpRedirect


Examples of org.apache.excalibur.instrument.manager.http.server.HTTPRedirect

        {
            // Sample no longer exists, go back to the parent instrument.
            int pos = name.lastIndexOf( '.' );
            if ( pos >= 0 )
            {
                throw new HTTPRedirect(
                    "instrumentable.html?name=" + urlEncode( name.substring( 0,  pos ) ) );
            }
            else
            {
                throw new HTTPRedirect( "instrument-manager.html" );
            }
        }
       
        out.println( "<html>" );
        out.println( "<head><title>" + desc.getDescription() + "</title></head>" );
View Full Code Here

Examples of org.apache.excalibur.instrument.manager.http.server.HTTPRedirect

        {
            // Sample no longer exists, go back to the parent instrument.
            int pos = name.lastIndexOf( '.' );
            if ( pos >= 0 )
            {
                throw new HTTPRedirect(
                    "instrument.html?name=" + urlEncode( name.substring( 0,  pos ) ) );
            }
            else
            {
                throw new HTTPRedirect( "instrument-manager.html" );
            }
        }
       
        // The instrument manager will do its own tests of the lease, but the
        //  restrictions on this connector may be stronger so they must be tested
        //  here as well.
        lease = Math.max( 1, Math.min( lease, getConnector().getMaxLeasedSampleLease() ) );
       
        if ( getInstrumentManager().getLeaseSampleCount() >= getConnector().getMaxLeasedSamples() )
        {
            lease = 1;
        }
       
        // Renew the lease
        desc.extendLease( lease );
       
        if ( instrument != null )
        {
            // Go to the instrument page.
            int pos = name.lastIndexOf( '.' );
            if ( pos >= 0 )
            {
                throw new HTTPRedirect(
                    "instrument.html?name=" + urlEncode( name.substring( 0,  pos ) ) );
            }
            else
            {
                throw new HTTPRedirect( "instrumentable.html" );
            }
        }
        else
        {
            // Redirect to the sample page.
            throw new HTTPRedirect( "sample.html?name=" + urlEncode( desc.getName() )
                + ( chart == null ? "" : "&chart=true" ) );
        }
       
    }
View Full Code Here

Examples of org.apache.excalibur.instrument.manager.http.server.HTTPRedirect

        {
            // Sample no longer exists, go back to the parent instrument.
            int pos = name.lastIndexOf( '.' );
            if ( pos >= 0 )
            {
                throw new HTTPRedirect(
                    "instrumentable.html?name=" + urlEncode( name.substring( 0,  pos ) ) );
            }
            else
            {
                throw new HTTPRedirect( "instrument-manager.html" );
            }
        }
       
        // The instrument manager will do its own tests of the lease, but the
        //  restrictions on this connector may be stronger so they must be tested
        //  here as well.
        size = Math.max( 1, Math.min( size, getConnector().getMaxLeasedSampleSize() ) );
        lease = Math.max( 1, Math.min( lease, getConnector().getMaxLeasedSampleLease() ) );
       
        if ( getInstrumentManager().getLeaseSampleCount() >= getConnector().getMaxLeasedSamples() )
        {
            lease = 1;
        }
       
        // Register the new lease
        InstrumentSampleDescriptor sample;
        try
        {
            sample = desc.createInstrumentSample( description, interval, size, lease, type );
        }
        catch ( IllegalArgumentException e )
        {
            // The sample type is not valid.
            throw new FileNotFoundException( e.getMessage() );
        }
        catch ( IllegalStateException e )
        {
            // The sample type was incompatible with the instrument.
            throw new FileNotFoundException( e.getMessage() );
        }
       
        // Redirect to the new sample page.
        throw new HTTPRedirect( "sample.html?name=" + urlEncode( sample.getName() ) );
    }
View Full Code Here

Examples of org.apache.excalibur.instrument.manager.http.server.HTTPRedirect

        {
            // Sample no longer exists, go back to the parent instrument.
            int pos = name.lastIndexOf( '.' );
            if ( pos >= 0 )
            {
                throw new HTTPRedirect(
                    "instrument.html?name=" + urlEncode( name.substring( 0,  pos ) ) );
            }
            else
            {
                throw new HTTPRedirect( "instrument-manager.html" );
            }
        }
       
        // The instrument manager will do its own tests of the lease, but the
        //  restrictions on this connector may be stronger so they must be tested
        //  here as well.
        lease = Math.max( 1, Math.min( lease, m_connector.getMaxLeasedSampleLease() ) );
       
        if ( getInstrumentManager().getLeaseSampleCount() >= m_connector.getMaxLeasedSamples() )
        {
            lease = 1;
        }
       
        // Renew the lease
        desc.extendLease( lease );
       
        if ( instrument != null )
        {
            // Go to the instrument page.
            int pos = name.lastIndexOf( '.' );
            if ( pos >= 0 )
            {
                throw new HTTPRedirect(
                    "instrument.html?name=" + urlEncode( name.substring( 0,  pos ) ) );
            }
            else
            {
                throw new HTTPRedirect( "instrumentable.html" );
            }
        }
        else
        {
            // Redirect to the sample page.
            throw new HTTPRedirect( "sample.html?name=" + urlEncode( desc.getName() )
                + ( chart == null ? "" : "&chart=true" ) );
        }
       
    }
View Full Code Here

Examples of org.apache.excalibur.instrument.manager.http.server.HTTPRedirect

        {
            // Sample no longer exists, go back to the parent instrument.
            int pos = name.lastIndexOf( '.' );
            if ( pos >= 0 )
            {
                throw new HTTPRedirect(
                    "instrumentable.html?name=" + urlEncode( name.substring( 0,  pos ) ) );
            }
            else
            {
                throw new HTTPRedirect( "instrument-manager.html" );
            }
        }
       
        // The instrument manager will do its own tests of the lease, but the
        //  restrictions on this connector may be stronger so they must be tested
        //  here as well.
        size = Math.max( 1, Math.min( size, m_connector.getMaxLeasedSampleSize() ) );
        lease = Math.max( 1, Math.min( lease, m_connector.getMaxLeasedSampleLease() ) );
       
        if ( getInstrumentManager().getLeaseSampleCount() >= m_connector.getMaxLeasedSamples() )
        {
            lease = 1;
        }
       
        // Register the new lease
        InstrumentSampleDescriptor sample;
        try
        {
            sample = desc.createInstrumentSample( description, interval, size, lease, type );
        }
        catch ( IllegalArgumentException e )
        {
            // The sample type is not valid.
            throw new FileNotFoundException( e.getMessage() );
        }
        catch ( IllegalStateException e )
        {
            // The sample type was incompatible with the instrument.
            throw new FileNotFoundException( e.getMessage() );
        }
       
        // Redirect to the new sample page.
        throw new HTTPRedirect( "sample.html?name=" + urlEncode( sample.getName() ) );
    }
View Full Code Here

Examples of org.apache.excalibur.instrument.manager.http.server.HTTPRedirect

                // Starting with Java 1.4, encode takes an encoding, but this needs to
                //  work with 1.3.   Use our own version.
                String iName = URLCoder.encode( name.substring( 0,  pos ),
                    InstrumentManagerHTTPConnector.ENCODING );
               
                throw new HTTPRedirect( "instrument.html?name=" + iName );
            }
            else
            {
                throw new HTTPRedirect( "instrumentable.html" );
            }
        }
       
        int width = getIntegerParameter( parameters, "width", m_width );
        width = Math.max( 1, Math.min( 2048, width ) );
View Full Code Here

Examples of org.apache.excalibur.instrument.manager.http.server.HTTPRedirect

       
        System.gc();
       
        long newMemory = getMemory();
       
        throw new HTTPRedirect(
            "instrument-manager.html?oldMemory=" + oldMemory + "&newMemory=" + newMemory );
    }
View Full Code Here

Examples of org.apache.excalibur.instrument.manager.http.server.HTTPRedirect

        }
       
        if ( path.indexOf( '/', 1 ) >= 0 )
        {
            // Found a slash after the base, so we are in a subdirectory.
            throw new HTTPRedirect( "../instrument-manager.html" );
        }
        else
        {
            throw new HTTPRedirect( "instrument-manager.html" );
        }
    }
View Full Code Here

Examples of org.apache.excalibur.instrument.manager.http.server.HTTPRedirect

        {
            // Sample no longer exists, go back to the parent instrument.
            int pos = name.lastIndexOf( '.' );
            if ( pos >= 0 )
            {
                throw new HTTPRedirect(
                    "instrument.html?name=" + urlEncode( name.substring( 0,  pos ) ) );
            }
            else
            {
                throw new HTTPRedirect( "instrument-manager.html" );
            }
        }
        String chart = getParameter( parameters, "chart", null );
       
        InstrumentSampleSnapshot snapshot = desc.getSnapshot();
View Full Code Here

Examples of org.apache.excalibur.instrument.manager.http.server.HTTPRedirect

        {
            // Sample no longer exists, go back to the parent instrument.
            int pos = name.lastIndexOf( '.' );
            if ( pos >= 0 )
            {
                throw new HTTPRedirect(
                    "instrumentable.html?name=" + urlEncode( name.substring( 0,  pos ) ) );
            }
            else
            {
                throw new HTTPRedirect( "instrument-manager.html" );
            }
        }
       
        String type;
        StringBuffer types = new StringBuffer();
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.