本文整理了Java中org.restlet.data.Request.getAttributes
方法的一些代码示例,展示了Request.getAttributes
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getAttributes
方法的具体详情如下:
包路径:org.restlet.data.Request
类名称:Request
方法名:getAttributes
暂无
代码示例来源:origin: internetarchive/heritrix3
public ReportGenResource(Context ctx, Request req, Response res) throws ResourceException {
super(ctx, req, res);
getVariants().add(new Variant(MediaType.TEXT_PLAIN));
reportClass = (String)req.getAttributes().get("reportClass");
}
代码示例来源:origin: internetarchive/heritrix3
@Override
protected Reference determineRootRef(Request request) {
try {
return new Reference(
EngineApplication.this.getEngine()
.getJob(TextUtils.urlUnescape(
(String)request.getAttributes().get("job")))
.getJobDir().getCanonicalFile().toURI().toString());
} catch (IOException e) {
throw new RuntimeException(e);
}
}};
jobdir.setListingAllowed(true);
代码示例来源:origin: internetarchive/heritrix3
public JobRelatedResource(Context ctx, Request req, Response res) throws ResourceException {
super(ctx, req, res);
cj = getEngine().getJob((String)req.getAttributes().get("job"));
if(cj==null) {
throw new ResourceException(404);
}
}
代码示例来源:origin: internetarchive/heritrix3
public JobResource(Context ctx, Request req, Response res)
throws ResourceException {
super(ctx, req, res);
setModifiable(true);
getVariants().add(new Variant(MediaType.TEXT_HTML));
getVariants().add(new Variant(MediaType.APPLICATION_XML));
cj = getEngine().getJob(
TextUtils.urlUnescape((String) req.getAttributes().get("job")));
Configuration tmpltCfg = new Configuration();
tmpltCfg.setClassForTemplateLoading(this.getClass(),"");
tmpltCfg.setObjectWrapper(ObjectWrapper.BEANS_WRAPPER);
setTemplateConfiguration(tmpltCfg);
}
public void setTemplateConfiguration(Configuration tmpltCfg) {
代码示例来源:origin: internetarchive/heritrix3
public BeanBrowseResource(Context ctx, Request req, Response res) throws ResourceException {
super(ctx, req, res);
getVariants().add(new Variant(MediaType.TEXT_HTML));
getVariants().add(new Variant(MediaType.APPLICATION_XML));
setModifiable(true); // accept POSTs
appCtx = cj.getJobContext();
beanPath = (String)req.getAttributes().get("beanPath");
if (beanPath!=null) {
try {
beanPath = URLDecoder.decode(beanPath,"UTF-8");
} catch (UnsupportedEncodingException e) {
// inconceivable! UTF-8 required all Java impls
}
} else {
beanPath = "";
}
Configuration tmpltCfg = new Configuration();
tmpltCfg.setClassForTemplateLoading(this.getClass(),"");
tmpltCfg.setObjectWrapper(ObjectWrapper.BEANS_WRAPPER);
setTemplateConfiguration(tmpltCfg);
}
public void setTemplateConfiguration(Configuration tmpltCfg) {
代码示例来源:origin: org.sonatype.nexus/nexus-indexer-lucene-rest-api
@Override
protected String getRepositoryId( Request request )
{
return String.valueOf( request.getAttributes().get( REPOSITORY_ID_KEY ) );
}
代码示例来源:origin: org.sonatype.nexus/nexus-rest-api
/**
* Pull the repository Id out of the Request.
*
* @param request
* @return
*/
protected String getRepositoryId( Request request )
{
return request.getAttributes().get( REPOSITORY_ID_KEY ).toString();
}
代码示例来源:origin: org.sonatype.nexus/nexus-rest-api
protected String getUserId( Request request )
{
return request.getAttributes().get( ACCOUNT_ID_KEY ).toString();
}
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin
/**
* Pull the repository Id out of the Request.
*/
protected String getRepositoryId(Request request) {
return request.getAttributes().get(REPOSITORY_ID_KEY).toString();
}
代码示例来源:origin: org.geoserver/rest
/**
* Returns the object which contains information about the page / resource bring requested.
* <p>
* This object is created by the rest dispatcher when a request comes in.
* </p>
*/
protected PageInfo getPageInfo() {
return (PageInfo) getRequest().getAttributes().get( PageInfo.KEY );
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-rrb-plugin
/**
* DUMMY IMPLEMENTATION, just to satisfy superclass (but why is this class expanding it at all?)
*/
@Override
protected ResourceStore getResourceStore(final Request request)
throws NoSuchResourceStoreException, ResourceException
{
return getUnprotectedRepositoryRegistry().getRepository(
request.getAttributes().get(AbstractRepositoryPlexusResource.REPOSITORY_ID_KEY).toString());
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-rest-api
@Override
protected ResourceStore getResourceStore( final Request request )
throws NoSuchRepositoryException,
ResourceException
{
return getUnprotectedRepositoryRegistry().getRepository(
request.getAttributes().get( AbstractRepositoryPlexusResource.REPOSITORY_ID_KEY ).toString() );
}
代码示例来源:origin: org.archive.heritrix/heritrix-engine
public ReportGenResource(Context ctx, Request req, Response res) throws ResourceException {
super(ctx, req, res);
getVariants().add(new Variant(MediaType.TEXT_PLAIN));
reportClass = (String)req.getAttributes().get("reportClass");
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-unpack-plugin
@Override
protected Repository getResourceStore(final Request request)
throws NoSuchResourceStoreException, ResourceException
{
final String repoId = request.getAttributes().get(REPOSITORY_ID_KEY).toString();
return getUnprotectedRepositoryRegistry().getRepository(repoId);
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-rest-api
@Override
protected ResourceStore getResourceStore( final Request request )
throws NoSuchRepositoryException, ResourceException
{
return getRepositoryRegistry().getRepositoryWithFacet( request.getAttributes().get( GROUP_ID_KEY ).toString(),
GroupRepository.class );
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin
@Override
protected ResourceStore getResourceStore(final Request request)
throws NoSuchRepositoryException, ResourceException
{
return getRepositoryRegistry().getRepositoryWithFacet(request.getAttributes().get(GROUP_ID_KEY).toString(),
GroupRepository.class);
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin
@Override
protected ResourceStore getResourceStore(final Request request)
throws NoSuchRepositoryException,
ResourceException
{
return getUnprotectedRepositoryRegistry().getRepository(
request.getAttributes().get(AbstractRepositoryPlexusResource.REPOSITORY_ID_KEY).toString());
}
代码示例来源:origin: org.archive.heritrix/heritrix-engine
public JobRelatedResource(Context ctx, Request req, Response res) throws ResourceException {
super(ctx, req, res);
cj = getEngine().getJob((String)req.getAttributes().get("job"));
if(cj==null) {
throw new ResourceException(404);
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-rest-api
public static String findIP( Request request )
{
Form form = (Form) request.getAttributes().get( "org.restlet.http.headers" );
String forwardedIP = getFirstForwardedIp( form.getFirstValue( FORWARD_HEADER ) );
if ( forwardedIP != null )
{
return forwardedIP;
}
List<String> ipAddresses = request.getClientInfo().getAddresses();
return resolveIp( ipAddresses );
}
代码示例来源:origin: org.geoserver.extension/monitor-core
@Test
public void testGetById() throws Exception {
Request req = new Request();
req.getAttributes().put("request", 2);
Response res = new Response(req);
resource.init(null, req, res);
RequestData data = (RequestData) resource.handleObjectGet();
assertEquals("/two", data.getPath());
}
内容来源于网络,如有侵权,请联系作者删除!