public class DevModeHandler extends Object implements Serializable
webpack-dev-server.
This class is meant to be used during developing time. For a production mode
site webpack generates the static bundles that will be served
directly from the servlet (using a default servlet if such exists) or through
a stand alone static file server.
By default it keeps updated npm dependencies and node imports before running
webpack server
| Modifier and Type | Field and Description |
|---|---|
static String |
WEBPACK_SERVER
The local installation path of the webpack-dev-server node script.
|
| Modifier and Type | Method and Description |
|---|---|
static DevModeHandler |
getDevModeHandler()
Get the instantiated DevModeHandler.
|
String |
getFailedOutput()
Return webpack console output when a compilation error happened.
|
boolean |
isDevModeRequest(javax.servlet.http.HttpServletRequest request)
Returns true if it's a request that should be handled by webpack.
|
boolean |
serveDevModeRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Serve a file by proxying to webpack.
|
static DevModeHandler |
start(VaadinContext context,
DeploymentConfiguration configuration,
File npmFolder)
Start the dev mode handler if none has been started yet.
|
void |
stop()
Stops the dev server.
|
public static final String WEBPACK_SERVER
public static DevModeHandler start(VaadinContext context, DeploymentConfiguration configuration, File npmFolder)
context - VaadinContext where to store the
DevModePort on which Webpack is listening.configuration - deployment configurationnpmFolder - folder with npm configuration filespublic void stop()
public static DevModeHandler getDevModeHandler()
null if not startedpublic boolean isDevModeRequest(javax.servlet.http.HttpServletRequest request)
request - the servlet requestpublic boolean serveDevModeRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws IOException
Note: it considers the HttpServletRequest.getPathInfo() that will
be the path passed to the 'webpack-dev-server' which is running in the
context root folder of the application.
request - the servlet requestresponse - the servlet responseIOException - in the case something went wrong like connection refusedpublic String getFailedOutput()
Copyright © 2000–2019 Vaadin Ltd. All rights reserved.