Package org.mortbay.util

Examples of org.mortbay.util.MultiMap


    /* ------------------------------------------------------------ */
    public void sendMessage(final Collection<String> toUsers,final String toChannel,final Object message)
    {
        // break toUsers in to shards
        MultiMap shard2users = new MultiMap();
        for (String userId:toUsers)
        {      
            ShardLocation shard = userId2Shard(userId);
            shard2users.add(shard,userId);
        }
       
        // for each shard
        for (Map.Entry<ShardLocation,Object> entry : (Set<Map.Entry<ShardLocation,Object>>)shard2users.entrySet())
        {
            // TODO, we could look at all users in shard to see if we
            // know a setiId for each, and if so, break the user list
            // up into a message for each seti-id. BUT it is probably
            // more efficient just to send to the entire shard (unless
View Full Code Here


        request.removeAttribute(__JSP_FILE); // TODO remove when glassfish 1044 is fixed
       
        // TODO - allow stream or writer????
       
        Attributes old_attr=base_request.getAttributes();
        MultiMap old_params=base_request.getParameters();
        try
        {
            base_request.getConnection().include();
            if (_named!=null)
                _contextHandler.handle(_named, (HttpServletRequest)request, (HttpServletResponse)response, Handler.INCLUDE);
            else
            {
                String query=_dQuery;
               
                if (query!=null)
                {
                    MultiMap parameters=new MultiMap();
                    UrlEncoded.decodeTo(query,parameters,request.getCharacterEncoding());
                   
                    if (old_params!=null && old_params.size()>0)
                    {
                        // Merge parameters.
                        Iterator iter = old_params.entrySet().iterator();
                        while (iter.hasNext())
                        {
                            Map.Entry entry = (Map.Entry)iter.next();
                            String name=(String)entry.getKey();
                            Object values=entry.getValue();
                            for (int i=0;i<LazyList.size(values);i++)
                                parameters.add(name, LazyList.get(values, i));
                        }
                       
                    }
                    base_request.setParameters(parameters);
                }
View Full Code Here

        String old_context_path=base_request.getContextPath();
        String old_servlet_path=base_request.getServletPath();
        String old_path_info=base_request.getPathInfo();
        String old_query=base_request.getQueryString();
        Attributes old_attr=base_request.getAttributes();
        MultiMap old_params=base_request.getParameters();
        try
        {
            if (_named!=null)
                _contextHandler.handle(_named, (HttpServletRequest)request, (HttpServletResponse)response, dispatch);
            else
            {
                String query=_dQuery;
               
                if (query!=null)
                {
                    MultiMap parameters=new MultiMap();
                    UrlEncoded.decodeTo(query,parameters,request.getCharacterEncoding());
                   
                    if (old_params!=null && old_params.size()>0)
                    {
                        // Merge parameters.
                        Iterator iter = old_params.entrySet().iterator();
                        while (iter.hasNext())
                        {
                            Map.Entry entry = (Map.Entry)iter.next();
                            String name=(String)entry.getKey();
                            Object values=entry.getValue();
                            for (int i=0;i<LazyList.size(values);i++)
                                parameters.add(name, LazyList.get(values, i));
                        }
                    }
                   
                    if (old_query!=null && old_query.length()>0)
                        query=query+"&"+old_query;
View Full Code Here

                    (POST.equals(request.getMethod()) || PUT.equals(request.getMethod())))
            {
                int length = request.getContentLength();
                if(length>0)
                {
                    MultiMap map = new MultiMap();
                    UrlEncoded.decodeTo(request.getInputStream(), map, request.getCharacterEncoding(), -1);
                    for(Iterator<Map.Entry<String, String[]>> iter = map.toStringArrayMap().entrySet().iterator(); iter.hasNext();)
                    {
                        Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>)iter.next();
                        String[] value = (String[])entry.getValue();
                        params.put(entry.getKey().toString(), value!=null && value.length>0 ? value[0] : null);
                    }
View Full Code Here

            contentType = idx>0 ? contentType.substring(0, idx).trim() : contentType.trim();           
            int length = request.getContentLength();
            if(length>0)
            {
                Map<String,String> params = new HashMap<String,String>();
                MultiMap map = new MultiMap();
                UrlEncoded.decodeTo(request.getInputStream(), map, request.getCharacterEncoding(), -1);
                for(Iterator<Map.Entry<String, String[]>> iter = map.toStringArrayMap().entrySet().iterator(); iter.hasNext();)
                {
                    Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>)iter.next();
                    String[] value = (String[])entry.getValue();
                    params.put(entry.getKey().toString(), value!=null && value.length>0 ? value[0] : null);
                }
View Full Code Here

                    _weakRandom=true;
                }
            }
        }
        _random.setSeed(_random.nextLong()^System.currentTimeMillis()^hashCode()^Runtime.getRuntime().freeMemory());
        _sessions=new MultiMap();
    }
View Full Code Here

            _filterNameMappings=null;
        }
        else
        {
            _filterPathMappings=new ArrayList();
            _filterNameMappings=new MultiMap();
            for (int i=0;i<_filterMappings.length;i++)
            {
                FilterHolder filter_holder = (FilterHolder)_filterNameMap.get(_filterMappings[i].getFilterName());
                if (filter_holder==null)
                    throw new IllegalStateException("No filter named "+_filterMappings[i].getFilterName());
View Full Code Here

     * Extract Paramters from query string and/or form _content.
     */
    private void extractParameters()
    {
        if (_baseParameters == null)
            _baseParameters = new MultiMap(16);
       
        if (_paramsExtracted)
        {
            if (_parameters==null)
                _parameters=_baseParameters;
View Full Code Here

     * Extract Paramters from query string and/or form _content.
     */
    private void extractParameters()
    {
        if (_baseParameters == null)
            _baseParameters = new MultiMap(16);
       
        if (_paramsExtracted)
        {
            if (_parameters==null)
                _parameters=_baseParameters;
View Full Code Here

            _filterNameMappings=null;
        }
        else
        {
            _filterPathMappings=new ArrayList();
            _filterNameMappings=new MultiMap();
            for (int i=0;i<_filterMappings.length;i++)
            {
                FilterHolder filter_holder = (FilterHolder)_filterNameMap.get(_filterMappings[i].getFilterName());
                if (filter_holder==null)
                    throw new IllegalStateException("No filter named "+_filterMappings[i].getFilterName());
View Full Code Here

TOP

Related Classes of org.mortbay.util.MultiMap

Copyright © 2018 www.massapicom. 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.