CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-javax--javaee-api

Complete Java Enterprise Edition 8 specification APIs providing all standardized enterprise application development interfaces

Pending
Overview
Eval results
Files

web-technologies.mddocs/

Web Technologies

Web layer APIs for building user interfaces and handling HTTP requests. This includes the Servlet API, JavaServer Pages (JSP), JavaServer Faces (JSF), Expression Language (EL), and WebSocket support.

Servlet API

Core HTTP servlet programming interface for handling web requests and responses.

HttpServlet

public abstract class HttpServlet extends GenericServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
        throws ServletException, IOException;
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) 
        throws ServletException, IOException;
    protected void doPut(HttpServletRequest req, HttpServletResponse resp) 
        throws ServletException, IOException;
    protected void doDelete(HttpServletRequest req, HttpServletResponse resp) 
        throws ServletException, IOException;
    protected void doHead(HttpServletRequest req, HttpServletResponse resp) 
        throws ServletException, IOException;
    protected void doOptions(HttpServletRequest req, HttpServletResponse resp) 
        throws ServletException, IOException;
    protected void doTrace(HttpServletRequest req, HttpServletResponse resp) 
        throws ServletException, IOException;
}

HttpServletRequest

public interface HttpServletRequest extends ServletRequest {
    String getMethod();
    String getRequestURI();
    StringBuffer getRequestURL();
    String getContextPath();
    String getServletPath();
    String getPathInfo();
    String getQueryString();
    String getRemoteUser();
    String getAuthType();
    String getHeader(String name);
    Enumeration<String> getHeaders(String name);
    Enumeration<String> getHeaderNames();
    int getIntHeader(String name);
    long getDateHeader(String name);
    Cookie[] getCookies();
    HttpSession getSession();
    HttpSession getSession(boolean create);
    String getRequestedSessionId();
    boolean isRequestedSessionIdValid();
    boolean isRequestedSessionIdFromCookie();
    boolean isRequestedSessionIdFromURL();
    Part getPart(String name) throws IOException, ServletException;
    Collection<Part> getParts() throws IOException, ServletException;
}

HttpServletResponse

public interface HttpServletResponse extends ServletResponse {
    void addCookie(Cookie cookie);
    boolean containsHeader(String name);
    void setHeader(String name, String value);
    void addHeader(String name, String value);
    void setIntHeader(String name, int value);
    void addIntHeader(String name, int value);
    void setDateHeader(String name, long date);
    void addDateHeader(String name, long date);
    void setStatus(int sc);
    void sendError(int sc, String msg) throws IOException;
    void sendError(int sc) throws IOException;
    void sendRedirect(String location) throws IOException;
    String encodeURL(String url);
    String encodeRedirectURL(String url);
}

Servlet Annotations

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface WebServlet {
    String[] value() default {};
    String[] urlPatterns() default {};
    int loadOnStartup() default -1;
    WebInitParam[] initParams() default {};
    boolean asyncSupported() default false;
    String smallIcon() default "";
    String largeIcon() default "";
    String description() default "";
    String displayName() default "";
}

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface WebFilter {
    String[] value() default {};
    String[] urlPatterns() default {};
    DispatcherType[] dispatcherTypes() default {DispatcherType.REQUEST};
    String[] servletNames() default {};
    WebInitParam[] initParams() default {};
    boolean asyncSupported() default false;
}

JavaServer Pages (JSP)

API for creating dynamic web pages using Java code embedded in HTML.

JspPage

public interface JspPage extends Servlet {
    void jspInit();
    void jspDestroy();
}

public interface HttpJspPage extends JspPage {
    void _jspService(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException;
}

PageContext

public abstract class PageContext extends JspContext {
    public static final int PAGE_SCOPE = 1;
    public static final int REQUEST_SCOPE = 2;
    public static final int SESSION_SCOPE = 3;
    public static final int APPLICATION_SCOPE = 4;
    
