Examples of InternalStringBuilder


Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder

        {
            // Parse the template into tokens and literals
            parseTemplate();
        }

        InternalStringBuilder result = new InternalStringBuilder( _template.length() + 16 );
        for ( java.util.Iterator ii = _parsedTemplate.iterator(); ii.hasNext();
        {
            TemplateItem item = ( TemplateItem ) ii.next();
            if ( item.isToken() )
            {
                if ( _tokenValuesMap.containsKey( item.getValue() ) )
                {
                    appendToResult( result, ( String ) _tokenValuesMap.get( item.getValue() ) );
                }
                else
                {
                    // No value for the token.
                    if ( !removeUnsetTokens )
                    {
                        // treat the token as a literal
                        appendToResult( result, item.getValue() );
                    }
                }
            }
            else
            {
                appendToResult( result, item.getValue() );
            }
        }

        if ( result.length() > 0 && result.charAt( result.length() - 1 ) == '?' )
        {
            result.deleteCharAt( result.length() - 1 );
        }

        return result.toString();
    }
View Full Code Here

Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder

    private String getErrorsFromBody()
    {
        final String END_TOKEN = "</span>";
        assert(_saveBody != null);
        InternalStringBuilder body = new InternalStringBuilder(_saveBody.length());
        InternalStringBuilder error = new InternalStringBuilder(_saveBody.length());

        // pull out all of the spans  These should be legally constructed, otherwise we will ignore them.
        int len = _saveBody.length();
        int pos = 0;
        while (pos < len) {

            // find the start of a span, if we dont' find one then it's over....
            int start = _saveBody.indexOf("<span", pos);
            if (start == -1)
                break;

            // if we don't find the end of the <span> then we don't have a legal span so ignore it
            int end = _saveBody.indexOf(END_TOKEN);
            if (end == -1)
                break;

            // copy the pos to start into the body
            int realEnd = end + END_TOKEN.length() + 1;
            body.append(_saveBody.substring(pos, start));
            error.append(_saveBody.substring(start, realEnd));
            pos = realEnd;
        }

        // recreate the remainder of the body, everything not left
        body.append(_saveBody.substring(pos, len));
        _saveBody = body.toString();

        // return the error
        return error.toString();
    }
View Full Code Here

Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder

     * with the given request URI.
     */
    public static String getBeginActionURI( String requestURI )
    {
        // Translate this to a request for the begin action ("begin.do") for this PageFlowController.
        InternalStringBuilder retVal = new InternalStringBuilder();
        int lastSlash = requestURI.lastIndexOf( '/' );

        if ( lastSlash != -1 )
        {
            retVal.append( requestURI.substring( 0, lastSlash ) );
        }

        retVal.append( '/' ).append( BEGIN_ACTION_NAME ).append( ACTION_EXTENSION );
        return retVal.toString();
    }
View Full Code Here

Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder

       
        if ( actionOverride != null )
        {
            // The action must be fully-qualified with its module path.
            assert actionOverride.charAt( 0 ) == '/' : actionOverride;
            InternalStringBuilder uri = new InternalStringBuilder( scopedRequest.getContextPath() );
            uri.append( actionOverride );
            uri.append( PageFlowConstants.ACTION_EXTENSION );
            scopedRequest.setRequestURI( uri.toString() );
        }

        //
        // In case the request was already forwarded once, clear out the recorded forwarded-URI.  This
        // will allow us to tell whether processing the request actually forwarded somewhere.
View Full Code Here

Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder

                                           HttpServletResponse response, String actionName )
            throws URISyntaxException
    {
        if ( actionName.length() < 1 ) throw new IllegalArgumentException( "actionName must be non-empty" );
       
        InternalStringBuilder actionURI = new InternalStringBuilder( request.getContextPath() );
       
        if ( actionName.charAt( 0 ) != '/' )
        {
            actionURI.append( InternalUtils.getModulePathFromReqAttr( request ) );
            actionURI.append( '/' );
        }
       
        actionURI.append( actionName );
        if ( ! actionName.endsWith( ACTION_EXTENSION ) ) actionURI.append( ACTION_EXTENSION );
       
        FreezableMutableURI uri = new FreezableMutableURI();
        uri.setEncoding( response.getCharacterEncoding() );
        uri.setURI( actionURI.toString(), true );
        return uri;
    }
