Package org.zkoss.zuss

Examples of org.zkoss.zuss.Locator


  @Override
  public NanoHTTPD.Response serve(NanoHTTPD.IHTTPSession session, ResourceSystem resourceSystem) throws Exception {
    String uri = session.getUri();
    ResourceRef ref = resourceSystem.get(uri);

    Locator locator = createLocator(ref.parent());
    String initName = ref.name();

    //parse file into definition
    ZussDefinition definition = new Parser(locator.getResource(initName), locator, initName).parse();

    //translate into CSS
    StringWriter buffer = new StringWriter();
    new Translator(definition, buffer, dummyResolver).translate();
View Full Code Here


    //send result back
    return Reply.with(NanoHTTPD.Response.Status.OK, MimeType.CSS, buffer.toString());
  }

  private Locator createLocator(final ResourceRef base) {
    return new Locator() {
      @Override
      public Reader getResource(String name) throws IOException {
        Reader reader = new InputStreamReader(base.child(name).inputStream());
        return reader;
      }
View Full Code Here

TOP

Related Classes of org.zkoss.zuss.Locator

Copyright © 2018 www.massapicom. 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.