亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? myhtmleditorkit.java

?? JAVA開源LDAP瀏覽器jxplorer的源碼!
?? JAVA
字號:
package com.ca.directory.jxplorer.viewer;


import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.naming.directory.*;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.net.URLDecoder;
import com.ca.commons.naming.*;
import com.ca.commons.cbutil.*;

/**
 *    A collection of evil hacks to get inside the (*^^(&* HMTL Editor Kit
 *    Model, and disable the automated HTML form submission code, allowing
 *    us to intercept form submissions.
 */
class MyFormView extends FormView
{
    /**
     * Name of the Submit button.  This must be removed on form submit, so
     * that it doesn't get added to the entry.
     */
    public static final String SUBMIT = "Submit";

    HTMLTemplateDisplay templateDisplay;
	
    private static Logger log = Logger.getLogger(MyHTMLEditorKit.class.getName());

//	int  numberNamingValues;			//TE: these four are used in setRDN...
//	AttributeValue [] namingValues;

    public MyFormView(Element elem, HTMLTemplateDisplay display) 
    {
        super(elem);

        templateDisplay = display;
    }

    /**
     *    This method is what all the fuss in this whole class is about.  It over-rides the
     *    method in the standard class which would try to submit this to a web server, and
     *    instead we parse the form data and try to submit it to the directory.  Pretty neat
     *    ay?	
     */
     
    protected void submitData(String data) 
    {
		DXEntry oldEntry = templateDisplay.currentEntry;     	//TE: get the old entry (i.e its attributes & values).

        log.finest("Entry before changes: " + oldEntry);

        DN  dn  = oldEntry.getDN();                             // Get the original DN
        RDN rdn = new RDN(oldEntry.getRDN());          			//TE: get the rdn of the old entry.

        String [] namingTypes = rdn.getAtts();                  // Read the list of RDN attribute types  
        String [] namingRawValues = rdn.getRawVals();           // and values
        boolean nameChanged = false;
    
		DXEntry newEntry = parseData(data, oldEntry);	    	//TE: make an entry with any changes that the user may have done (this entry doesn't have a dn yet).

        // Must remove the Submit attr so that it doesn't get added...
        newEntry.remove(SUBMIT);

        log.finest("Entry after changes: " + newEntry);

		if (newEntry == null) return; // Error!
        
		try
		{ 
            String newName;                                     // temporary variable.
			for(int i=0;i<namingTypes.length;i++)				//TE: make the rdn (the rdn might be multivalued...).
			{
                // if we have an entry for one of the naming values...
                Attribute namingAtt = newEntry.get(namingTypes[i]);

                if(namingAtt != null)
                {
                    newName = (String)namingAtt.get();  // XXX - does this handle multi valued atts correctly?

                    if (newName!=null)       // no deleting of names in html templates!
                    {
                        // CB: bug 5054 - handle pesky white space.
                        // ... trim off any white space, unless it is all white space in which case leave one
                        // singleton space, and update the entry object with the newly trimmed name.
                        if (newName.trim().equalsIgnoreCase(newName) == false)
                        {
                            newName = newName.trim();
                            if (newName.length() == 0) newName = " ";
                            namingAtt.remove(0);
                            namingAtt.add(0, newName);
                        }

                        if (newName.equals(namingRawValues) == false)
                        {
                            nameChanged = true;
                            rdn.setRawVal(newName, i);
                        }
                    }
                }
			}
		} 
		catch (Exception e) // shouldn't happen; old entry should have already been validated by this stage.
        {
            log.log(Level.WARNING, "error parsing entry name in HTMLEditorKit ", e);
        } 
		
        if (nameChanged)
        {
    		DN newDN = new DN(dn); 					// get the dn of the old entry so the new rdn can be added to it.
	    	newDN.setRDN(rdn, newDN.size()-1);		// set the rdn in the old dn.
            newEntry.setDN(newDN);					// give the new entry the new DN....PHEW	   	   
        }
        else
        {
            newEntry.setDN(dn);                     // Name hasn't changed; reuse old one
        }

        Enumeration allOldAtts = oldEntry.getAll();
        
        // merge the old and the new, with the new getting any atts that appear in old
        // but not yet in new.  The idea here is to allow transparent passing through of
        // 'hidden' attributes, that are not affected by the form.
        
        while (allOldAtts.hasMoreElements())
        {
            Attribute att = (Attribute)allOldAtts.nextElement();
            if (att.size() != 0)
                if (newEntry.get(att.getID()) == null)
                {
                    newEntry.put(att);
                }    
        }

        // make the modification request!


        templateDisplay.currentDataSource.modifyEntry(oldEntry, newEntry);
    }

