restriction

XML schema restriction pattern for not allowing specific string

谁说我不能喝 提交于 2019-11-27 16:22:43
I need to write an XSD schema with a restriction on a field, to ensure that the value of the field does not contain the substring FILENAME at any location. For example, all of the following must be invalid: FILENAME ORIGINFILENAME FILENAMETEST 123FILENAME456 None of these values should be valid. In a regular expression language that supports negative lookahead, I could do this by writing /^((?!FILENAME).)*$ but the XSD pattern language does not support negative lookahead. How can I implement an XSD pattern restriction with the same effect as /^((?!FILENAME).)*$ ? I need to use pattern, because

Is there a way to jail in Javascript, so that the DOM isn't visible

假如想象 提交于 2019-11-27 01:25:15
问题 I would really like to provide the user some scripting capabilities, while not giving it access to the more powerful features, like altering the DOM. That is, all input/output is tunneled thru a given interface. Like a kind of restricted javacsript. Example: If the interface is checkanswer(func) this are allowed: checkanswer( function (x,y)={ return x+y; } but these are not allowed: alert(1) document.write("hello world") eval("alert()") EDIT: what I had in mind was a simple language that was

Restrict access to specific URL (Apache Tomcat)

岁酱吖の 提交于 2019-11-26 20:47:09
问题 How can I restrict access to a specific URL (it is a Tomcat Application Server)? e.g. http://localhost:8081/application cannot be accessed by an user except a specified IP (that is the calling service) 回答1: Quote: The Remote Address filter, org.apache.catalina.valves.RemoteAddrValve, allows you to compare the IP address of the requesting client against one or more regular expressions to either allow or prevent the request from continuing based on the results of this comparison. A Remote

How to allow introducing only digits in jTextField?

不想你离开。 提交于 2019-11-26 10:36:01
I have tried to use the example shown here but java showing error message of "AttributeSet cannot be resolved to a type" That is why I am trying to use another method of allowing only digits: txtUsername.addKeyListener(new MyKeyListener()); public class MyKeyListener extends KeyAdapter{ public void keyPressed(KeyEvent ke){ System.out.println("Key pressed code = "+ke.getKeyCode()); if (ke.getKeyCode()>=48 && ke.getKeyCode()<=57) return true; else return false; } } But of course it is not working because keyPressed method is void . So, what to do in order to print only digits in textfield? nIcE

How to allow introducing only digits in jTextField?

拟墨画扇 提交于 2019-11-26 02:14:15
问题 I have tried to use the example shown here but java showing error message of \"AttributeSet cannot be resolved to a type\" That is why I am trying to use another method of allowing only digits: txtUsername.addKeyListener(new MyKeyListener()); public class MyKeyListener extends KeyAdapter{ public void keyPressed(KeyEvent ke){ System.out.println(\"Key pressed code = \"+ke.getKeyCode()); if (ke.getKeyCode()>=48 && ke.getKeyCode()<=57) return true; else return false; } } But of course it is not

What does the &#39;static&#39; keyword do in a class?

﹥>﹥吖頭↗ 提交于 2019-11-25 23:55:47
问题 To be specific, I was trying this code: package hello; public class Hello { Clock clock = new Clock(); public static void main(String args[]) { clock.sayTime(); } } But it gave the error Cannot access non-static field in static method main So I changed the declaration of clock to this: static Clock clock = new Clock(); And it worked. What does it mean to put that keyword before the declaration? What exactly will it do and/or restrict in terms of what can be done to that object? 回答1: static