Examples of ResponseTypeHelper


Examples of org.openhab.io.cv.internal.resources.ResponseTypeHelper

    return responseBean;
  }
 
  private ItemStateListBean getItemStateListBean(HttpServletRequest request){
    String pathInfo = request.getPathInfo();
    String responseType = (new ResponseTypeHelper()).getResponseType(request);
    if(responseType!=null) {
      if (pathInfo.startsWith("/" +ReadResource.PATH_READ)) {
            ItemStateListBean bean = new ItemStateListBean(new ItemListBean(getItemBeans(request)));
            bean.index = System.currentTimeMillis();
        return bean;
View Full Code Here

Examples of org.openhab.io.rest.internal.resources.ResponseTypeHelper

  private PageBean getPageBean(HttpServletRequest request){
    try {
      String query = request.getQueryString();
    String pathInfo = request.getPathInfo();
   
    String responseType = (new ResponseTypeHelper()).getResponseType(request);
    if(responseType!=null) {
      URI basePath = UriBuilder.fromUri(request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+(request.getContextPath().equals("null")?"":request.getContextPath()) + RESTApplication.REST_SERVLET_ALIAS +"/").build();
      if (pathInfo.startsWith("/" + SitemapResource.PATH_SITEMAPS)) {
            String[] pathSegments = pathInfo.substring(1).split("/");
              if(pathSegments.length>=3) {
View Full Code Here

Examples of org.openhab.io.rest.internal.resources.ResponseTypeHelper

  }

  @Override
  public BroadcastAction filter(AtmosphereResource resource, Object originalMessage, Object message) {
    final  HttpServletRequest request = resource.getRequest();
    ResponseTypeHelper responseTypeHelper = new ResponseTypeHelper();
    String responseType = responseTypeHelper.getResponseType(request);
    try
      Object responseObject = responseType.equals(MediaTypeHelper.APPLICATION_X_JAVASCRIPT) ?
          new JSONWithPadding(message, responseTypeHelper.getQueryParam(request, "callback")) : message;       
        return new BroadcastAction(
          ACTION.CONTINUE, Response.ok(responseObject, responseType).build());
    } catch (Exception e) {
      logger.error(e.getMessage());
      return new BroadcastAction(ACTION.ABORT,  message);
View Full Code Here

Examples of org.openhab.io.rest.internal.resources.ResponseTypeHelper

          }
              }
      }
    } else {   
      // we want the full item data (as xml or json(p))
      String responseType = (new ResponseTypeHelper()).getResponseType(request);
      if(responseType!=null) {
        String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+(request.getContextPath().equals("null")?"":request.getContextPath())+ RESTApplication.REST_SERVLET_ALIAS +"/";
        if (pathInfo.startsWith("/" + ItemResource.PATH_ITEMS)) {
              String[] pathSegments = pathInfo.substring(1).split("/");
                if(pathSegments.length>=2) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.