Examples of ServletContextResource


Examples of com.volantis.xml.pipeline.sax.drivers.webservice.ServletContextResource

        // =====================================================================
        //   Test Expectations
        // =====================================================================


        ServletContextResource resource =
                new ServletContextResource("/fred.jsp");
        InputSource source = resource.provideInputSource(contextMock);

        InputStream is = source.getByteStream();
        InputStreamReader isr = new InputStreamReader(is);
        BufferedReader br = new BufferedReader(isr);
View Full Code Here

Examples of org.beangle.web.io.ServletContextResource

    this.servletContext = servletContext;
  }

  @Override
  protected Resource getResourceByPath(String path) {
    return new ServletContextResource(this.servletContext, path);
  }
View Full Code Here

Examples of org.springframework.web.context.support.ServletContextResource

    protected final Log log = LogFactory.getLog(getClass());

    public InputStream getResource(ServletContext servletContext, String path) {
        InputStream in = null;
        try {
            in = new ServletContextResource(servletContext, path).getInputStream();
        } catch (Exception e) {
            log.debug("Could not find resource [" + path + "] in servlet context.");
        } finally {
            if (in == null) in = getClass().getResourceAsStream(path);
            try {
View Full Code Here

Examples of org.springframework.web.context.support.ServletContextResource

        this.servletContext = servletContext;
    }

    protected String getView(String className) {
        String path = "crud/" + className.replaceAll("\\.", "/").toLowerCase() + "_search";
        ServletContextResource resource = new ServletContextResource(servletContext, "WEB-INF/jsp/" + path + ".jsp");
        return resource.exists() ? path : "crud/template_search";
    }
View Full Code Here

Examples of org.springframework.web.context.support.ServletContextResource

        this.servletContext = servletContext;
    }

    protected String getView(String className) {
        String path = "crud/" + className.replaceAll("\\.", "/").toLowerCase();
        ServletContextResource resource = new ServletContextResource(servletContext, "WEB-INF/jsp/" + path + ".jsp");
        return resource.exists() ? path : "crud/template";
    }
View Full Code Here

Examples of org.springframework.web.context.support.ServletContextResource

        // load the file
        File file = loader.find(reqPath);

        if (file == null && scloader != null) {
            //try loading as a servlet resource
            ServletContextResource resource = (ServletContextResource) scloader.getResource(reqPath);
            if (resource != null && resource.exists()) {
                file = resource.getFile();
            }
        }
       
        if (file == null) {
            //return a 404
View Full Code Here

Examples of org.springframework.web.context.support.ServletContextResource

        String brokerURI = context.getInitParameter(INIT_PARAM_BROKER_URI);
        if (brokerURI == null) {
            brokerURI = "activemq.xml";
        }
        context.log("Loading ActiveMQ Broker configuration from: " + brokerURI);
        Resource resource = new ServletContextResource(context, brokerURI);
        BrokerFactoryBean factory = new BrokerFactoryBean(resource);
        try {
            factory.afterPropertiesSet();
        }
        catch (Exception e) {
View Full Code Here

Examples of org.springframework.web.context.support.ServletContextResource

   * Return the file timestamp for the given resource.
   * @param resourceUrl the URL of the resource
   * @return the file timestamp in milliseconds, or -1 if not determinable
   */
  protected long getFileTimestamp(String resourceUrl) {
    ServletContextResource resource = new ServletContextResource(getServletContext(), resourceUrl);
    try {
      long lastModifiedTime = resource.lastModified();
      if (logger.isDebugEnabled()) {
        logger.debug("Last-modified timestamp of " + resource + " is " + lastModifiedTime);
      }
      return lastModifiedTime;
    }
View Full Code Here

Examples of org.springframework.web.context.support.ServletContextResource

  public void testUpload() throws Exception {
   
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
   
    byte[] bytes = IOUtils.toByteArray((new ServletContextResource(_ctx.getServletContext(),"/logo.png")).getInputStream());
    MultipartFile file = new MockMultipartFile("file","logo.png","image/png",bytes);
    _reqMock.addFile(file);
    _reqMock.setMethod("POST");

    _reqMock.setRequestURI("/upload.page");
View Full Code Here

Examples of org.springframework.web.context.support.ServletContextResource

    Resource[] resources = new Resource[locations.size()];
 
    for (int i = 0; i < locations.size(); i++) {
      // note that this is relying on the contextClassLoader to be set up
      // correctly
      resources[i] = new ServletContextResource(servletContext, locations.get(i));
    }
    return resources;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.