    public abstract void initialize(Servlet servlet, ServletRequest request, 
        ServletResponse response, String errorPageURL, boolean needsSession, 
        int bufferSize, boolean autoFlush) throws IOException, IllegalStateException, IllegalArgumentException;
    public abstract void release();
    public abstract HttpSession getSession();
    public abstract Object getPage();
    public abstract ServletRequest getRequest();
    public abstract ServletResponse getResponse();
    public abstract Exception getException();
    public abstract ServletConfig getServletConfig();
    public abstract ServletContext getServletContext();
    public abstract void forward(String relativeUrlPath) throws ServletException, IOException;
    public abstract void include(String relativeUrlPath) throws ServletException, IOException;
    public abstract void include(String relativeUrlPath, boolean flush) throws ServletException, IOException;
    public abstract void handlePageException(Exception e) throws ServletException, IOException;
    public abstract void handlePageException(Throwable t) throws ServletException, IOException;
}

JavaServer Faces (JSF)

Component-based web application framework for building user interfaces.

UIComponent

public abstract class UIComponent implements StateHolder {
    public abstract Map<String, Object> getAttributes();
    public abstract ValueExpression getValueExpression(String name);
    public abstract void setValueExpression(String name, ValueExpression binding);
    public abstract String getClientId(FacesContext context);
    public abstract String getFamily();
    public abstract String getId();
    public abstract void setId(String id);
    public abstract UIComponent getParent();
    public abstract void setParent(UIComponent parent);
    public abstract boolean isRendered();
    public abstract void setRendered(boolean rendered);
    public abstract String getRendererType();
    public abstract void setRendererType(String rendererType);
    public abstract boolean getRendersChildren();
    public abstract List<UIComponent> getChildren();
    public abstract int getChildCount();
    public abstract UIComponent findComponent(String expr);
    public abstract Map<String, UIComponent> getFacets();
    public abstract UIComponent getFacet(String name);
    public abstract Iterator<UIComponent> getFacetsAndChildren();
    public abstract void broadcast(FacesEvent event) throws AbortProcessingException;
    public abstract void decode(FacesContext context);
    public abstract void encodeBegin(FacesContext context) throws IOException;
    public abstract void encodeChildren(FacesContext context) throws IOException;
    public abstract void encodeEnd(FacesContext context) throws IOException;
    protected abstract FacesContext getFacesContext();
    protected abstract Renderer getRenderer(FacesContext context);
}

FacesContext

public abstract class FacesContext {
    public static FacesContext getCurrentInstance();
    public abstract Application getApplication();
    public abstract Iterator<String> getClientIdsWithMessages();
    public abstract ExternalContext getExternalContext();
    public abstract FacesMessage.Severity getMaximumSeverity();
    public abstract Iterator<FacesMessage> getMessages();
    public abstract Iterator<FacesMessage> getMessages(String clientId);
    public abstract RenderKit getRenderKit();
    public abstract boolean getRenderResponse();
    public abstract boolean getResponseComplete();
    public abstract ResponseStream getResponseStream();
    public abstract void setResponseStream(ResponseStream responseStream);
    public abstract ResponseWriter getResponseWriter();
    public abstract void setResponseWriter(ResponseWriter responseWriter);
    public abstract UIViewRoot getViewRoot();
    public abstract void setViewRoot(UIViewRoot root);
    public abstract void addMessage(String clientId, FacesMessage message);
    public abstract void release();
    public abstract void renderResponse();
    public abstract void responseComplete();
}

Expression Language (EL)

Unified Expression Language for web applications.

ELContext

public abstract class ELContext {
    public static final String TYPE_OBJECT = "javax.el.TYPE_OBJECT";
    
    public abstract ELResolver getELResolver();
    public abstract FunctionMapper getFunctionMapper();
    public abstract VariableMapper getVariableMapper();
    public abstract boolean isPropertyResolved();
    public abstract void setPropertyResolved(boolean resolved);
    public abstract void putContext(Class<?> key, Object contextObject);
    public abstract Object getContext(Class<?> key);
    public abstract Locale getLocale();
    public abstract void setLocale(Locale locale);
}

ValueExpression

public abstract class ValueExpression extends Expression {
    public abstract Object getValue(ELContext context);
    public abstract void setValue(ELContext context, Object value);
    public abstract boolean isReadOnly(ELContext context);
    public abstract Class<?> getType(ELContext context);
    public abstract Class<?> getExpectedType();
}

WebSocket API

Java API for WebSocket endpoints and bidirectional communication.

ServerEndpoint

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ServerEndpoint {
    String value();
    String[] subprotocols() default {};
    Class<?>[] decoders() default {};
    Class<?>[] encoders() default {};
    Class<? extends ServerEndpointConfig.Configurator> configurator() 
        default ServerEndpointConfig.Configurator.class;
}

Session

public interface Session extends Closeable {
    RemoteEndpoint.Basic getBasicRemote();
    RemoteEndpoint.Async getAsyncRemote();
    boolean isOpen();
    boolean isSecure();
    WebSocketContainer getContainer();
    void addMessageHandler(MessageHandler handler);
    Set<MessageHandler> getMessageHandlers();
    void removeMessageHandler(MessageHandler handler);
    String getProtocolVersion();
    String getNegotiatedSubprotocol();
    List<Extension> getNegotiatedExtensions();
    Map<String, Object> getUserProperties();
    Principal getUserPrincipal();
    URI getRequestURI();
    Map<String, List<String>> getRequestParameterMap();
    String getQueryString();
    Map<String, String> getPathParameters();
    String getId();
    void close() throws IOException;
    void close(CloseReason closeReason) throws IOException;
}

Lifecycle Annotations

@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface OnOpen {
}

@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface OnClose {
}

@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface OnMessage {
}

@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface OnError {
}

Message Handlers

public interface MessageHandler {
    interface Whole<T> extends MessageHandler {
        void onMessage(T message);
    }
    