View Full Code Here

Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder

            String modulePath = PageFlowUtils.getModulePath( request );
            if ( ! moduleConfig.getPrefix().equals( modulePath ) )
            {
                if ( _log.isErrorEnabled() )
                {
                    InternalStringBuilder msg = new InternalStringBuilder( "No module configuration registered for " );
                    msg.append( uri ).append( " (module path " ).append( modulePath ).append( ")." );
                    _log.error( msg.toString() );
                }

                if ( modulePath.length() == 0 ) modulePath = "/";
                InternalUtils.sendDevTimeError( "PageFlow_NoModuleConf", null,
                                                HttpServletResponse.SC_INTERNAL_SERVER_ERROR, request, response,
                                                getServletContext(), new Object[]{ uri, modulePath } );
                return true;
            }

            //
            // Make sure that the requested pageflow matches the pageflow for the directory.
            //
            ActionMapping beginMapping = getBeginMapping();
            if ( beginMapping != null )
            {
                String desiredType = beginMapping.getParameter();
                desiredType = desiredType.substring( desiredType.lastIndexOf( '.' ) + 1 ) + JPF_EXTENSION;
                String requestedType = InternalUtils.getDecodedServletPath( request );
                requestedType = requestedType.substring( requestedType.lastIndexOf( '/' ) + 1 );

                if ( ! requestedType.equals( desiredType ) )
                {
                    if ( _log.isDebugEnabled() )
                    {
                        _log.debug( "Wrong .jpf requested for this directory: got " + requestedType
                                   + ", expected " + desiredType );
                    }

                    if ( _log.isErrorEnabled() )
                    {
                        InternalStringBuilder msg = new InternalStringBuilder( "Wrong .jpf requested for this directory: got " );
                        msg.append( requestedType ).append( ", expected " ).append( desiredType ).append( '.' );
                        _log.error( msg.toString() );
                    }

                    InternalUtils.sendDevTimeError( "PageFlow_WrongPath", null,
                                                    HttpServletResponse.SC_INTERNAL_SERVER_ERROR, request, response,
                                                    getServletContext(), new Object[]{ requestedType, desiredType } );
View Full Code Here

Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder

                    //
                    // Construct a URI that is [shared flow module path] + [base action path] + [action-extension (.do)]
                    //
                    int lastSlash = actionPath.lastIndexOf( '/' );
                    assert lastSlash != -1 : actionPath;
                    InternalStringBuilder uri = new InternalStringBuilder( sf.getModulePath() );
                    uri.append( '/' );
                    uri.append( actionPath.substring( dot + 1 ) );
                    uri.append( ACTION_EXTENSION );

                    try
                    {
                        doForward( uri.toString(), request, response );
                        return false;
                    }
                    catch ( ServletException e )
                    {
                        _log.error( "Could not forward to shared flow URI " + uri, e );
View Full Code Here

Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder

                                                     HttpServletResponse response, Object returningForm )
        throws IOException
    {
                if ( _log.isInfoEnabled() )
        {
            InternalStringBuilder msg = new InternalStringBuilder( "Action \"" ).append( actionPath );
            _log.info( msg.append( "\" was also unhandled by Global.app." ).toString() );
        }

        //
        // If there's a PageFlowController for this request, try and let it handle an
        // action-not-found exception.  Otherwise, let Struts print out its "invalid path"
View Full Code Here

Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder

        String pageURI = getDecodedURI( servletRequest );
        int lastSlash = pageURI.lastIndexOf( '/' );

        if ( lastSlash != -1 )
        {
            InternalStringBuilder value = new InternalStringBuilder( qualifiedAction.length() + lastSlash );
            value.append( pageURI.substring( 0, lastSlash ) );
            value.append( qualifiedAction );
            return value.toString();
        }

        return qualifiedAction;
    }
View Full Code Here

Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder

            _log.info( "Dynamically registering module " + modulePath + ", config XML " + configFilePath );
        }
       
        if ( _log.isInfoEnabled() )
        {
            InternalStringBuilder msg = new InternalStringBuilder( "Dynamically registering module " ).append( modulePath );
            _log.info( msg.append( ", config XML " ).append( configFilePath ).toString() );
        }

        if ( _cachedConfigDigester == null )
        {
            _cachedConfigDigester = initConfigDigester();
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.