如何让一个java应用程序同时提供面孔和直接资源?

时间:2015-06-03 12:46:07

标签: java glassfish jersey

我目前正在开发一个项目,它使用Faces servlet为localhost:8080 / myapp / faces /子目录提供服务(参见web.xml :)

package storm.trident.operation;

import storm.trident.planner.ProcessorContext;

public interface BatchBoundaryFunction extends Function
{
    void startBatch(ProcessorContext processorContext, TridentCollector collector);

    void finishBatch(ProcessorContext processorContext, TridentCollector collector);
}



package storm.trident.planner.processor;

import java.util.List;
import java.util.Map;

import storm.trident.operation.BatchBoundaryFunction;
import storm.trident.operation.Function;
import storm.trident.operation.TridentOperationContext;
import storm.trident.planner.ProcessorContext;
import storm.trident.planner.TridentProcessor;
import storm.trident.tuple.TridentTuple;
import storm.trident.tuple.TridentTuple.Factory;
import storm.trident.tuple.TridentTupleView.ProjectionFactory;
import backtype.storm.task.TopologyContext;
import backtype.storm.tuple.Fields;

public class EachProcessor implements TridentProcessor
{
    Function _function;

    TridentContext _context;

    AppendCollector _collector;

    Fields _inputFields;

    ProjectionFactory _projection;

    public EachProcessor(Fields inputFields, Function function)
    {
        _function = function;
        _inputFields = inputFields;
    }

    @Override
    public void prepare(Map conf, TopologyContext context, TridentContext tridentContext)
    {
        List<Factory> parents = tridentContext.getParentTupleFactories();
        if (parents.size() != 1)
        {
            throw new RuntimeException("Each operation can only have one parent");
        }
        _context = tridentContext;
        _collector = new AppendCollector(tridentContext);
        _projection = new ProjectionFactory(parents.get(0), _inputFields);
        _function.prepare(conf, new TridentOperationContext(context, _projection));
    }

    @Override
    public void cleanup()
    {
        _function.cleanup();
    }

    @Override
    public void execute(ProcessorContext processorContext, String streamId, TridentTuple tuple)
    {
        _collector.setContext(processorContext, tuple);
        _function.execute(_projection.create(tuple), _collector);
    }

    @Override
    public void startBatch(ProcessorContext processorContext)
    {
        if (_function instanceof BatchBoundaryFunction)
        {
            ((BatchBoundaryFunction) _function).startBatch(processorContext, _collector);
        }
    }

    @Override
    public void finishBatch(ProcessorContext processorContext)
    {
        if (_function instanceof BatchBoundaryFunction)
        {
            ((BatchBoundaryFunction) _function).finishBatch(processorContext, _collector);
        }
    }

    @Override
    public Factory getOutputFactory()
    {
        return _collector.getOutputFactory();
    }
}

我现在的计划是通过localhost访问另一个目录:8080 / myapp / secondapp /。在那里,我想放置一些普通的html文件,css资源等,因为它将是一个Angular应用程序。

我刚刚添加了目录&#34; secondapp&#34;包括&#34; index.html&#34;在我的/ src / main / webapp文件夹中,但我无法通过localhost:8080 / myapp / secondapp / index.html直接访问它。我已经对应用程序进行了干净的重新部署,但它只是不起作用。

我如何更改我的web.xml或其他文件以使其在带有泽西的glassfish中运行,以便能够访问&#34; secondapp&#34;中的所有文件。目录通过简单的GET请求?

先谢谢你,伙计们:)

0 个答案:

没有答案