    interface Partial<T> extends MessageHandler {
        void onMessage(T partialMessage, boolean last);
    }
}

public interface RemoteEndpoint {
    void sendString(String text) throws IOException;
    void sendBytes(ByteBuffer data) throws IOException;
    void sendPartialString(String fragment, boolean isLast) throws IOException;
    void sendPartialBytes(ByteBuffer partialByte, boolean isLast) throws IOException;
    void sendPing(ByteBuffer applicationData) throws IOException;
    void sendPong(ByteBuffer applicationData) throws IOException;
    void sendObject(Object data) throws IOException, EncodeException;
    
    interface Basic extends RemoteEndpoint {
        Writer getSendWriter() throws IOException;
        OutputStream getSendStream() throws IOException;
    }
    
    interface Async extends RemoteEndpoint {
        long getSendTimeout();
        void setSendTimeout(long timeoutmillis);
        Future<Void> sendText(String text);
        Future<Void> sendBinary(ByteBuffer data);
        Future<Void> sendObject(Object data);
    }
}

WebSocket Container

public interface WebSocketContainer {
    long getDefaultMaxSessionIdleTimeout();
    void setDefaultMaxSessionIdleTimeout(long timeout);
    int getDefaultMaxBinaryMessageBufferSize();
    void setDefaultMaxBinaryMessageBufferSize(int max);
    int getDefaultMaxTextMessageBufferSize();
    void setDefaultMaxTextMessageBufferSize(int max);
    Set<Extension> getInstalledExtensions();
    
    Session connectToServer(Object annotatedEndpointInstance, URI path) throws DeploymentException, IOException;
    Session connectToServer(Class<?> annotatedEndpointClass, URI path) throws DeploymentException, IOException;
    Session connectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, URI path) throws DeploymentException, IOException;
    Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointConfig cec, URI path) throws DeploymentException, IOException;
}

Usage Examples

Basic Servlet

@WebServlet("/hello")
public class HelloServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
            throws ServletException, IOException {
        resp.setContentType("text/html");
        resp.getWriter().println("<h1>Hello, World!</h1>");
    }
}

JSF Managed Bean

@Named
@ViewScoped
public class UserBean implements Serializable {
    private String name;
    private List<User> users;
    
    @PostConstruct
    public void init() {
        loadUsers();
    }
    
    public String save() {
        // Save user logic
        return "success";
    }
    
    // getters and setters
}

WebSocket Endpoint

@ServerEndpoint("/websocket")
public class EchoEndpoint {
    
    @OnOpen
    public void onOpen(Session session) {
        System.out.println("WebSocket opened: " + session.getId());
    }
    
    @OnMessage
    public String onMessage(String message, Session session) {
        return "Echo: " + message;
    }
    
    @OnClose
    public void onClose(Session session, CloseReason closeReason) {
        System.out.println("WebSocket closed: " + closeReason.getReasonPhrase());
    }
    
    @OnError
    public void onError(Session session, Throwable throwable) {
        throwable.printStackTrace();
    }
}

Install with Tessl CLI

npx tessl i tessl/maven-javax--javaee-api

docs

dependency-injection.md

ejb.md

enterprise-services.md

index.md

json-processing.md

messaging.md

persistence.md

rest-services.md

security.md

transactions.md

validation.md

web-services.md

web-technologies.md

xml-binding.md

tile.json