Tabnine Logo
ServletUnitClient.getResponse
Code IndexAdd Tabnine to your IDE (free)

How to use
getResponse
method
in
com.meterware.servletunit.ServletUnitClient

Best Java code snippets using com.meterware.servletunit.ServletUnitClient.getResponse (Showing top 20 results out of 315)

origin: webx/citrus

/** 将服务端response提交到client。 */
public void commit() {
  try {
    if (requestContexts != null && requestContext != null) {
      requestContexts.commitRequestContext(requestContext);
    }
    clientResponse = client.getResponse(invocationContext);
  } catch (RuntimeException e) {
    throw e;
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
origin: webx/citrus

/** 将服务端response提交到client。 */
public void commit() {
  try {
    if (requestContexts != null && requestContext != null) {
      requestContexts.commitRequestContext(requestContext);
    }
    clientResponse = client.getResponse(invocationContext);
  } catch (RuntimeException e) {
    throw e;
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
origin: httpunit/httpunit

/**
 * Returns the response from the specified servlet using GET.
 * @exception SAXException thrown if there is an error parsing the response
 **/
public WebResponse getResponse( String url ) throws MalformedURLException, IOException, SAXException {
  return getClient().getResponse( url );
}
origin: javanettasks/httpunit

/**
 * Returns the response from the specified servlet.
 * @exception SAXException thrown if there is an error parsing the response
 **/
public WebResponse getResponse( WebRequest request ) throws MalformedURLException, IOException, SAXException {
  return getClient().getResponse( request );
}
origin: javanettasks/httpunit

/**
 * Returns the response from the specified servlet using GET.
 * @exception SAXException thrown if there is an error parsing the response
 **/
public WebResponse getResponse( String url ) throws MalformedURLException, IOException, SAXException {
  return getClient().getResponse( url );
}
origin: httpunit/httpunit

/**
 * Returns the response from the specified servlet.
 * @exception SAXException thrown if there is an error parsing the response
 **/
public WebResponse getResponse( WebRequest request ) throws MalformedURLException, IOException, SAXException {
  return getClient().getResponse( request );
}
origin: intive-FDV/DynamicJasper

public void testDynamicReport() throws Exception {
  ServletRunner sr = new ServletRunner( getClass().getResourceAsStream("/webwork/web.xml") );       // (1) use the web.xml file to define mappings
  ServletUnitClient client = sr.newClient();               // (2) create a client to invoke the application
  WebResponse r = client.getResponse( "http://localhost/generateReport.action" ); // (3) invoke the servlet w/o authorization
  String fname=r.getHeaderField("CONTENT-DISPOSITION");
  fname = fname.substring(fname.indexOf("=")+1);
  FileOutputStream fos = new FileOutputStream( new File(System.getProperty("user.dir")+ "/target/" + fname));
  InputStream is = r.getInputStream();
  StreamUtils.copy(is, fos);
  is.close();
  fos.close();
}
origin: intive-FDV/DynamicJasper

public void testDynamicReportWithTemplate() throws Exception {
  ServletRunner sr = new ServletRunner( getClass().getResourceAsStream("/struts2/web.xml") );       // (1) use the web.xml file to define mappings
  ServletUnitClient client = sr.newClient();               // (2) create a client to invoke the application
  WebResponse r = client.getResponse( "http://localhost/generateReportTemplate.action" ); // (3) invoke the servlet w/o authorization
  String fname=r.getHeaderField("CONTENT-DISPOSITION");
  fname = fname.substring(fname.indexOf("=")+1);
  FileOutputStream fos = new FileOutputStream( new File(System.getProperty("user.dir")+ "/target/" + fname));
  InputStream is = r.getInputStream();
  StreamUtils.copy(is, fos);
  is.close();
  fos.close();
}
origin: intive-FDV/DynamicJasper

public void testDynamicReportWithTemplate() throws Exception {
  ServletRunner sr = new ServletRunner( getClass().getResourceAsStream("/webwork/web.xml") );       // (1) use the web.xml file to define mappings
  ServletUnitClient client = sr.newClient();               // (2) create a client to invoke the application
  WebResponse r = client.getResponse( "http://localhost/generateReportTemplate.action" ); // (3) invoke the servlet w/o authorization
  String fname=r.getHeaderField("CONTENT-DISPOSITION");
  fname = fname.substring(fname.indexOf("=")+1);
  FileOutputStream fos = new FileOutputStream( new File(System.getProperty("user.dir")+ "/target/" + fname));
  InputStream is = r.getInputStream();
  StreamUtils.copy(is, fos);
  is.close();
  fos.close();
}
origin: intive-FDV/DynamicJasper

public void testDynamicReport() throws Exception {
  ServletRunner sr = new ServletRunner( getClass().getResourceAsStream("/struts2/web.xml") );       // (1) use the web.xml file to define mappings
  ServletUnitClient client = sr.newClient();               // (2) create a client to invoke the application
  WebResponse r = client.getResponse( "http://localhost/example/generateReport.action" ); // (3) invoke the servlet w/o authorization
  String fname=r.getHeaderField("CONTENT-DISPOSITION");
  fname = fname.substring(fname.indexOf("=")+1);
  FileOutputStream fos = new FileOutputStream( new File(System.getProperty("user.dir")+ "/target/" + fname));
  InputStream is = r.getInputStream();
  StreamUtils.copy(is, fos);
  is.close();
  fos.close();
}
origin: org.apache.cxf/cxf-rt-testsupport

@Before
public void setUp() throws Exception {
  InputStream configurationStream = getResourceAsStream(getConfiguration());
  sr = new ServletRunner(configurationStream, CONTEXT);
  
  try {
    sr.newClient().getResponse(CONTEXT_URL + "/services");
  } catch (HttpNotFoundException e) {
    // ignore, we just want to boot up the servlet
  }   
  
  HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);        
} 
origin: apache/cxf

@Test
public void testGetUnformatServiceList() throws Exception {
  ServletUnitClient client = newClient();
  client.setExceptionsThrownOnErrorStatus(false);
  WebResponse res = client.getResponse(CONTEXT_URL + "/services?formatted=false");
  assertTrue(res.getText().contains("http://localhost/mycontext/services/greeter3"));
  assertTrue(res.getText().contains("http://localhost/mycontext/services/greeter2"));
  assertTrue(res.getText().contains("http://localhost/mycontext/services/greeter"));
}
origin: apache/cxf

@Before
public void setUp() throws Exception {
  InputStream configurationStream = getResourceAsStream(getConfiguration());
  sr = new ServletRunner(configurationStream, CONTEXT);
  try {
    sr.newClient().getResponse(CONTEXT_URL + "/services");
  } catch (HttpNotFoundException e) {
    // ignore, we just want to boot up the servlet
  }
  HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);
  configurationStream.close();
}
@After
origin: apache/cxf

@Test
public void testGetServiceList() throws Exception {
  ServletUnitClient client = newClient();
  client.setExceptionsThrownOnErrorStatus(false);
  //test the '/' context get service list
  WebResponse res = client.getResponse(CONTEXT_URL + "/");
  WebLink[] links = res.getLinks();
  assertEquals("Wrong number of service links", 3, links.length);
  Set<String> links2 = new HashSet<>();
  for (WebLink l : links) {
    links2.add(l.getURLString());
  }
  assertEquals("text/html", res.getContentType());
}
origin: apache/cxf

private void testInvokingBookService(String serviceAddress) throws Exception {
  ServletUnitClient client = newClient();
  client.setExceptionsThrownOnErrorStatus(false);
  WebRequest req =
    new GetMethodQueryWebRequest(CONTEXT_URL + serviceAddress);
  WebResponse response = client.getResponse(req);
  InputStream in = response.getInputStream();
  InputStream expected = JaxRsServletTest.class
    .getResourceAsStream("resources/expected_get_book123.txt");
  assertEquals(" Can't get the expected result ",
         getStringFromInputStream(expected),
         getStringFromInputStream(in));
}
origin: apache/cxf

@Test
public void testInvalidServiceUrl() throws Exception {
  ServletUnitClient client = newClient();
  client.setExceptionsThrownOnErrorStatus(false);
  WebResponse res = client.getResponse(CONTEXT_URL + "/services/NoSuchService");
  assertEquals(404, res.getResponseCode());
  assertEquals("text/html", res.getContentType());
}
origin: apache/cxf

@Test
public void testInvoke() {
  try {
    sr = new ServletRunner(getResourceAsStream(getConfiguration()), CONTEXT);
    sr.newClient().getResponse(CONTEXT_URL + "/services");
    // there expect a spring bean exception
    fail("we expect a spring bean Exception here");
  } catch (Exception ex) {
    // supprot spring 2.0.x and sping 2.5
    assertTrue("we expect a Bean Exception here",
         ex instanceof org.springframework.beans.FatalBeanException);
  }
}
origin: apache/cxf

public void invokingEndpoint(WebRequest req) throws Exception {
  WebResponse response = newClient().getResponse(req);
  assertEquals("text/xml", response.getContentType());
  assertTrue("utf-8".equalsIgnoreCase(response.getCharacterSet()));
  Document doc = StaxUtils.read(response.getInputStream());
  assertNotNull(doc);
  addNamespace("h", "http://apache.org/hello_world_soap_http/types");
  assertValid("/s:Envelope/s:Body", doc);
  assertValid("//h:sayHiResponse", doc);
}
origin: apache/cxf

public void invokingEndpoint(WebRequest req) throws Exception {
  WebResponse response = newClient().getResponse(req);
  assertEquals("text/xml", response.getContentType());
  assertTrue("utf-8".equalsIgnoreCase(response.getCharacterSet()));
  Document doc = StaxUtils.read(response.getInputStream());
  assertNotNull(doc);
  addNamespace("h", "http://apache.org/hello_world_soap_http/types");
  assertValid("/s:Envelope/s:Body", doc);
  assertValid("//h:sayHiResponse", doc);
}
origin: apache/cxf

@Test
public void testGetWSDL() throws Exception {
  ServletUnitClient client = newClient();
  client.setExceptionsThrownOnErrorStatus(true);
  WebRequest req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/greeter?wsdl");
  WebResponse res = client.getResponse(req);
  assertEquals(200, res.getResponseCode());
  assertEquals("text/xml", res.getContentType());
  Document doc = StaxUtils.read(res.getInputStream());
  assertNotNull(doc);
  assertValid("//wsdl:operation[@name='greetMe']", doc);
  assertValid("//wsdlsoap:address[@location='" + CONTEXT_URL + "/services/greeter']", doc);
}
com.meterware.servletunitServletUnitClientgetResponse

Javadoc

Updates this client and returns the response which would be displayed by the user agent. Note that this will typically be the same as that returned by the servlet invocation unless that invocation results in a redirect request.

Popular methods of ServletUnitClient

  • newInvocation
    Creates and returns a new invocation context from a GET request.
  • getExceptionsThrownOnErrorStatus
  • getSession
    Returns the session that would be used by the next request (if it asks for one).
  • <init>
  • getMessageBody
  • newClient
    Creates and returns a new servlet unit client instance.
  • getCookieValue
  • getFrameContents
  • getHeaderFields
  • putCookie
  • updateMainWindow
  • writeMessageBody
  • updateMainWindow,
  • writeMessageBody,
  • setExceptionsThrownOnErrorStatus

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • JFileChooser (javax.swing)
  • JFrame (javax.swing)
  • JTextField (javax.swing)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now