congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
javax.faces
Code IndexAdd Tabnine to your IDE (free)

How to use javax.faces

Best Java code snippets using javax.faces (Showing top 20 results out of 2,772)

origin: primefaces/primefaces

@Override
public UIComponent resolveComponent(FacesContext context, UIComponent source, UIComponent last, String expression, int options) {
  throw new FacesException("jQuery selectors aka PFS are not supported on the server side... expression \"" + expression
      + "\" referenced from \"" + source.getClientId(context) + "\".");
}
origin: primefaces/primefaces

private void validateIterationControlValues(int rowCount,
                      int begin,
                      int end) {
  if (rowCount == 0) {
    return;
  }
  // PENDING i18n
  if (begin > rowCount) {
    throw new FacesException("Iteration start index is greater than the number of available rows.");
  }
  if (begin > end) {
    throw new FacesException("Iteration start index is greater than the end index.");
  }
  if (end > rowCount) {
    throw new FacesException("Iteration end index is greater than the number of available rows.");
  }
}
origin: primefaces/primefaces

  protected List resolveList(Object value) {
    if (value instanceof List) {
      return (List) value;
    }
    else if (value instanceof ListDataModel) {
      return (List) ((ListDataModel) value).getWrappedData();
    }
    else {
      throw new FacesException("Data type should be java.util.List or javax.faces.model.ListDataModel instance to be sortable.");
    }
  }
}
origin: primefaces/primefaces

public static <T extends Renderer> T getUnwrappedRenderer(FacesContext context, String family, String rendererType, Class<T> rendererClass) {
  Renderer renderer = context.getRenderKit().getRenderer(family, rendererType);
  while (renderer instanceof FacesWrapper) {
    renderer = (Renderer) ((FacesWrapper) renderer).getWrapped();
  }
  return (T) renderer;
}
origin: stackoverflow.com

 @Named
@RequestScoped // Or @ViewScoped
public class Bean {

  private Future<List<Entity>> asyncEntities;

  @EJB
  private EntityService entityService;

  @PostConstruct
  public void init() {
    asyncEntities = entityService.asyncList();
    // ... (this code will immediately continue without waiting)
  }

  public List<Entity> getEntities() {
    try {
      return asyncEntities.get();
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new FacesException(e);
    } catch (ExecutionException e) {
      throw new FacesException(e);
    }
  }
}
origin: primefaces/primefaces

@Override
public UIComponent resolveComponent(FacesContext context, UIComponent source, UIComponent last, String expression, int options) {
  throw new FacesException("@row likely returns multiple components, therefore it's not supported in #resolveComponent... expression \""
      + expression + "\" referenced from \"" + source.getClientId(context) + "\".");
}
origin: wildfly/wildfly

public void postConstruct(Object obj) throws IllegalAccessException, InvocationTargetException {
  // WFLY-3387 MyFaces injects managed properties before calling this method
  try {
    injectionContainer.newInstance(obj);
  } catch (NamingException e) {
    throw new FacesException(e);
  }
}
origin: primefaces/primefaces

  protected String extractId(String expression) {
    try {
      Matcher matcher = PATTERN.matcher(expression);

      if (matcher.matches()) {

        return matcher.group(1);

      }
      else {
        throw new FacesException("Expression does not match following pattern @id(id). Expression: \"" + expression + "\"");
      }

    }
    catch (Exception e) {
      throw new FacesException("Expression does not match following pattern @id(id). Expression: \"" + expression + "\"", e);
    }
  }
}
origin: primefaces/primefaces

  private String decode(String encoded) {
    try {
      // GitHub #3916 escape + and % before decode
      encoded = encoded.replaceAll("%(?![0-9a-fA-F]{2})", "%25");
      encoded = encoded.replaceAll("\\+", "%2B");
      return URLDecoder.decode(encoded, "UTF-8");
    }
    catch (UnsupportedEncodingException ex) {
      throw new FacesException(ex);
    }
  }
}
origin: primefaces/primefaces

  protected UIData findDatasource(FacesContext context, Droppable droppable, String datasourceId) {
    UIComponent datasource = SearchExpressionFacade.resolveComponent(context, droppable, datasourceId);

    if (datasource == null) {
      throw new FacesException("Cannot find component \"" + datasourceId + "\" in view.");
    }
    else {
      return (UIData) datasource;
    }
  }
}
origin: primefaces/primefaces

