org.restlet.Request.getCurrent()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中org.restlet.Request.getCurrent方法的一些代码示例,展示了Request.getCurrent的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getCurrent方法的具体详情如下:
包路径:org.restlet.Request
类名称:Request
方法名:getCurrent

Request.getCurrent介绍

[英]Returns the request associated to the current thread. This is reusing the Response#getCurrent() method.

Warning: this method should only be used under duress. You should by default prefer obtaining the current context using methods such as org.restlet.resource.Resource#getRequest().
[中]返回与当前线程关联的请求。这是在重用Response#getCurrent()方法。
警告:此方法只能在胁迫下使用。默认情况下,您应该更喜欢使用org等方法获取当前上下文。restlet。资源资源#getRequest()。

代码示例

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rest-server

private Object convert( Object result )
{
  if( converter != null )
  {
    result = converter.convert( result, Request.getCurrent(), (Object[]) Request.getCurrent()
      .getAttributes()
      .get( ARGUMENTS ) );
  }
  return result;
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs

/**
 * Returns the attributes of the current Restlet {@link org.restlet.Request}
 * .
 * 
 * @return the attributes of the current Restlet Request, but never null
 */
private Map<String, Object> getRequestAttributes() {
  return org.restlet.Request.getCurrent().getAttributes();
}

代码示例来源:origin: apache/attic-polygene-java

@Override
  public Object getResult()
  {
    return Request.getCurrent().getAttributes().get( "event" );
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs

/**
 * @see org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList.ParamGetter#getValue()
 */
public Object getValue() throws InvocationTargetException,
    ConvertRepresentationException, WebApplicationException {
  return Request.getCurrent().getEntity();
}

代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server

private Object convert( Object result )
{
  if( converter != null )
  {
    result = converter.convert( result, Request.getCurrent(), (Object[]) Request.getCurrent()
      .getAttributes()
      .get( ARGUMENTS ) );
  }
  return result;
}

代码示例来源:origin: apache/attic-polygene-java

private Object convert( Object result )
{
  if( converter != null )
  {
    result = converter.convert( result, Request.getCurrent(), (Object[]) Request.getCurrent()
      .getAttributes()
      .get( ARGUMENTS ) );
  }
  return result;
}

代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server

public static ObjectSelection current()
{
  return (ObjectSelection) Request.getCurrent().getAttributes().get( "selection" );
}

代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server

protected void setResourceValidity( EntityComposite entity )
{
  Request request = Request.getCurrent();
  ResourceValidity validity = new ResourceValidity( entity, spi, request );
  request.getAttributes().put( RESOURCE_VALIDITY, validity );
}

代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server

public static void newSelection()
{
  Request.getCurrent().getAttributes().put( "selection", new ObjectSelection() );
}

代码示例来源:origin: apache/attic-polygene-java

protected void setResourceValidity( EntityComposite entity )
{
  Request request = Request.getCurrent();
  ResourceValidity validity = new ResourceValidity( entity, spi, request );
  request.getAttributes().put( RESOURCE_VALIDITY, validity );
}

代码示例来源:origin: apache/attic-polygene-java

@Override
  public void afterCompletion( UnitOfWorkStatus status )
  {
    if( status.equals( UnitOfWorkStatus.COMPLETED ) )
    {
      Request.getCurrent().getAttributes().put( "event", domainEvent );
    }
  }
} );

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rest-server

protected void setResourceValidity( EntityComposite entity )
{
  Request request = Request.getCurrent();
  ResourceValidity validity = new ResourceValidity( entity, spi, request );
  request.getAttributes().put( RESOURCE_VALIDITY, validity );
}

代码示例来源:origin: apache/attic-polygene-java

@Override
  public void afterCompletion( UnitOfWorkStatus status )
  {
    if( status.equals( UnitOfWorkStatus.COMPLETED ) )
    {
      Request.getCurrent().getAttributes().put( "event", domainEvent );
    }
  }
} );

代码示例来源:origin: apache/attic-polygene-java

public static void newSelection()
{
  Request.getCurrent().getAttributes().put( "selection", new ObjectSelection() );
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs

/**
 * @return the character set of the current entity, or null, if no entity or
 *         no character set is available.
 */
private CharacterSet getCurrentRequestEntityCharacterSet() {
  Representation entity = Request.getCurrent().getEntity();
  if (entity == null)
    return null;
  return entity.getCharacterSet();
}

代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server

public void subResource( Class<? extends ContextResource> subResourceClass )
{
  Uniform subResource = subResources.get( subResourceClass );
  if( subResource == null )
  {
    // Instantiate and store subresource instance
    subResource = objectFactory.newObject( subResourceClass, this );
    subResources.put( subResourceClass, subResource );
  }
  subResource.handle( Request.getCurrent(), Response.getCurrent() );
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs

/**
 * @return the character set of the current entity, or null, if no entity or
 *         no character set is available.
 */
private CharacterSet getCurrentRequestEntityCharacterSet() {
  Representation entity = Request.getCurrent().getEntity();
  if (entity == null)
    return null;
  return entity.getCharacterSet();
}

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rest-server

public void subResource( Class<? extends ContextResource> subResourceClass )
{
  Uniform subResource = subResources.get( subResourceClass );
  if( subResource == null )
  {
    // Instantiate and store subresource instance
    subResource = module.newObject( subResourceClass, this );
    subResources.put( subResourceClass, subResource );
  }
  subResource.handle( Request.getCurrent(), Response.getCurrent() );
}

代码示例来源:origin: apache/attic-polygene-java

public void subResource( Class<? extends ContextResource> subResourceClass )
{
  Uniform subResource = subResources.get( subResourceClass );
  if( subResource == null )
  {
    // Instantiate and store subresource instance
    subResource = objectFactory.newObject( subResourceClass, this );
    subResources.put( subResourceClass, subResource );
  }
  subResource.handle( Request.getCurrent(), Response.getCurrent() );
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs

/**
 * @param mediaType
 * @param entityStream
 * @return
 */
static Form getForm(MediaType mediaType, InputStream entityStream) {
  Form form = new Form(new InputRepresentation(entityStream, toRestletMediaType(mediaType)));
  Request.getCurrent().setEntity(form.getWebRepresentation());
  return form;
}

相关文章