UnsupportedOperationException
Set<String> ServletContext.getResourcePaths(String path)
ServletContext
247248249250251252253254255256257
/** * httpunit未实现getResourcePaths方法。 * 以下实现可在servlet 2.5/3.0上执行。 */ private static ServletContext createServletContextWrapper(final ServletContext servletContext) { return (ServletContext) new InterfaceImplementorBuilder().addInterface(ServletContext.class).toObject(new Object() { public URL getResource(String path) throws MalformedURLException { URL presetResult = nextGetResourceURL.get(); if (presetResult != null) { return presetResult;
51525354555657
this.itfs = itfs; } @Override public Object getObject() throws Exception { return new InterfaceImplementorBuilder().setSuperclass(object.getClass()).addInterface(itfs).toObject(object); }
230231232233234235236237238239240
/** * httpunit未实现getResourcePaths方法。 * 以下实现可在servlet 2.5/3.0上执行。 */ private static ServletContext createServletContextWrapper(final ServletContext servletContext) { return (ServletContext) new InterfaceImplementorBuilder().addInterface(ServletContext.class).toObject(new Object() { public Set<String> getResourcePaths(String path) { try { URL baseURL = servletContext.getResource(path); File basedir = null;
8283848586878889909192
assertNotNull(engine); } protected ServletContext createServletContextWrapper(final boolean supportGetResourceOfRoot) { return (ServletContext) new InterfaceImplementorBuilder().addInterface(ServletContext.class).toObject(new Object() { /** 判断当resource不存在时,返回null。 */ public URL getResource(String path) throws MalformedURLException { if (("/".equals(path) || isEmpty(path)) && !supportGetResourceOfRoot) { return null; }
5758596061626364656667
HttpServletRequest mockRequest = createMock(HttpServletRequest.class); // request attrs = createHashMap(); request = (HttpServletRequest) new InterfaceImplementorBuilder().addInterface(HttpServletRequest.class).toObject(new Object() { public Locale getLocale() { return Locale.CHINA; } public HttpSession getSession(boolean create) {
322323324325326327328329330331332
requestContext.prepare(); expectLastCall().once(); replay(requestContext); if (overrider != null) { return (RequestContext) new InterfaceImplementorBuilder() .addInterface(requestContext.getClass().getInterfaces()) .toObject(overrider, requestContext); } else { return requestContext; }
4243444546474849505152
HttpServletRequest mockRequest = createMock(HttpServletRequest.class); // request attrs = createHashMap(); request = (HttpServletRequest) new InterfaceImplementorBuilder().addInterface(HttpServletRequest.class).toObject(new Object() { public Object getAttribute(String name) { return attrs.get(name); } public void setAttribute(String name, Object o) {
120121122123124125126127128129130
expect(requestMock.getHeader("Referer")).andReturn("http://localhost:8080/").once(); expect(requestMock.getCookies()).andReturn(new Cookie[0]).once(); replay(requestMock, response, servletContext); request = (HttpServletRequest) new InterfaceImplementorBuilder().addInterface(HttpServletRequest.class).toObject(new Object() { public Object getAttribute(String name) { return requestAttrs.get(name); } public void setAttribute(String name, Object o) {
3334353637383940414243
private Map<String, Object> attrs = createHashMap(); @Before public void init() { valve = new MyInputOutputValve(); context = (PipelineContext) new InterfaceImplementorBuilder().addInterface(PipelineContext.class).toObject(new Object() { public Object getAttribute(String key) { return attrs.get(key); } public void setAttribute(String key, Object value) {