    /**
     *    Parses the form query data string, which is in standard html escaped
     *    format, and load the results into a new DXEntry.
     *
     *    @param data the html form to parse
     *    @param oldEntry the original entry, required for long string handling.
     *    @return the newly parse entry, suitable for sending to the directory.
     */    
     
    public DXEntry parseData(String data, DXEntry oldEntry)
    {    
        DXEntry newEntry = new DXEntry(); 
       
        HashSet forbiddenAttributes = null; // used to prevent very long strings breaking stuff.
       
        int start=0;
        int equalpos=0;
        int end=0;
        int length = data.length();

        try
        {
            while (start < length)
            {
                end = data.indexOf('&', start);
                if (end == -1) end = length;
                
                equalpos = data.indexOf('=', start);
    
                String attribute = data.substring(start, equalpos);

                //TODO - remove this deprecated method.  Use decode(str, enc) where enc is the page enc.
                //TODO - figure out how to get the page's advertised encoding.
                String value = URLDecoder.decode(data.substring(equalpos+1, end));//, "ISO-8859-1");
                Object val = value;

                String stringVal = null;

                // special handling for (XXX single valued) binary attributes
                if (templateDisplay.currentBinaryAttributes.contains(attribute.toLowerCase()))
                {
                	Object original = null;
                	String oldVal = null;
                	Attribute binAtt = templateDisplay.currentEntry.get(attribute);
                	if (binAtt != null && binAtt.size()>0)
                	{
            			original = binAtt.get();
            			oldVal = CBBase64.binaryToString((byte[])original);	
					}            			
					
            		if (value.equals(oldVal))
            		{
            			val = original;        // nothing has changed...
            		}	
            		else
            		{	
	                	// XXX Special handling for passwords: pass raw string through if password (only).
	                	if (attribute.toLowerCase().indexOf("password") > -1)
	                	{
                            try
                            {
	                		    val = value.getBytes("UTF-8");
                            }
                            catch (UnsupportedEncodingException e2)
                            {
                                CBUtility.error(templateDisplay, CBIntText.get("Unable to UTF-8 encode password"), e2);
                            }
	                	}
	                	else
	                	{ 
		            		val = CBBase64.stringToBinary(value);	// not password - back convert data.
		            	}
					}		            	
                }
                else if (attribute.toLowerCase().indexOf("address") > -1) 	// special handling for address fields...
                {
                	val = value.replace('\n','$');
                }
                
                if (val instanceof String)
                    stringVal = (String)val;
                    
                int dataLength = (stringVal != null)?stringVal.length():((byte[])val).length; // (*&^%*)( java array syntax.

                /* 
                 *  If the attribute was an illegally long string, replace it
                 *  now with the original oldEntry attribute (thus preventing it
                 *  from being modified in the directory, as there will be no
                 *  change.) - also add this attribute to the 'forbidden atts'
                 *  list.
                 */
                 
                if (stringVal != null && stringVal.equals(HTMLTemplateDisplay.ILLEGAL_VALUE))
                {
                    if (forbiddenAttributes == null)
                    {
                        forbiddenAttributes = new HashSet();
                    }    
                    Attribute att = oldEntry.get(attribute);
                    newEntry.put(att);
                    forbiddenAttributes.add(att);  // nb. it is possible to add the same att twice if it 
                                                   // has two long values.  We don't care.
                }
                else
                {
                    
                    if (newEntry.get(attribute) != null)  // append to existing attributes
                    {
                        if (dataLength != 0)          // don't add empty attribute values to existing attributes
                        {
                            Attribute att = newEntry.get(attribute);
                            
                            // check that this isn't an attribute containing a 
                            // very long string.
                            if (forbiddenAttributes == null || forbiddenAttributes.contains(att) == false)
                                att.add(val);       
                        }    
                    }    
                    else
                    {
                        // nb. no need to test forbidden Attributes here, as this is the first time
                        // we've met this particular attribute.
                        
                        if (dataLength != 0)
                            newEntry.put(new DXAttribute(attribute,val)); // create new attributes
                        else
                            newEntry.put(new DXAttribute(attribute));       // create new empty attribute
                    }
                }
                                    
                start = end + 1;    
            }
        }
        catch (Exception e)
        {
            CBUtility.error(templateDisplay, "Unable to submit form due\nto a problem with the query url.", new Exception("Parser error in MyHTMLEditorKit - badly formed query url: " + data + "\n  " + e.toString()));
            return null;  // exit
        }            

        return newEntry;  
    }    
}


