当前位置: 首页>>代码示例>>Java>>正文


Java NestedServletException类代码示例

本文整理汇总了Java中org.springframework.web.util.NestedServletException的典型用法代码示例。如果您正苦于以下问题:Java NestedServletException类的具体用法?Java NestedServletException怎么用?Java NestedServletException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NestedServletException类属于org.springframework.web.util包,在下文中一共展示了NestedServletException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetSwitchInfo

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test( expected = NullPointerException.class )
public void testGetSwitchInfo()
    throws Throwable
{

    try
    {
        this.mockMvc.perform( get( "http://localhost:8080/napi/switches/S1" ) ).andReturn();
    }
    catch ( NestedServletException e )
    {
        assertNotNull( e );
        assertNotNull( e.getCause() );
        assertTrue( e.getCause() instanceof NullPointerException );
        throw e.getCause();
    }

    throw new Exception( "failed" );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:20,代码来源:HmsLocalSwitchRestServiceTest.java

示例2: asyncRequestThatThrowsUncheckedException

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test
public void asyncRequestThatThrowsUncheckedException() throws Exception {
    final MvcResult result = mvc.perform(get("/api/c1/completableFutureException"))
        .andExpect(request().asyncStarted())
        .andReturn();

    // once the async dispatch is complete, it should no longer contribute to the activeTasks count
    assertThat(registry.find("my.long.request.exception")
        .longTaskTimer()
        .activeTasks())
        .isEqualTo(1);

    assertThatExceptionOfType(NestedServletException.class)
        .isThrownBy(() -> mvc.perform(asyncDispatch(result)))
        .withRootCauseInstanceOf(RuntimeException.class);

    assertThat(registry.find("http.server.requests")
        .tags("uri", "/api/c1/completableFutureException").timer().count()).isEqualTo(1);

    // once the async dispatch is complete, it should no longer contribute to the activeTasks count
    assertThat(registry.find("my.long.request.exception")
        .longTaskTimer().activeTasks()).isEqualTo(0);
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:24,代码来源:MetricsFilterTest.java

示例3: handleRequest

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
/**
 * Processes the incoming Burlap request and creates a Burlap response.
 */
@Override
public void handleRequest(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {

	if (!"POST".equals(request.getMethod())) {
		throw new HttpRequestMethodNotSupportedException(request.getMethod(),
				new String[] {"POST"}, "BurlapServiceExporter only supports POST requests");
	}

	try {
	  invoke(request.getInputStream(), response.getOutputStream());
	}
	catch (Throwable ex) {
	  throw new NestedServletException("Burlap skeleton invocation failed", ex);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:BurlapServiceExporter.java

示例4: handleRequest

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
/**
 * Processes the incoming Hessian request and creates a Hessian response.
 */
@Override
public void handleRequest(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {

	if (!"POST".equals(request.getMethod())) {
		throw new HttpRequestMethodNotSupportedException(request.getMethod(),
				new String[] {"POST"}, "HessianServiceExporter only supports POST requests");
	}

	response.setContentType(CONTENT_TYPE_HESSIAN);
	try {
	  invoke(request.getInputStream(), response.getOutputStream());
	}
	catch (Throwable ex) {
	  throw new NestedServletException("Hessian skeleton invocation failed", ex);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:HessianServiceExporter.java

示例5: mergeTemplate

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
/**
 * Merge the template with the context.
 * Can be overridden to customize the behavior.
 * @param template the template to merge
 * @param context the Velocity context to use for rendering
 * @param response servlet response (use this to get the OutputStream or Writer)
 * @throws Exception if thrown by Velocity
 * @see org.apache.velocity.Template#merge
 */
protected void mergeTemplate(
		Template template, Context context, HttpServletResponse response) throws Exception {

	try {
		template.merge(context, response.getWriter());
	}
	catch (MethodInvocationException ex) {
		Throwable cause = ex.getWrappedThrowable();
		throw new NestedServletException(
				"Method invocation failed during rendering of Velocity view with name '" +
				getBeanName() + "': " + ex.getMessage() + "; reference [" + ex.getReferenceName() +
				"], method '" + ex.getMethodName() + "'",
				cause==null ? ex : cause);
	}
}
 
开发者ID:ghimisradu,项目名称:spring-velocity-adapter,代码行数:25,代码来源:VelocityView.java

示例6: ConcurrentResultHandlerMethod

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
public ConcurrentResultHandlerMethod(final Object result, ConcurrentResultMethodParameter returnType) {
	super(new Callable<Object>() {
		@Override
		public Object call() throws Exception {
			if (result instanceof Exception) {
				throw (Exception) result;
			}
			else if (result instanceof Throwable) {
				throw new NestedServletException("Async processing failed", (Throwable) result);
			}
			return result;
		}
	}, CALLABLE_METHOD);
	setHandlerMethodReturnValueHandlers(ServletInvocableHandlerMethod.this.returnValueHandlers);
	this.returnType = returnType;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:17,代码来源:ServletInvocableHandlerMethod.java

示例7: equivalentMappingsWithSameMethodName

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test
public void equivalentMappingsWithSameMethodName() throws Exception {
	initServlet(ChildController.class);
	servlet.init(new MockServletConfig());

	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/child/test");
	request.addParameter("childId", "100");
	MockHttpServletResponse response = new MockHttpServletResponse();
	try {
		servlet.service(request, response);
		fail("Didn't fail with due to ambiguous method mapping");
	}
	catch (NestedServletException ex) {
		assertTrue(ex.getCause() instanceof IllegalStateException);
		assertTrue(ex.getCause().getMessage().contains("doGet"));
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:ServletAnnotationControllerTests.java

示例8: testGetSwitchBgpConfig

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test( expected = NullPointerException.class )
public void testGetSwitchBgpConfig()
    throws Throwable
{
    try
    {
        this.mockMvc.perform( get( "http://localhost:8080/napi/switches/S1/bgp" ) ).andReturn();
    }
    catch ( NestedServletException e )
    {
        assertNotNull( e );
        assertNotNull( e.getCause() );
        assertTrue( e.getCause() instanceof NullPointerException );
        throw e.getCause();
    }

    throw new Exception( "failed" );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:19,代码来源:HmsLocalSwitchRestServiceTest.java

示例9: testCreateOrUpdateSwitchBgpConfig

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test( expected = NullPointerException.class )
public void testCreateOrUpdateSwitchBgpConfig()
    throws Throwable
{
    try
    {
        this.mockMvc.perform( put( "http://localhost:8080/napi/switches/S1/bgp" ).content( mapper.writeValueAsString( HmsAggregatorDummyDataProvider.getNBSwitchBgpConfig() ).getBytes() ).accept( MediaType.APPLICATION_JSON ).contentType( MediaType.APPLICATION_JSON ) ).andReturn();
    }
    catch ( NestedServletException e )
    {
        assertNotNull( e );
        assertNotNull( e.getCause() );
        assertTrue( e.getCause() instanceof NullPointerException );
        throw e.getCause();
    }

    throw new Exception( "failed" );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:19,代码来源:HmsLocalSwitchRestServiceTest.java

示例10: testDeleteSwitchBgpConfig

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test( expected = NullPointerException.class )
public void testDeleteSwitchBgpConfig()
    throws Throwable
{
    try
    {
        this.mockMvc.perform( delete( "http://localhost:8080/napi/switches/S1/bgp" ).accept( MediaType.APPLICATION_JSON ) ).andReturn();
    }
    catch ( NestedServletException e )
    {
        assertNotNull( e );
        assertNotNull( e.getCause() );
        assertTrue( e.getCause() instanceof NullPointerException );
        throw e.getCause();
    }

    throw new Exception( "failed" );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:19,代码来源:HmsLocalSwitchRestServiceTest.java

示例11: testGetSwitchOspfv2Config

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test( expected = NullPointerException.class )
public void testGetSwitchOspfv2Config()
    throws Throwable
{
    try
    {
        this.mockMvc.perform( get( "http://localhost:8080/napi/switches/S1/ospfv2" ) ).andReturn();
    }
    catch ( NestedServletException e )
    {
        assertNotNull( e );
        assertNotNull( e.getCause() );
        assertTrue( e.getCause() instanceof NullPointerException );
        throw e.getCause();
    }

    throw new Exception( "failed" );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:19,代码来源:HmsLocalSwitchRestServiceTest.java

示例12: testCreateOrUpdateSwitchOspfv2Config

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test( expected = NullPointerException.class )
public void testCreateOrUpdateSwitchOspfv2Config()
    throws Throwable
{
    try
    {
        this.mockMvc.perform( put( "http://localhost:8080/napi/switches/S1/ospfv2" ).content( mapper.writeValueAsString( HmsAggregatorDummyDataProvider.getNBSwitchOspfv2Config() ).getBytes() ).accept( MediaType.APPLICATION_JSON ).contentType( MediaType.APPLICATION_JSON ) ).andReturn();
    }
    catch ( NestedServletException e )
    {
        assertNotNull( e );
        assertNotNull( e.getCause() );
        assertTrue( e.getCause() instanceof NullPointerException );
        throw e.getCause();
    }

    throw new Exception( "failed" );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:19,代码来源:HmsLocalSwitchRestServiceTest.java

示例13: testDeleteSwitchOspfv2Config

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test( expected = NullPointerException.class )
public void testDeleteSwitchOspfv2Config()
    throws Throwable
{
    try
    {
        this.mockMvc.perform( delete( "http://localhost:8080/napi/switches/S1/ospfv2" ).accept( MediaType.APPLICATION_JSON ) ).andReturn();
    }
    catch ( NestedServletException e )
    {
        assertNotNull( e );
        assertNotNull( e.getCause() );
        assertTrue( e.getCause() instanceof NullPointerException );
        throw e.getCause();
    }

    throw new Exception( "failed" );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:19,代码来源:HmsLocalSwitchRestServiceTest.java

示例14: testGetSwitchMcLagConfig

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test( expected = NullPointerException.class )
public void testGetSwitchMcLagConfig()
    throws Throwable
{
    try
    {
        this.mockMvc.perform( get( "http://localhost:8080/napi/switches/S1/mclag" ) ).andReturn();
    }
    catch ( NestedServletException e )
    {
        assertNotNull( e );
        assertNotNull( e.getCause() );
        assertTrue( e.getCause() instanceof NullPointerException );
        throw e.getCause();
    }

    throw new Exception( "failed" );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:19,代码来源:HmsLocalSwitchRestServiceTest.java

示例15: testDeleteSwitchMcLagConfig

import org.springframework.web.util.NestedServletException; //导入依赖的package包/类
@Test( expected = NullPointerException.class )
public void testDeleteSwitchMcLagConfig()
    throws Throwable
{
    try
    {
        this.mockMvc.perform( delete( "http://localhost:8080/napi/switches/S1/mclag" ).accept( MediaType.APPLICATION_JSON ) ).andReturn();
    }
    catch ( NestedServletException e )
    {
        assertNotNull( e );
        assertNotNull( e.getCause() );
        assertTrue( e.getCause() instanceof NullPointerException );
        throw e.getCause();
    }

    throw new Exception( "failed" );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:19,代码来源:HmsLocalSwitchRestServiceTest.java


注:本文中的org.springframework.web.util.NestedServletException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。