@Override public Entity getEntity(String decodedPath) { return new ServletWarEntity(getServletContext(), decodedPath); }
/** * Returns the root reference of new Restlet requests. By default it returns * the result of getBaseRef(). * * @param request * The Servlet request. * @return The root reference of new Restlet requests. */ public Reference getRootRef(HttpServletRequest request) { return getBaseRef(request); }
@Override public boolean isNormal() { return !isDirectory(); }
/** * Returns the request method. * * @return The request method. */ @Override public String getMethod() { return getRequest().getMethod(); }
@Override public void init() throws ServletException { if ((getComponent() != null)) { if ((getApplication() != null) && (getApplication().isStopped())) { try { getApplication().start(); } catch (Exception e) { log("Error during the starting of the Restlet Application", e); } } } }
@Override public Entity getParent() { Entity result = null; int index = this.fullName.lastIndexOf("/"); if (index != -1) { result = new ServletWarEntity(getServletContext(), this.fullName .substring(0, index + 1)); } return result; }
/** * Returns the response stream if it exists, null otherwise. * * @return The response stream if it exists, null otherwise. */ @Override public OutputStream getResponseEntityStream() { try { return getResponse().getOutputStream(); } catch (IOException e) { return null; } }
/** * Constructor. * * @param parentContext * The parent context. */ public ServletWarClient(Context parentContext, javax.servlet.ServletContext servletContext) { super(parentContext.createChildContext(), (List<Protocol>) null); getProtocols().add(Protocol.WAR); this.helper = new ServletWarClientHelper(this, servletContext); }
/** * Creates a new Servlet call wrapping a Servlet request/response couple and * a Server connector. * * @param server * The Server connector. * @param request * The Servlet request. * @param response * The Servlet response. * @return The new ServletCall instance. */ protected HttpServerCall createCall(Server server, HttpServletRequest request, HttpServletResponse response) { return new ServletCall(server, request, response); }
/** * Creates a new client for the WAR protocol. * * @param context * The parent context. * @param config * The Servlet config. * @return The new WAR client instance. */ protected Client createWarClient(Context context, ServletConfig config) { return new ServletWarClient(context, config.getServletContext()); }
/** * Constructor. * * @param client * The client to help. * @param servletContext * The Servlet context. */ public ServletWarClientHelper(Client client, ServletContext servletContext) { super(client); getProtocols().clear(); getProtocols().add(Protocol.WAR); this.servletContext = servletContext; }
/** * Constructor. * * @param context * The Servlet context. * @param target * The target Restlet. */ public ServletConverter(ServletContext context, Restlet target) { super(new Context(new ServletLogger(context))); this.target = target; }
/** * Returns the response address.<br> * Corresponds to the IP address of the responding server. * * @return The response address. */ @Override public String getServerAddress() { return getRequest().getLocalAddr(); }
/** * Returns the server port. * * @return The server port. */ @Override public int getServerPort() { return getRequest().getServerPort(); }
/** * Returns the server domain name. * * @return The server domain name. */ @Override public String getHostDomain() { return getRequest().getServerName(); }
@Override public InputStream getRequestEntityStream(long size) { try { return getRequest().getInputStream(); } catch (IOException e) { return null; } }
@Override public String getSslCipherSuite() { return (String) getRequest().getAttribute( "javax.servlet.request.cipher_suite"); }
/** * Indicates if the request was made using a confidential mean.<br> * * @return True if the request was made using a confidential mean.<br> */ @Override public boolean isConfidential() { return getRequest().isSecure(); }
@Override public String getClientAddress() { return getRequest().getRemoteAddr(); }
@Override public int getClientPort() { return getRequest().getRemotePort(); }