public class MyHTMLEditorKit extends HTMLEditorKit
{
    private final ViewFactory newDefaultFactory;

    public MyHTMLEditorKit(HTMLTemplateDisplay display)
    {
        super();
        newDefaultFactory = new MyHTMLFactory(display);
    }

    public ViewFactory getViewFactory()
    {
        return newDefaultFactory; 
    }        

    public static class MyHTMLFactory extends HTMLEditorKit.HTMLFactory 
    {
        private final HTMLTemplateDisplay templateDisplay;
    
        public MyHTMLFactory(HTMLTemplateDisplay display)
        {
            super();
            templateDisplay = display;
        }
    
        /** overload the create method to serve up our own version of FormView
         *  and ImageView...
         */
        public View create(Element elem) 
        {
            View v = super.create(elem);
            if (v instanceof FormView)
                v = new MyFormView(elem, templateDisplay);        
            return v;
        }
    }
  
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日日嗨av一区二区三区四区| 国产精品视频在线看| 奇米精品一区二区三区在线观看| 欧美精品视频www在线观看| 轻轻草成人在线| 26uuu国产一区二区三区| 大陆成人av片| 亚洲一区二区三区四区的| 欧美一区二区三区日韩视频| 国产精品中文有码| 亚洲欧美日韩中文播放| 欧美精品久久99| 国产精品一区二区在线看| 一区精品在线播放| 欧美一区二区三区影视| 国产精品69毛片高清亚洲| 日韩美女视频19| 欧美日韩成人在线| 国产九九视频一区二区三区| 怡红院av一区二区三区| 欧美xxxx老人做受| 91论坛在线播放| 久久国产生活片100| 国产精品灌醉下药二区| 欧美一区二区三区色| 成人91在线观看| 免费美女久久99| ...xxx性欧美| 欧美va日韩va| 欧美最猛性xxxxx直播| 国产一区二区在线影院| 亚洲一区免费视频| 国产日韩欧美在线一区| 欧美视频一区二区三区四区| 国产精华液一区二区三区| 亚洲综合激情网| 欧美国产精品中文字幕| 日韩一区二区三区视频在线| aa级大片欧美| 国产乱人伦精品一区二区在线观看| 亚洲天堂网中文字| 久久综合九色综合97婷婷| 欧美主播一区二区三区美女| 国产成人av电影在线| 日韩av电影免费观看高清完整版| 中文字幕日韩欧美一区二区三区| 欧美电影免费提供在线观看| 欧美天天综合网| 成人av电影观看| 国产伦精品一区二区三区免费迷| 日本午夜一本久久久综合| 亚洲精品乱码久久久久久| 国产精品网站在线| 久久久777精品电影网影网| 日韩午夜在线影院| 欧美日韩另类一区| 欧美在线色视频| 91在线视频免费观看| 成人在线一区二区三区| 国产精品亚洲а∨天堂免在线| 免费观看一级特黄欧美大片| 午夜精品在线看| 午夜精品福利在线| 一区二区三区日韩精品| 亚洲视频每日更新| 亚洲另类中文字| 亚洲毛片av在线| 最新高清无码专区| 亚洲婷婷在线视频| 亚洲色欲色欲www| 亚洲欧美电影院| 亚洲人成精品久久久久久 | 日韩三级视频在线看| 欧美日本乱大交xxxxx| 欧美丰满美乳xxx高潮www| 欧美性淫爽ww久久久久无| 欧洲av一区二区嗯嗯嗯啊| 欧美中文字幕一二三区视频| 欧美系列在线观看| 欧美高清性hdvideosex| 91精品国产一区二区三区蜜臀| 3d动漫精品啪啪| 日韩欧美国产高清| 亚洲精品一区二区三区四区高清| 久久综合av免费| 国产性色一区二区| 国产精品久久久久影院| 亚洲欧美日韩人成在线播放| 亚洲午夜精品久久久久久久久| 午夜视频久久久久久| 美美哒免费高清在线观看视频一区二区 | 亚洲午夜免费视频| 午夜精品久久久久久久99水蜜桃 | 欧美美女视频在线观看| 日韩一区二区三区四区| 久久一夜天堂av一区二区三区| 久久精品欧美日韩精品| 国产精品福利影院| 午夜精品久久久久久久久久久| 蜜芽一区二区三区| 国产成+人+日韩+欧美+亚洲| 色激情天天射综合网| 欧美一级久久久| 亚洲国产高清在线| 亚洲国产一二三| 久久aⅴ国产欧美74aaa| k8久久久一区二区三区| 欧美久久久久久蜜桃| 国产欧美在线观看一区| 亚洲国产一二三| 国产精品一区二区不卡| 色88888久久久久久影院按摩| 日韩一区二区麻豆国产| 中文一区一区三区高中清不卡| 亚洲国产aⅴ天堂久久| 国产成人精品一区二区三区四区 | 高清在线不卡av| 欧美电影在线免费观看| 亚洲国产高清aⅴ视频| 五月天久久比比资源色| 99麻豆久久久国产精品免费 | 欧美日韩精品一区二区三区| 久久九九久久九九| 日本欧美大码aⅴ在线播放| 成人黄页毛片网站| 日韩视频免费观看高清完整版在线观看| 国产精品久久99| 精品一区二区三区不卡| 欧美视频一二三区| 国产精品高潮久久久久无| 精品一区二区三区影院在线午夜| 色呦呦国产精品| 国产欧美一区二区三区在线看蜜臀| 亚洲图片欧美一区| 色综合亚洲欧洲| 国产日韩欧美精品一区| 看片的网站亚洲| 欧美色综合网站| 亚洲乱码国产乱码精品精可以看| 国产精品1区2区3区| 日韩视频免费直播| 手机精品视频在线观看| 91欧美激情一区二区三区成人| 久久视频一区二区| 麻豆freexxxx性91精品| 91麻豆精品国产91久久久久久久久 | 白白色 亚洲乱淫| 国产午夜三级一区二区三| 久久成人av少妇免费| 91精品国产一区二区三区蜜臀| 亚洲第一激情av| 欧美唯美清纯偷拍| 夜夜嗨av一区二区三区四季av| 99久久99久久免费精品蜜臀| 国产亲近乱来精品视频 | 蜜臀国产一区二区三区在线播放| 欧美日韩一区二区不卡| 亚洲中国最大av网站| 日本精品视频一区二区| 亚洲影院理伦片| 欧美日韩一区成人| 午夜精品aaa| 91精品国产免费| 免费久久99精品国产| 精品久久99ma| 国产成a人亚洲| 国产精品色在线| 99re这里只有精品视频首页| 亚洲蜜臀av乱码久久精品| 在线观看一区二区视频| 亚洲另类色综合网站| 欧美天天综合网| 日韩精品一二三区| 日韩欧美国产电影| 国产白丝网站精品污在线入口 | 亚洲最新视频在线播放| 欧美在线视频不卡| 日本欧美一区二区在线观看| 91精品国产免费久久综合| 精品亚洲porn| 国产精品区一区二区三| 色综合久久综合网欧美综合网 | 亚洲乱码国产乱码精品精98午夜 | 一区二区三区在线观看国产| 精品视频一区 二区 三区| 免费观看日韩电影| 国产欧美一区二区精品久导航 | 欧美日韩夫妻久久| 精品一区二区三区在线播放| 国产午夜精品福利| 欧美在线观看一区| 久久精品噜噜噜成人av农村| 久久久久久久综合狠狠综合| www.性欧美| 奇米一区二区三区av| 国产女人aaa级久久久级| 在线视频你懂得一区二区三区| 人妖欧美一区二区| **欧美大码日韩| 欧美xxx久久|