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


Java Parameter类代码示例

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


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

示例1: request

import org.restlet.data.Parameter; //导入依赖的package包/类
@Get("json")
public String request(final String entity)
{
    try
    {
        final JSONObject answer = new JSONObject();
        answer.put("version", RevisionHelper.getVerboseRevision());
        answer.put("system_UUID", getSetting("system_UUID",""));
        final Series<Parameter> ctxParams = getContext().getParameters();
        final String hostId = ctxParams.getFirstValue("HOST_ID");
        if (hostId != null)
            answer.put("host",hostId);
        
        return answer.toString();
    }
    catch (JSONException e)
    {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:22,代码来源:VersionResource.java

示例2: request

import org.restlet.data.Parameter; //导入依赖的package包/类
@Get("json")
public String request(final String entity)
{
	addAllowOrigin();
    try
    {
        final JSONObject answer = new JSONObject();
        answer.put("version", RevisionHelper.getVerboseRevision());
        answer.put("system_UUID", getSetting("system_UUID",""));
        final Series<Parameter> ctxParams = getContext().getParameters();
        final String hostId = ctxParams.getFirstValue("HOST_ID");
        if (hostId != null)
            answer.put("host",hostId);
        return answer.toString();
    }
    catch (JSONException e)
    {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:22,代码来源:VersionResource.java

示例3: read

import org.restlet.data.Parameter; //导入依赖的package包/类
/**
 * Reads all the parameters.
 * 
 * @return The form read.
 * @throws IOException
 *             If the parameters could not be read.
 */
public Form read() throws IOException {
    Form result = new Form();

    if (this.stream != null) {
        Parameter param = readNextParameter();

        while (param != null) {
            result.add(param);
            param = readNextParameter();
        }

        this.stream.close();
    }

    return result;
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:24,代码来源:FormReader.java

示例4: readFirstParameter

import org.restlet.data.Parameter; //导入依赖的package包/类
/**
 * Reads the first parameter with the given name.
 * 
 * @param name
 *            The parameter name to match.
 * @return The parameter value.
 * @throws IOException
 */
public Parameter readFirstParameter(String name) throws IOException {
    Parameter result = null;

    if (this.stream != null) {
        Parameter param = readNextParameter();

        while ((param != null) && (result == null)) {
            if (param.getName().equals(name)) {
                result = param;
            }

            param = readNextParameter();
        }

        this.stream.close();
    }

    return result;
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:28,代码来源:FormReader.java

示例5: getForm

import org.restlet.data.Parameter; //导入依赖的package包/类
/**
 * The form, sent via POST or PUT, as a map. In the case of duplicate keys,
 * only the last one will appear. Uploaded files will appear as instances of
 * {@link FileParameter}. Other fields will be plain strings.
 * <p>
 * This value is cached locally.
 * 
 * @return The form
 */
public Map<String, Object> getForm()
{
	if( form == null )
	{
		form = new HashMap<String, Object>();
		for( Parameter parameter : getFormAll() )
		{
			if( parameter instanceof FileParameter )
				form.put( parameter.getName(), parameter );
			else
				form.put( parameter.getName(), parameter.getValue() );
		}
	}

	return form;
}
 
开发者ID:tliron,项目名称:prudence,代码行数:26,代码来源:ConversationService.java

示例6: initialize

import org.restlet.data.Parameter; //导入依赖的package包/类
@Override
protected void initialize()
{
	if( request.getMethod().equals( Method.POST ) )
	{
		// Give the exposed file map a chance to consume the entity first
		exposedFile.validateInitialized();
		map.putAll( exposedFile.formFields );

		if( request.isEntityAvailable() )
		{
			Form form = new Form( request.getEntity() );
			for( Parameter parameter : form )
				map.put( parameter.getName(), parameter.getValue() );
		}
	}
}
 
开发者ID:tliron,项目名称:prudence,代码行数:18,代码来源:LazyInitializationPost.java

示例7: readValue

import org.restlet.data.Parameter; //导入依赖的package包/类
@Override
public LinkHeader readValue() throws IOException
{
	LinkHeader linkHeader = readValueOnlyReference();

	while( true )
	{
		if( !skipParameterSeparator() )
			break;

		Parameter parameter = readParameter();
		if( parameter == null )
			throw new IOException( "Invalid Link header. Parameter separator is not followed by a parameter." );

		linkHeader.getParameters().put( parameter.getName(), parameter.getValue() );
	}

	return linkHeader;
}
 
开发者ID:tliron,项目名称:prudence,代码行数:20,代码来源:LinkHeaderReader.java

示例8: list

import org.restlet.data.Parameter; //导入依赖的package包/类
@Override
public List<Car> list() {
    Client client = new Client(new Context(), Protocol.HTTPS);
    Series<Parameter> parameters = client.getContext().getParameters();
    parameters.add("truststorePath", System.getProperty("javax.net.ssl.trustStore"));

    ClientResource clientResource = new ClientResource("https://localhost:8043/api/cars/cars");
    clientResource.setNext(client);
    ChallengeResponse challenge = new ChallengeResponse(ChallengeScheme.HTTP_OAUTH_BEARER);
    challenge.setRawValue(Request.getCurrent().getAttributes().getOrDefault("token", "").toString());
    clientResource.setChallengeResponse(challenge);
    CarServiceInterface carServiceInterface = clientResource.wrap(CarServiceInterface.class);
    Car[] allCars = carServiceInterface.getAllCars();
    try {
        client.stop();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return asList(allCars);
}
 
开发者ID:cdelmas,项目名称:microservices-comparison,代码行数:21,代码来源:RemoteCarService.java

示例9: createObjectWriter

import org.restlet.data.Parameter; //导入依赖的package包/类
@Override
protected ObjectWriter createObjectWriter() {
	ObjectWriter writer = super.createObjectWriter();

	for (SerializationFeature feature : SerializationFeature.values()) {
		boolean hasDefault = DEFAULT_SERIALIZATION_FEATURES.contains(feature);
		Parameter parameter = ContextUtils.getParameter(ContextUtils.getCurrentApplicationContext(), SERIALIZATION_FEATURE + feature.name());
		if ((parameter != null) || hasDefault) {
			if (ContextUtils.getParameterAsBoolean(parameter, feature.enabledByDefault() || hasDefault)) {
				writer = writer.with(feature);
			} else {
				writer = writer.without(feature);
			}
		}
	}
	return writer;
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:18,代码来源:JacksonRepresentationImpl.java

示例10: createContext

import org.restlet.data.Parameter; //导入依赖的package包/类
protected Context createContext(Context parentContext, Element useConf)
{
   Context appContext = parentContext.createChildContext();
   
   String copy = DocumentLoader.getAttributeValue(useConf,"copy");
   if (copy==null || "parameters".equals(copy) || "all".equals(copy)) {
      for (Parameter param : parentContext.getParameters()) {
         appContext.getParameters().add(param);
      }
   }
   
   if (copy==null || "attributes".equals(copy) || "all".equals(copy)) {
      for (String key : parentContext.getAttributes().keySet()) {
         appContext.getAttributes().put(key,parentContext.getAttributes().get(key));
      }
   }
   
   loadContext(appContext,useConf);
   
   return appContext;
}
 
开发者ID:alexmilowski,项目名称:xproclet,代码行数:22,代码来源:Configuration.java

示例11: getResponseHeaders

import org.restlet.data.Parameter; //导入依赖的package包/类
/**
 * Returns the modifiable list of response headers.
 *
 * @return The modifiable list of response headers.
 */
@Override
public Series<Parameter> getResponseHeaders() {
    Series<Parameter> result = super.getResponseHeaders();

    if (!this.responseHeadersAdded) {
        if ((getHttpResponse() != null)
                && (getHttpResponse().getAllHeaders() != null)) {
            for (Header header : getHttpResponse().getAllHeaders()) {
                result.add(header.getName(), header.getValue());
            }
        }

        this.responseHeadersAdded = true;
    }

    return result;
}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:23,代码来源:HttpMethodCall.java

示例12: makeResponse

import org.restlet.data.Parameter; //导入依赖的package包/类
/**
 * @param response The response to parse
 * @return A HttpResponse object made by consuming the response of the
 *         given HttpMethod.
 * @throws IOException when problems occur processing the body content
 */
@SuppressWarnings("unchecked")
private HttpResponse makeResponse(Response response) throws IOException {
    HttpResponseBuilder builder = new HttpResponseBuilder();

    Series<Parameter> headers = (Series<Parameter>) response.getAttributes().get("org.restlet.http.headers");
    if (headers != null) {
        for (Parameter param : headers) {
            if (param.getName() != null) {
                builder.addHeader(param.getName(), param.getValue());
            }
        }
    }

    Representation entity = Preconditions.checkNotNull(response.getEntity());

    if (maxObjSize > 0 && entity != null && entity.getSize() > maxObjSize) {
        return HttpResponse.badrequest("Exceeded maximum number of bytes - " + maxObjSize);
    }

    return builder.setHttpStatusCode(response.getStatus().getCode()).setResponse(toByteArraySafe(entity)).create();
}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:28,代码来源:ClientHttpFetcher.java

示例13: getUserPrefs

import org.restlet.data.Parameter; //导入依赖的package包/类
/**
 * @param req
 * @return UserPrefs, if any are set for this request.
 */
private static UserPrefs getUserPrefs(Series<Parameter> req) {
    Map<String, String> prefs = Maps.newHashMap();
    Iterator<String> paramNames = req.getNames().iterator();
    if (paramNames == null) {
        return null;
    }
    while (paramNames.hasNext()) {
        String paramName = paramNames.next();
        if (paramName.startsWith(USERPREF_PARAM_PREFIX)) {
            String prefName = paramName.substring(USERPREF_PARAM_PREFIX.length());
            prefs.put(prefName, req.getFirstValue(paramName));
        }
    }
    return new UserPrefs(prefs);
}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:20,代码来源:ResourceGadgetContext.java

示例14: XlayerClient

import org.restlet.data.Parameter; //导入依赖的package包/类
public XlayerClient(URL serviceAddr) throws ConfigException {

        serviceAddress = serviceAddr;
        try {
            serviceURI = serviceAddr.toURI();
        } catch (Exception err) {
            throw new ConfigException("Bad Service Address", err);
        }

        /*
         * Not-so-super convincing timeout settings documented here:
         * http://restlet.com/technical-resources/restlet-framework/javadocs/2.3
         * /jse/engine/org/restlet/engine/connector/HttpClientHelper.html
         * 
         * Hard to find complete info on timeouts for HTTP in restlet.
         */
        serviceContext.getParameters().add(new Parameter("socketTimeout", SO_TIMEOUT_STRING));
        serviceContext.getParameters().add(new Parameter("readTimeout", READ_TIMEOUT_STRING));
        serviceContext.getParameters().add(new Parameter("socketConnectTimeoutMs", CONN_TIMEOUT_STRING));
    }
 
开发者ID:OpenSextant,项目名称:Xponents,代码行数:21,代码来源:XlayerClient.java

示例15: getRequestHeaders

import org.restlet.data.Parameter; //导入依赖的package包/类
/**
 * Returns the list of request headers.
 * 
 * @return The list of request headers.
 */
@Override
@SuppressWarnings("unchecked")
public Series<Parameter> getRequestHeaders() {
    if (this.requestHeaders == null) {
        this.requestHeaders = new Form();

        // Copy the headers from the request object
        String headerName;
        String headerValue;
        for (final Enumeration<String> names = getRequest()
                .getHeaderNames(); names.hasMoreElements();) {
            headerName = names.nextElement();
            for (final Enumeration<String> values = getRequest()
                    .getHeaders(headerName); values.hasMoreElements();) {
                headerValue = values.nextElement();
                this.requestHeaders.add(new Parameter(headerName,
                        headerValue));
            }
        }
    }

    return this.requestHeaders;
}
 
开发者ID:OpenNTF,项目名称:WorkflowForXPages,代码行数:29,代码来源:ServletCall.java


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