public static byte[] toByteArray(InputStream stream) {
  try {
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    int nRead;
    byte[] data = new byte[16384];
    while ((nRead = stream.read(data, 0, data.length)) != -1) {
      buffer.write(data, 0, nRead);
    }
    buffer.flush();
    return buffer.toByteArray();
  }
  catch (Exception e) {
    throw new FacesException("Could not read InputStream to byte[]", e);
  }
}
origin: primefaces/primefaces

  public FilterConstraint getFilterConstraint(Tree tree) {
    String filterMatchMode = tree.getFilterMatchMode();
    FilterConstraint filterConstraint = Tree.FILTER_CONSTRAINTS.get(filterMatchMode);

    if (filterConstraint == null) {
      throw new FacesException("Illegal filter match mode:" + filterMatchMode);
    }

    return filterConstraint;
  }
}
origin: primefaces/primefaces

  public FilterConstraint getFilterConstraint(UIColumn column) {
    String filterMatchMode = column.getFilterMatchMode();
    FilterConstraint filterConstraint = TreeTable.FILTER_CONSTRAINTS.get(filterMatchMode);

    if (filterConstraint == null) {
      throw new FacesException("Illegal filter match mode:" + filterMatchMode);
    }

    return filterConstraint;
  }
}
origin: primefaces/primefaces

public FilterConstraint getFilterConstraint(UIColumn column) {
  String filterMatchMode = column.getFilterMatchMode();
  FilterConstraint filterConstraint = FILTER_CONSTRAINTS.get(filterMatchMode);
  if (filterConstraint == null) {
    throw new FacesException("Illegal filter match mode:" + filterMatchMode);
  }
  return filterConstraint;
}
origin: primefaces/primefaces

public UITreeNode getUITreeNodeByType(String type) {
  UITreeNode node = getTreeNodes().get(type);
  if (node == null) {
    throw new javax.faces.FacesException("Unsupported tree node type:" + type);
  }
  else {
    return node;
  }
}
origin: primefaces/primefaces

/**
 * Creates an RFC 6266 Content-Dispostion header following all UTF-8 conventions.
 * <p>
 * @param value e.g. "attachment"
 * @param filename the name of the file
 * @return a valid Content-Disposition header in UTF-8 format
 */
public static String createContentDisposition(String value, String filename) {
  try {
    return String.format("%s;filename=\"%2$s\"; filename*=UTF-8''%2$s", value, encodeURI(filename));
  }
  catch (UnsupportedEncodingException e) {
    throw new FacesException(e);
  }
}
origin: primefaces/primefaces

  @Override
  public V get(Object key) {
    if (!containsKey(key)) {
      throw new FacesException("Class " + clazz.getName() + " does not contain the enum " + key);
    }

    return super.get(key);
  }
}
origin: primefaces/primefaces

protected SelectItem[] getFilterOptions(UIColumn column) {
  Object options = column.getFilterOptions();
  if (options instanceof SelectItem[]) {
    return (SelectItem[]) options;
  }
  else if (options instanceof Collection<?>) {
    return ((Collection<SelectItem>) column.getFilterOptions()).toArray(new SelectItem[]{});
  }
  else {
    throw new FacesException("Filter options for column " + column.getClientId() + " should be a SelectItem array or collection");
  }
}
origin: primefaces/primefaces

@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
  Captcha captcha = (Captcha) component;
  String publicKey = getPublicKey(context, captcha);
  if (publicKey == null) {
    throw new FacesException("Cannot find public key for catpcha, use primefaces.PUBLIC_CAPTCHA_KEY context-param to define one");
  }
  encodeMarkup(context, captcha, publicKey);
  encodeScript(context, captcha, publicKey);
}
origin: primefaces/primefaces

public Object getRowKeyFromModel(Object object) {
  DataModel model = getDataModel();
  if (!(model instanceof SelectableDataModel)) {
    throw new FacesException("DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled.");
  }
  return ((SelectableDataModel) getDataModel()).getRowKey(object);
}
javax.faces

Most used classes

  • FacesContext
    FacesContext contains all of the per-request state information related to the processing of a single
  • ExternalContext
  • Application
    Holds webapp-wide resources for a JSF application. There is a single one of these for a web applicat
  • UIViewRoot
    UIViewRoot is the UIComponent that represents the root of the UIComponent tree. This component rende
  • UIComponent
    see Javadoc of J SF Specification [http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.htm
  • ResponseWriter,
  • FacesException,
  • ViewHandler,
  • PhaseEvent,
  • FactoryFinder,
  • SelectItem,
  • UIInput,
  • EditableValueHolder,
  • ValueHolder,
  • RenderKit,
  • Converter,
  • UIParameter,
  • UIComponentBase,
  • ValueBinding
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now