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


Java MappingData类代码示例

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


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

示例1: requestRewriteForService

import org.apache.tomcat.util.http.mapper.MappingData; //导入依赖的package包/类
public void requestRewriteForService(Request request, String filterUri) throws Exception {
    //rewriting the request with actual service url in order to retrieve the resource
    MappingData mappingData = request.getMappingData();
    org.apache.coyote.Request coyoteRequest = request.getCoyoteRequest();

    MessageBytes requestPath = MessageBytes.newInstance();
    requestPath.setString(filterUri);
    mappingData.requestPath = requestPath;
    MessageBytes pathInfo = MessageBytes.newInstance();
    pathInfo.setString(filterUri);
    mappingData.pathInfo = pathInfo;

    coyoteRequest.requestURI().setString(filterUri);
    coyoteRequest.decodedURI().setString(filterUri);
    if (request.getQueryString() != null) {
        coyoteRequest.unparsedURI().setString(filterUri + "?" + request.getQueryString());
    } else {
        coyoteRequest.unparsedURI().setString(filterUri);
    }
    request.getConnector().
            getMapper().map(request.getCoyoteRequest().serverName(),
            request.getCoyoteRequest().decodedURI(), null,
            mappingData);
    //connectorReq.setHost((Host)DataHolder.getInstance().getCarbonTomcatService().getTomcat().getEngine().findChild("testapp.wso2.com"));
    request.setCoyoteRequest(coyoteRequest);
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:27,代码来源:UrlMapperValve.java

示例2: getMappingData

import org.apache.tomcat.util.http.mapper.MappingData; //导入依赖的package包/类
/**
 * Return mapping data.
 */
public MappingData getMappingData() {
    return mappingData;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:7,代码来源:Request.java

示例3: DispatchData

import org.apache.tomcat.util.http.mapper.MappingData; //导入依赖的package包/类
public DispatchData() {
    uriMB = MessageBytes.newInstance();
    CharChunk uriCC = uriMB.getCharChunk();
    uriCC.setLimit(-1);
    mappingData = new MappingData();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:7,代码来源:ApplicationContext.java

示例4: getMappingData

import org.apache.tomcat.util.http.mapper.MappingData; //导入依赖的package包/类
/**
 * Return mapping data.
 */
public MappingData getMappingData() {
    return (mappingData);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:Request.java

示例5: unregisterContext

import org.apache.tomcat.util.http.mapper.MappingData; //导入依赖的package包/类
/**
 * Unregister context.
 */
private void unregisterContext(ObjectName objectName)
    throws Exception {

    String name = objectName.getKeyProperty("name");

    // If the domain is the same with ours or the engine 
    // name attribute is the same... - then it's ours
    String targetDomain=objectName.getDomain();
    if( ! domain.equals( targetDomain )) {
        try {
            targetDomain = (String) mBeanServer.getAttribute
                (objectName, "engineName");
        } catch (Exception e) {
            // Ignore
        }
        if( ! domain.equals( targetDomain )) {
            // not ours
            return;
        }
    }

    String hostName = null;
    String contextName = null;
    if (name.startsWith("//")) {
        name = name.substring(2);
    }
    int slash = name.indexOf("/");
    if (slash != -1) {
        hostName = name.substring(0, slash);
        contextName = name.substring(slash);
    } else {
        return;
    }
    // Special case for the root context
    if (contextName.equals("/")) {
        contextName = "";
    }
    // Don't un-map a context that is paused
    MessageBytes hostMB = MessageBytes.newInstance();
    hostMB.setString(hostName);
    MessageBytes contextMB = MessageBytes.newInstance();
    contextMB.setString(contextName);
    MappingData mappingData = new MappingData();
    mapper.map(hostMB, contextMB, mappingData);
    if (mappingData.context instanceof StandardContext &&
            ((StandardContext)mappingData.context).getPaused()) {
        return;
    } 
    if(log.isDebugEnabled())
        log.debug(sm.getString
              ("mapperListener.unregisterContext", contextName));

    mapper.removeContext(hostName, contextName);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:59,代码来源:MapperListener.java

示例6: getContext

import org.apache.tomcat.util.http.mapper.MappingData; //导入依赖的package包/类
/**
 * Return a <code>ServletContext</code> object that corresponds to a
 * specified URI on the server.  This method allows servlets to gain
 * access to the context for various parts of the server, and as needed
 * obtain <code>RequestDispatcher</code> objects or resources from the
 * context.  The given path must be absolute (beginning with a "/"),
 * and is interpreted based on our virtual host's document root.
 *
 * @param uri Absolute URI of a resource on the server
 */
@Override
public ServletContext getContext(String uri) {

    // Validate the format of the specified argument
    if (uri == null || !uri.startsWith("/")) {
        return null;
    }

    Context child = null;
    try {
        // Look for an exact match
        Container host = context.getParent();
        child = (Context) host.findChild(uri);

        // Non-running contexts should be ignored.
        if (child != null && !child.getState().isAvailable()) {
            child = null;
        }

        // Remove any version information and use the mapper
        if (child == null) {
            int i = uri.indexOf("##");
            if (i > -1) {
                uri = uri.substring(0, i);
            }
            // Note: This could be more efficient with a dedicated Mapper
            //       method but such an implementation would require some
            //       refactoring of the Mapper to avoid copy/paste of
            //       existing code.
            MessageBytes hostMB = MessageBytes.newInstance();
            hostMB.setString(host.getName());

            MessageBytes pathMB = MessageBytes.newInstance();
            pathMB.setString(uri);

            MappingData mappingData = new MappingData();
            ((Engine) host.getParent()).getService().findConnectors()[0].getMapper().map(
                    hostMB, pathMB, null, mappingData);
            child = (Context) mappingData.context;
        }
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        return null;
    }

    if (child == null) {
        return null;
    }

    if (context.getCrossContext()) {
        // If crossContext is enabled, can always return the context
        return child.getServletContext();
    } else if (child == context) {
        // Can still return the current context
        return context.getServletContext();
    } else {
        // Nothing to return
        return null;
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:71,代码来源:ApplicationContext.java

示例7: getMappingData

import org.apache.tomcat.util.http.mapper.MappingData; //导入依赖的package包/类
/**
 * Return mapping data.
 */
public MappingData getMappingData() {
	return mappingData;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:7,代码来源:Request.java

示例8: DispatchData

import org.apache.tomcat.util.http.mapper.MappingData; //导入依赖的package包/类
public DispatchData() {
	uriMB = MessageBytes.newInstance();
	CharChunk uriCC = uriMB.getCharChunk();
	uriCC.setLimit(-1);
	mappingData = new MappingData();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:7,代码来源:ApplicationContext.java


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